inspecting hotspot code using gdb
Tom Rodriguez
Thomas.Rodriguez at Sun.COM
Thu Oct 18 18:09:40 PDT 2007
Using a debugger with the java launcher can be a little tricky since it normally
sets up the LD_LIBRARY_PATH and relaunches the VM to select the right libjvm.so
which makes debuggers unhappy. libjvm.so is also dynamically loaded so they
symbols won't be available until you've at least run it once. Your
LD_LIBRARY_PATH should be set to the value of the java.library.path property
from the VM you want to run. gdb will get into various bad states if you don't
do this part. Also by default you also want to suppress a lot of signals that
the JVM uses.
I attached the script I use for launching the VM under a debugger. It works for
dbx and gdb and has a little Java class for getting the java.library.path
property from a VM. You just prefix dbxr onto the full command line you want to
debug and it sets everything up for you. The script is a little ugly and has
some special bits to deal with getting properties from a JVM which might be at
least a little broken. Obviously if you are trying to debug a JVM which won't
even boot then it will be hard to get properties from it. It's possible to
derive the proper LD_LIBRARY_PATH setting from the location of the JDK but that
was error prone enough that I switched to using a class to read it out. Anyway,
hopefully it will be useful.
tom
Ben Cheng wrote:
> Hello,
>
> I tried to set a breakpoint in a Hotspot function, say
> "ciEnv::register_method", under gdb, but gdb couldn't seem to find the
> symbols. I am using my locally built libjvm.so so symbols should be
> there, so I am thinking that feeding the java launcher to gdb is the
> wrong thing to do here.
>
> Can someone explain the procedures to debug hotspot under gdb?
>
> Thanks,
> -Ben
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dbxr
Url: http://mail.openjdk.java.net/pipermail/hotspot-dev/attachments/20071018/bd5b2712/attachment.ksh
More information about the hotspot-dev
mailing list