[PATCH] Backtrace for android and linux

Eugene Velesevich eugvelesevich at gmail.com
Fri Apr 5 02:14:54 PDT 2013


On Fri, Apr 5, 2013 at 2:09 AM, José Fonseca <jose.r.fonseca at gmail.com> wrote:
>
> Hi Eugene,
>
> I think this can be quite useful.
>
> Instead of fake call, I believe it would be more practical to have the
> stack frames be a first class entitity in the trace binary file. That
> is, something like
>
> $ git diff
> diff --git a/common/trace_format.hpp b/common/trace_format.hpp
> index d5fd81b..96d4165 100644
> --- a/common/trace_format.hpp
> +++ b/common/trace_format.hpp
> @@ -85,6 +85,7 @@ namespace trace {
>   *
>   *   call_detail = ARG index value
>   *               | RET value
> + *               | STACKTRACE length stackframe+
>   *               | END
>   *
>   *   value = NULL
> @@ -127,6 +128,7 @@ enum CallDetail {
>      CALL_ARG,
>      CALL_RET,
>      CALL_THREAD,
> +    CALL_STACKTRACE,
>  };
>
>  enum Type {


 I thought about this way, but unlike the fake call new CallDetail
requires to increase the trace version.

> I'm not sure exactly what a "stackframe" should be. At minimum it should be
>
>    stackframe = module_string function_string
>
> But we should probably make it more flexible so we can add more info
> in the future.
>
> Jose
>

I guess, parsing strings like "at
android.view.HardwareRenderer$GlRenderer.initializeEgl(HardwareRenderer.java:582)"
results in unnecessary overhead at runtime. If it will be needed,
parsing may be made during trace file reading.


I'd prefer to store backtrace strings as-is during tracing because
their format is generally not known, and they might need to be
processed by addr2line and/or c++filt when showing to the user.


More information about the apitrace mailing list