[PATCH v4] Backtrace via call detail

José Fonseca jose.r.fonseca at gmail.com
Wed May 8 14:25:41 PDT 2013


On Tue, Apr 23, 2013 at 2:56 PM, Eugene Velesevich <evel at ispras.ru> wrote:

> Hello,
>
> Changes from v3: Instead of writing the backtrace as Array, the backtrace
> is
> now recorded as a list of stack frame nodes with optional stack frame
> details
> (the scheme is below).
>
> This patch implements backtrace recording during tracing, and adds support
> in
> 'apitrace dump' and QApitrace. Backtrace is obtained via platform-specific
> functions (and, internally, in platform-specific format). Then it is
> parsed to
> produce an std::vector of stack frame structs: { char *module, *function,
> *filename, *linenumber, *offset } (some fields may be NULL) and is written
> into the trace file in the Enter call section as a call detail:
>
> BACKTRACE
>     FRAME
>         MODULE "module"
>         FUNCTION "Foo"
>         FILENAME "foo.cpp"
>         LINENUMBER "1234"
>         OFFSET "0xSDF"
>     FRAME
>         FUNCTION "Boo"
>         // no filename line info available for this frame
> END_BACKTRACE
>
> A platform-dependent mechanism is provided to specify a set of traced
> calls for which backtraces will be recorded. It is possible to specify
> either function names, or prefixes of names by appending a '*' (e.g.
> "glUniform*").
>
> On Android the backtrace is retrieved from Dalvik via libdvm functions
> imported at runtime.
> Function set is specified in /data/apitrace.fnames, one per line.
>
> On Linux the backtrace is retrieved via glibc backtrace(), and will not
> always
> yield filename:linenumber information.
> Function set is specified via APITRACE_BT_FUNCTIONS environment variable.
>
> On other platforms, obtaining a backtrace is not implemented by this patch.
>

Eugene,

Thanks for the update. I've pushed it plus a few tweaks I deemed necessary
to the branch https://github.com/apitrace/apitrace/commits/backtrace

I believe the binary format is now good enough.

To merge this to master I need a few final things:

- please confirm that Android was not busted with my changes (as I only
tested on Linux)

- please make default not capture backtraces on linux (I'm fine leaving
backtraces on by default on Android if nobody else opposes) -- this is
temporarily until backtrace capture is fast enough that the overhead is
negligble (which I think it should be possible)

   - and add a command line option to to "apitrace trace" to enable this

Jose
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/apitrace/attachments/20130508/32fe9149/attachment.html>


More information about the apitrace mailing list