Menu

How to use the low level debugger interface

  1. choose target method

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

  1. set break points

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.

3. check stack, frame info info frame, bt works fine. Example use bt:

#0 SetDoubleField(reference, primitive, primitive, primitive)void (Lorg/jikesrvm/jni/JNIEnvironment;=@0x8, I=@0x9de3, I=@0x9de3, D=@0x4018000000000000) at JNIFunctions.java:1992
#1 0x00007fffd3af93ec in Java_org_apache_harmony_misc_accessors_ObjectAccessor_setDouble (env=0x70018310, accessorObj=0x8, obj=0x10, fieldID=40419, value=6) at ../shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.c:63
...

use i f:

Stack level 0, frame at 0x71443810:
rip = 0x650ce4a4 in SetDoubleField(reference, primitive, primitive, primitive)void (JNIFunctions.java:1992); saved rip 0x7fffd3af93ec
called by frame at 0x71443850
...

  1. disassemble
  2. step/next
  3. print object info
  4. print class info
  5. print method info
  6. print unicode string
  7. print primary array
Posted by Da Feng 2011-10-30 | Draft

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.