<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 23, 2013 at 2:56 PM, Eugene Velesevich <span dir="ltr"><<a href="mailto:evel@ispras.ru" target="_blank">evel@ispras.ru</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hello,<br>
<br>
Changes from v3: Instead of writing the backtrace as Array, the backtrace is<br>
now recorded as a list of stack frame nodes with optional stack frame details<br>
(the scheme is below).<br>
<br>
This patch implements backtrace recording during tracing, and adds support in<br>
'apitrace dump' and QApitrace. Backtrace is obtained via platform-specific<br>
functions (and, internally, in platform-specific format). Then it is parsed to<br>
produce an std::vector of stack frame structs: { char *module, *function,<br>
*filename, *linenumber, *offset } (some fields may be NULL) and is written<br>
into the trace file in the Enter call section as a call detail:<br>
<br>
BACKTRACE<br>
    FRAME<br>
        MODULE "module"<br>
        FUNCTION "Foo"<br>
        FILENAME "foo.cpp"<br>
        LINENUMBER "1234"<br>
        OFFSET "0xSDF"<br>
    FRAME<br>
        FUNCTION "Boo"<br>
        // no filename line info available for this frame<br>
END_BACKTRACE<br>
<br>
A platform-dependent mechanism is provided to specify a set of traced<br>
calls for which backtraces will be recorded. It is possible to specify<br>
either function names, or prefixes of names by appending a '*' (e.g.<br>
"glUniform*").<br>
<br>
On Android the backtrace is retrieved from Dalvik via libdvm functions<br>
imported at runtime.<br>
Function set is specified in /data/apitrace.fnames, one per line.<br>
<br>
On Linux the backtrace is retrieved via glibc backtrace(), and will not always<br>
yield filename:linenumber information.<br>
Function set is specified via APITRACE_BT_FUNCTIONS environment variable.<br>
<br>
On other platforms, obtaining a backtrace is not implemented by this patch.<br></blockquote><div><br></div><div>Eugene,</div><div><br></div><div>Thanks for the update. I've pushed it plus a few tweaks I deemed necessary to the branch <a href="https://github.com/apitrace/apitrace/commits/backtrace" target="_blank">https://github.com/apitrace/apitrace/commits/backtrace</a></div>

<div><br></div><div>I believe the binary format is now good enough.</div><div><br></div><div>To merge this to master I need a few final things:</div><div><br></div><div>- please confirm that Android was not busted with my changes (as I only tested on Linux)</div>
<div><br></div><div style>- 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)</div>
<div style><br></div><div style>   - and add a command line option to to "apitrace trace" to enable this</div><div> </div><div style>Jose</div><div><br></div>
</div></div></div>