Deadlock
Deadlock

Reputation: 819

Dalvik bytecode tracer

How can I get the trace of dalvik bytecode that is being executed while the device is running an app (like logcat does)?

Upvotes: 2

Views: 942

Answers (3)

pan yang
pan yang

Reputation: 11

It is realy too slow to trace the method not to speak the byte code,when you want to know what the app is doing the best way is to trace method first,then trace the byte code in it.

Upvotes: 0

JesusFreke
JesusFreke

Reputation: 20262

There is no existing tool to do what you want, but it might be possible to implement such a tool without too much work.

The general idea is that you want to connect to dalvik's vm as a debugger, using the jdwp protocol, and single step the virtual machine, inspecting the state between each step and printing out the instruction. You should be able to get the... instruction index. Or maybe the instruction offset, via JDWP.

Additionally, you will need to read the dex file, and look up the exact instruction being executed, based on the instruction index/offset you get from JDWP.

You should be able to use AndBug to implement the first part of the above solution, and then use dexlib to access the dex file, in order to get the instruction.

Upvotes: 3

Stephan
Stephan

Reputation: 7388

You might want to check out traceview

Upvotes: 0

Related Questions