How to debug HotSpot
athrun911500 at 163.com
Mon Sep 24 04:25:24 PDT 2012
Hi, Douglas and Staffan,
Thank you guys. That's really helpful. I found that "mods = (*env)->CallIntMethod(env, obj, mid);" still can't be stepped into. But it's OK with your help. But other components in libjvm.so are OK to debug and trace.
Thank you and you are so kind.
At 2012-09-24 17:25:37,"Douglas Simon" <doug.simon at oracle.com> wrote:
>On Sep 24, 2012, at 11:10 AM, Staffan Larsen <staffan.larsen at oracle.com> wrote:
>> First thing you need to do is to unzip the libjvm.diz file in the build directory. This will create a libjvm.debuginfo file which contains symbols for the debugger. This should really be done automatically, either when building or by the hotspot launcher.
>You can force this during building by setting ZIP_DEBUGINFO_FILES=0.
>> Then you can start your program with "hotspot -gdb MyClass". This will set a breakpoint in InitializeJVM where the libjvm.so is loaded. Type "fin" to step out of that method. Now libjvm.so is loaded and you can set breakpoints. For example "b os::sleep", then "cont".
>> I hope this helps,
>> On 22 sep 2012, at 16:13, ·¹Í° <athrun911500 at 163.com> wrote:
>>> Hi all,
>>> I need you guys' help. I'm reading and learning details in Hotspot, especially garbage collector. But I'm trapped in debug and trace hotspot itselp.
>>> I have built hotspot in ubuntu 12.04 and entered gdb mode with "hotspot -gdb ....". But as libjvm.so is loaded at runtime, I can't step into that part in gdb. Is there any way to step into libjvm.so?
>>> Besides, here is how I build hotspot. Just check if there are some additional building parameters.
>>> LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk/ HOTSPOT_BUILD_JOBS=5 ARCH_DATA_MODEL=64 ALT_OUTPUTDIR=../../build/hotspot_debug make jvmg jvmg1 2>&1 | tee ../../build/hotspot_debug
More information about the hotspot-dev