使用eclipse调试OpenJDK源代码 [英] Debugging OpenJDK source-code with eclipse

查看:195
本文介绍了使用eclipse调试OpenJDK源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我想使用eclipse调试OpenJDK版本8的C / C ++源代码。为了这个目的,我已经做了以下内容:

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. 编译的OpenJDK8与 - 与调试级别= slowdebug 使用此自述

  2. 进口源生成文件项目变成蚀

  3. 创建了一个Eclipse运行配置,执行对已编译的OpenJDK的java.exe的GDB和靶向示例java程序。在这个配置中我附加了JDK源代码目录路径,这样eclipse就可以将调试符号转换为源代码行并查看它们(显然)

  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)

通过这种方法,我可以通过 java.c 等文件代码进行调试。

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

我的问题是,我仍然无法通过本机代码进行调试。例如 java.lang.System.currentTimeMillis()

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

对我来说,看起来这些库不是包含在eclipse gdb-run中。我试图手动运行gdb,它仍然无法通过该代码部分进行调试。

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.

是否有任何人遇到相同的行为,或曾尝试调试JDK源代码?我想我在这里遗漏了一些东西......也许我的方法对于这个任务来说是不正确的?很高兴听到有关如何正确调试JDK源代码的任何建议。

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.

提前谢谢。

推荐答案

您可能需要通过右上角甲虫图标,迫使日食进入调试模式。

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.

最后,您可能需要在eclipse项目设置中指定编译器。
请记住,Eclipse调试器不适用于所有编译器,通常是因为链接器不兼容。我建议在线查找兼容性列表。

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.

这篇关于使用eclipse调试OpenJDK源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆