A sample use of the debugger:
- use bootclasspath to load elf4j.jar during boot
- set gdb.elf.provider to provider implementation
- set provider.tmp.dir to tmp dir
- set methods.to.register to target methods, use "package.class.method.signature" to describe target methods. Better to use fuzzy matching, add "." to distinguish between methods with similar prefix or suffix. Don't put too much methods at a time, ulimit may not allow too many open files. If some method is not register in the call chain, the stack unwinding may not work properly.
Example:
rvm -gdb -Xms180m -Xmx360m -Xbootclasspath/a:elf4j.jar -Dgdb.elf.provider=net.sourceforge.elf4j.providers.MRPProvider -Dprovider.tmp.dir=/tmp/rvm/ -Dmethods.to.register="org.jikesrvm.classloader.TableBasedDynamicLinker.,org.jikesrvm.runtime.DynamicLinker.,.JNIFunctions.,.ObjectInputStream.,.TestSerialization.,.ObjectAccessor." -cp . test.org.jikesrvm.basic.core.serialization.TestSerializatio
Break points can be set at absolute address or line number within file.
- br *0x00007fffd3af93ec
- br DataInputStream.java:176
If the first way is used, users must break at sysStartMainThread first, then set the absolute break point, since before that, the image isn't loaded yet.
If the second way is used, method containing the line must be specified as one of the targets.
info frame, bt works fine.
Example
use bt:
use i f:
...
disassemble
disassemlbe/m $rip,+128 can show assembly code with line number.
Step or stepi can go through instructions one after another.
Using next requires register method as one of the targets to enable line number. Also add 'org.jikesrvm.classloader.TableBasedDynamicLinker.' and 'org.jikesrvm.runtime.DynamicLinker.' to target methods, to enable next command during dynamic resolution of call sites.