I compiled OpenJDK8 in mac. But When I used gdb to debug a simple java class(just system out), it always showed error that no source file name init.cpp. (Had added breakpoint in init.cpp: 95 line). However, it could step into C file like main.c. So not sure whether i had compiled OpenJDK8 correctly or use the correct version for dependencies. Checked the libjvm.dylib libjvm.dylib.dSYM exist in LD_LIBRARY_PATH.
[When I debug in Eclipse CDT, it has the same issue]
Using ENV:
mac sierra 10.12.6
gdb 7.12.1
Debug command:
export LD_LIBRARY_PATH=~/openjdk/build/macosx-x86_64-normal-server-fastdebug/hotspot/bsd_amd64_compiler2/fastdebug
ggdb --args ~/openjdk/build/macosx-x86_64-normal-server-fastdebug/jdk/bin/java Test
Result1 (breakpoint in cpp file):
(gdb) break init.cpp:95
No source file named init.cpp.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (init.cpp:95) pending.
(gdb) run
Starting program: ~/openjdk/build/macosx-x86_64-normal-server-fastdebug/jdk/bin/java Test
[New Thread 0x1403 of process 94443]
warning: unhandled dyld version (15)
hello,hotspot
[Inferior 1 (process 94443) exited normally]
Result2 (breakpoint in c file):
(gdb) break main.c:125
Breakpoint 2 at 0x100007912: file ~/openjdk/jdk/src/share/bin/main.c, line 125.
(gdb) run
Starting program: ~/openjdk/build/macosx-x86_64-normal-server-fastdebug/jdk/bin/java Test
[New Thread 0x1603 of process 94446]
warning: unhandled dyld version (15)
Thread 2 hit Breakpoint 2, main ()
at
~/openjdk/jdk/src/share/bin/main.c:125
125 return JLI_Launch(margc, margv,