Using javap & jdb
javap : javap -c <Classname> to look at the bytecode
jdb : jdb <Classname> (first javac -g to include debug info)
- run : run until the end or a breakpoint.
- stop in X.<method> [args] : set a breakpoint at X.method().
- stop at X.<linenum> : set a breakpoint at X’s line number linenum.
- threads, thread <n> : list and set current thread.
- where [i] [T_id] : list stack frames in threads and get PC info.
- locals : get local variables info.
- list, use : list and locate the source.
- step, step up, stepi, next, cont : debugging step commands.
- suspend [T_id], resume [T_id] : change the state of the thread(s).
- print, dump, eval : get info about an object.
- set <lvalue> = <expr> : assign new value to local values.
- classes, class <C_id> : get info about class(es).
- methods <C_id>, fields <C_id> : get info about a class’s methods and fields.