Tracing method calls and their parameters

42 views
Skip to first unread message

Kristopher Micinski

unread,
May 20, 2016, 8:42:53 PM5/20/16
to android-...@googlegroups.com
Hey all,

Apologies upfront if this is the wrong list to ask this question on, if someone would recommend another resource more appropriate I'll redirect my question instead.

I'm currently doing some work where I want to be able to trace method calls and returns for an app's control flow. Ideally, I'd like to be able to have a stream of invocations and returns recorded in a log file, which I could subsequently parse. I'd like it if this also included parameters. Right now, the solution I used is based on binary rewriting, which works well enough. But I wondered if someone had any other tips at a solution to this.

I've thought of using a debugger for this, and have found this project:


I'm wondering if tracing all method calls in the app will be feasible for the Android debugger, or if it would totally cripple performance. That debugger currently halts execution upon entry, but I'd modify it to instead log entry and then continue on with the program. I've also seen this tool `systrace` that seems fairly popular. I'm able to see that the end of the HTML file generated by it produces raw output. I don't really need much of the lower level information, and I wasn't able to tell if it was able to trace all methods within an app. Would anyone be able to comment as to whether this would be a possibility? I also believe the overhead is pretty high: since I don't need a lot of the instrumentation it's using (into the kernel, for example) I'd prefer to get rid of that (but not sure that's possible, likely not).

Thanks for any pointers or suggestions!

Kris

Reply all
Reply to author
Forward
0 new messages