I compiled OpenJDK8 on mac. But when I used gdb to debug a simple java class (just from the system), it always showed an error that there is no source file name init.cpp . (Added breakpoint on init.cpp: 95 line). However, it can go to the C file, for example main.c. Therefore, I am not sure if I compiled OpenJDK8 correctly or used the correct version for dependencies. Checked that libjvm.dylib libjvm.dylib.dSYM exists in LD_LIBRARY_PATH.
[When I debug in Eclipse CDT, it has the same problem]
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
Result 1 (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,