Jdb cheatsheet
Debug Debuggable Application with JDP
- Execute command in context of app
run-as com.vulnerable.app id
- Start debug session with jdb
- Identify PID of last launched process
adb jdwp
- Create Communication channel
adb forward tcp:55555 jdwp:16346
-
Start a debug session. for more info check JDB Tutorial - Tutorialspoint
jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=55555
-
Start jdb in suspended state
Jdb commands
classes
: list all loaded classesclass/methods/fields class id
: Print details about a class and list its methods and fieldslocals
: print local variables in current stack frameprint/dump expr
: print information about an objectstop in method
: set a method breakpointclear method
: remove a method breakpointset lvalue = expr
: assign new value to field/variable/array elementsuspend
: suspends processresume
: resumes process