]> git.cworth.org Git - apitrace/commit
Backtrace via call detail
authorEugene Velesevich <evel@ispras.ru>
Tue, 23 Apr 2013 13:56:14 +0000 (17:56 +0400)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 4 May 2013 09:11:06 +0000 (10:11 +0100)
commitaa1b2136cc72893e519ff73c47e2ecd29cafe1da
tree013ee762567cd107bf9509fffc48222a92cbe8d4
parentd6aa74c803556e4eb82919aef6f0edb06a5811aa
Backtrace via call detail

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.
20 files changed:
CMakeLists.txt
common/trace_backtrace.cpp [new file with mode: 0644]
common/trace_backtrace.hpp [new file with mode: 0644]
common/trace_dump.cpp
common/trace_format.hpp
common/trace_model.cpp
common/trace_model.hpp
common/trace_parser.cpp
common/trace_parser.hpp
common/trace_writer.cpp
common/trace_writer.hpp
common/trace_writer_local.cpp
common/trace_writer_local.hpp
common/trace_writer_model.cpp
gui/apitracecall.cpp
gui/apitracecall.h
gui/mainwindow.cpp
gui/ui/mainwindow.ui
wrappers/gltrace.py
wrappers/trace.py