Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging OpenJDK source-code with eclipse

in my project i want to debug the C/C++ source code of the OpenJDK version 8 using eclipse. For this purpose I have done following:

  1. Compiled the OpenJDK8 with --with-debug-level=slowdebug using this readme.
  2. Imported the sources makefile project into eclipse
  3. Created an eclipse run configuration, executing gdb against the compiled OpenJDK's java.exe and targeting a sample java program. Into this configuration I have attached the JDK source code directory path, so that eclipse is able to translate debug symbols to source-code lines and view them to me (obviously)

With this approach, I am able to debug through the code of files like java.c.

My problem is that somehow I still cannot debug through native code. Like for example java.lang.System.currentTimeMillis().

To me it looked like the libraries were not included into the eclipse gdb-run. I tried to run gdb manually, and it still didn't work to debug through that code section.

Has anybody expirienced same behavior, or did ever try to debug the JDK source code? I guess I am missing something here... Maybe my approach is just not correct for the task? Would be glad to hear any proposal about how to debug the JDK source code propperly.

Thank you in advance.

like image 652
Aksim Elnik Avatar asked Aug 20 '18 10:08

Aksim Elnik


1 Answers

You may need to force eclipse into debug mode via the top right corner beetle icon.

Another possible option is to use an assert(false) line instead of a break point.

finally, it's possible that you need to specify a compiler in your eclipse project settings. Keep in mind that the Eclipse debugger does not work for all compilers, usually because of an incompatible linker. I would recommend looking online for a compatibility list.

like image 145
Badasahog Avatar answered Sep 29 '22 11:09

Badasahog