存在调试符号,但 Eclipse 不将它们与源代码关联

发布于 2024-11-17 03:27:50 字数 807 浏览 6 评论 0原文

我正在修改一个相当大的程序(NS2网络模拟器),如果能够用Eclipse调试它就太好了。我配置了 makefile(将 -g 添加到 CFLAGS )以使 gcc 生成调试符号,并且确实生成了它们,但 Eclipse 拒绝实际找到与这些符号关联的代码。我使用“Makefile Project with Existing Code”导入了巨大的源代码文件夹,当我点击“debug”时,它运行程序。当我告诉调试器停止时,它通常会停止在我认识的方法中,但是当我单击该方法的名称时,它会显示“源不可用”,即使定义该方法的源文件实际上是在另一个选项卡中打开的。我确实已将所有源导入到项目中。我在 make 配置中遗漏了一些东西吗?

^冗长的令人困惑的解释,我知道......请参见屏幕截图: http://imageshack.us/photo/my-images/651/zzz1fu。 请注意,

上面屏幕截图中的 IPKTAgent::deBurst() 是在 Integrated_agent.h 中声明的——这是我在另一个选项卡中打开的文件。

另外,当我在项目资源管理器中展开正在调试的可执行文件的条目时,它只列出了它所组成的一些文件。什么给? (参见屏幕截图,列表中应该有更多文件,我正在使用的文件丢失了)。 屏幕截图: http://imageshack.us/photo/my-images/96/ zzz2z.jpg/

I am working on modifying a rather large program (NS2 network simulator), and it would be nice to be able to debug it with Eclipse. I configured the makefiles ( add -g to CFLAGS ) to make gcc generate the debugging symbols, and they are indeed generated, but Eclipse refuses to actually find the code associated with those symbols. I imported the HUGE folder of source code using the "Makefile Project with Existing Code", and when I hit "debug" it runs the program. When I tell the debugger to stop, it often stops in a method I recognize, but when i click on the method's name, it says "source not available" even though the source file where the method is defined is actually open in another tab. I do have all the sources imported into the project. Am I missing something in the make configuration?

^long confusing explanation, I know... see screenshot, :
http://imageshack.us/photo/my-images/651/zzz1fu.jpg/

Note that IPKTAgent::deBurst() from the above screenshot is declared in integrated_agent.h -- that is the file I have open in the other tab.

also, when I expand the entry for the executable I'm debugging in the project explorer, it only lists some of the files it is composed of. What gives? (see screenshot, there should be more files on the list, the ones I'm working with are missing).
screenshot: http://imageshack.us/photo/my-images/96/zzz2z.jpg/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北音执念 2024-11-24 03:27:50

刚刚测试过。对我有用。唯一的问题是我忘记添加 -O0 选项来禁用优化;对于你的情况来说这也可能是一个问题。

我可以建议:

  • 尝试禁用优化
  • 检查您使用的编译器选项是否真正应用。您使用 CFLAGS,但我在标签中看到 c++,因此您可能应该使用 CXXFLAGS (它可能取决于您使用的构建工具)
  • IPKTAgent:: deBurst()integrated_agent.h 中声明。但它是在哪里实现的呢?检查它是否在标头中实现和/或您可以访问实现它的源文件。
  • 检查是否可以使用 gdb 调试可执行文件
  • 尝试创建简单的基于 automake/autoconf 的项目,并检查是否可以在 gdb 和 eclipse 中调试它。你应该能够。

Just tested it. Works for me. The only issue was that I forgot to add -O0 option to disable optimization; it can be an issue in your case too.

What I can suggest:

  • Try to disable optimization
  • Check that compiler options you use are really applied. You use CFLAGS, but I see c++ in tags, so it is possible that you should use CXXFLAGS (it can depend on build tools you use)
  • IPKTAgent::deBurst() is declared in integrated_agent.h. But where is it implemented? Check that it is implemented in header and/or you can access to the source file where it is implemented.
  • Check that you can debug your executable with gdb
  • Try to create simple automake/autoconf based project and check that you are able debug it in gdb and eclipse. You should be able.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文