[PATCH] Backtrace for android and linux
José Fonseca
jose.r.fonseca at gmail.com
Thu Apr 4 15:09:03 PDT 2013
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'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
On Thu, Apr 4, 2013 at 1:02 PM, Eugene Velesevich <evel at ispras.ru> wrote:
> Hello,
>
> This patch implements call stack recording during tracing. The symbolic
> backtrace is recorded as a string returned from a new fake function,
> glFakeBacktraceFunction.
>
> 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 one get backtrace via glibc backtrace().
> This way doesn't yeild file name and line number information.
> But one may use gcc libbacktrace:
> http://gcc.gnu.org/git/?p=gcc.git;a=tree;f=libbacktrace
> Function set is specified via APITRACE_BT_FUNCTIONS environment variable.
>
> I'm not aware how to get the backtrace on MAC OS.
More information about the apitrace
mailing list