ExtendedAndroidTools
ExtendedAndroidTools copied to clipboard
Implement Java debugger Python API
Raw JDWP is too verbose for convenient debugging experience. Ideally we would be able to debug Java processes using API consisting of Threads, StackFrames, Variables and Breakpoints that underneath translates all interactions to/from JDWP messages. The API should support two use cases:
- Interactive debugging from Python REPL, for example
debugger = connect(...)
event = await debugger.on("void java.lang.Integer.toString()")
thread = event.thread
thread.stackTrace
thread.frame[0].this
thread.resume()
- Scripting, users specifying set of breakpoints and reactions to breakpoints as standalone python scripts, for example:
debugger = connect(...)
@debugger.on("void java.lang.Integer.toString()")
async def callback(event: BreakpointEvent):
thread = event.thread
println(f"Called toString on ${thread.frame[0].this}")
println(thread.stackTrace)
event2 = await thread.singleStep()
println(thread.stackTrace)
Once completed we should be able to use new API to debug Java processes on host machine, as well as Java processes on Android devices.