简体   繁体   English

使用eclipse调试OpenJDK源代码

[英]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. 在我的项目中,我想使用eclipse调试OpenJDK版本8的C / C ++源代码。 For this purpose I have done following: 为此,我做了以下事情:

  1. Compiled the OpenJDK8 with --with-debug-level=slowdebug using this readme . 使用此自述 --with-debug-level=slowdebug使用--with-debug-level=slowdebug编译OpenJDK8。
  2. Imported the sources makefile project into eclipse 将源码makefile项目导入eclipse
  3. Created an eclipse run configuration, executing gdb against the compiled OpenJDK's java.exe and targeting a sample java program. 创建了一个eclipse运行配置,对已编译的OpenJDK的java.exe执行gdb并定位示例java程序。 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) 在这个配置中我附加了JDK源代码目录路径,这样eclipse就可以将调试符号转换为源代码行并查看它们(显然)

With this approach, I am able to debug through the code of files like java.c . 通过这种方法,我可以通过java.c等文件的代码进行调试。

My problem is that somehow I still cannot debug through native code. 我的问题是,我仍然无法通过本机代码进行调试。 Like for example java.lang.System.currentTimeMillis() . 例如java.lang.System.currentTimeMillis()

To me it looked like the libraries were not included into the eclipse gdb-run. 对我来说,看起来这些库没有包含在eclipse gdb-run中。 I tried to run gdb manually, and it still didn't work to debug through that code section. 我试图手动运行gdb,它仍然无法通过该代码部分进行调试。

Has anybody expirienced same behavior, or did ever try to debug the JDK source code? 有没有人有同样的行为,或曾经尝试调试JDK源代码? 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. 很高兴听到有关如何正确调试JDK源代码的任何提议。

Thank you in advance. 先感谢您。

You may need to force eclipse into debug mode via the top right corner beetle icon. 您可能需要通过右上角甲虫图标强制eclipse进入调试模式。

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. 最后,您可能需要在eclipse项目设置中指定编译器。 Keep in mind that the Eclipse debugger does not work for all compilers, usually because of an incompatible linker. 请记住,Eclipse调试器不适用于所有编译器,通常是因为链接器不兼容。 I would recommend looking online for a compatibility list. 我建议在线查找兼容性列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM