[PATCH] egltrace/android: Fix tracing Zygote processes (v2)

Chad Versace chad.versace at linux.intel.com
Tue Jun 11 11:33:58 PDT 2013


On 06/07/2013 02:37 AM, Alexander Monakov wrote:
>
>
> On Thu, 6 Jun 2013, Chad Versace wrote:
>> Not only is the call to trimDirectory() unnecessary,
>
> Agreed, but ...
>
>> it also returns garbage when there is no path separator.
>
> no, this doesn't sound right.  Inspection of os::String::trimDirectory does
> not suggest anything like that might be possible: if there is no path
> separator in the string, rfindSep() returns end() and trimDirectory leaves the
> string untouched.  FWIW, previous Android users have not seen this problem.
>
> I guess the patch is fine, but it would be papering over a bigger issue.

I've instrumented some logging around the call to trimDirectory in the
troublesome location. Here's the code context:

----
     proc_name = getZygoteProcessName();
     os::log("apitrace[%d]:%s: proc_name=\"%s\"\n", pid, __PRETTY_FUNCTION__, proc_name.str());
     proc_name.trimDirectory();
     os::log("apitrace[%d]:%s: proc_name=\"%s\"\n", pid, __PRETTY_FUNCTION__, proc_name.str());
----

And here's the log:

----
D/apitrace( 3747): apitrace:void os::String::trimDirectory(): buffer="com.forthblue.pool"
D/apitrace( 3747): apitrace:void os::String::trimDirectory(): buffer="bin"
----

I agree with you that there exists an undiagnosed problem with trimDirectory, but I have
been unsuccessful diagnosing it. On the other hand, the call to trimDirectory isn't
needed and its removal fixes the bug's symptoms.


More information about the apitrace mailing list