inspecting hotspot code using gdb

Ben Cheng bccheng at google.com
Wed Oct 24 11:10:09 PDT 2007


I tried both the debug and fastdebug versions and the outcomes were the
same. I agree that debugging the launcher is the right way to do; I second
guessed that because for debugging gcc one ought to debug cc1. I think it is
because gcc forks a new process for cc1, but java opens shared libraries to
start the VM.

Apparently the gdb I used was having problems handling the symbol size
associated with libjvm.so so I saw all kinds of weird problems. Things
should be all cool after the problems in gdb are fixed.

Thanks,
-Ben


On 10/24/07, Ted Neward <ted at tedneward.com> wrote:
>
>  At the risk of stating the obvious… Are you using the debug or fastdebug
> builds? Are you sure the java launcher you're firing up is the right one?
>
>
>
> I can't imagine how else you'd debug Hotspot under gdb **except** to fire
> up the launcher… Here's a thought: fire up gdb against the launcher, and set
> a breakpoint on JNI_CreateJVM() or another JNI method used in the launcher,
> preferably as early as possible. When you hit that breakpoint, **then**
> set the breakpoint for ciEnv::register_method(). (The fact that the Hotspot
> DLLs/.sos are loaded dynamically—rather than at load time—may be throwing
> gdb off when you try to set that breakpoint prior to execution. I know it
> does for WinDbg when trying to debug Rotor…)
>
>
>
> Ted Neward
>
> Java, .NET, XML Services
>
> Consulting, Teaching, Speaking, Writing
>
> http://www.tedneward.com
>
>
>
> *From:* hotspot-dev-bounces at openjdk.java.net [mailto:
> hotspot-dev-bounces at openjdk.java.net] *On Behalf Of *Ben Cheng
> *Sent:* Thursday, October 18, 2007 5:48 PM
> *To:* hotspot-dev at openjdk.java.net
> *Subject:* inspecting hotspot code using gdb
>
>
>
> 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
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.15.0/1077 - Release Date:
> 10/18/2007 9:54 AM
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.15.3/1082 - Release Date:
> 10/20/2007 2:59 PM
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-dev/attachments/20071024/10e204e9/attachment.html 


More information about the hotspot-dev mailing list