7

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

well, I use eclipse on linux, so eclipse takes the native linker, hopefully... assert(false) is not rly an option because i want to debug through the jdk source code... the jdk compilation takes around 15 minutes and it is not feasable to recompile it every time... i was able to debug the JDK using this article which uses netbeans , but still , i need a solution for debugging jdk with eclipse
Sorry I wasn't any help. This may sound strange, but it might help me figure out the problem if I knew why you needed any particular compiler as opposed to a more mainstream one. As a side note, did you import JDK8 as a project, or did you create a project, then import it? I don't know how helpful I can be without a response, but keep in mind that I'll still be here when the bounty runs out, so there's no need to stress yourself out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.