使用 Eclipse CDT 进行调试时出现问题 - 执行和 GUI 未对齐
我正在使用 Eclipse CDT 在 Ubuntu 中调试 C++ 项目。 GUI(即显示要执行的下一行源代码的小箭头)与实际执行不一致。具体来说,它比实际执行行低30行左右。我通过检查局部变量的值以及它们何时发生变化来确定实际的行是什么。
我曾多次尝试清理项目,包括手动删除所有已编译的目标代码、库等,希望这会导致 Eclipse 自行更新,但它坚持显示错误的行。
任何帮助表示赞赏。
I am using Eclipse CDT to debug a C++ project in Ubuntu. The GUI, i.e the small arrow showing the next line of source code to be executed, is not aligned with the actual execution. Specifically, it is about 30 lines below the actual executing line. I'm identifying what the actual line is by examining values of local variables and when they change.
I have tried cleaning the project several times, including manually deleting all compiled object-codes, libraries etc., in hope that it will cause Eclipse to update itself, but it insists on showing the wrong line.
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Eclipse 显示的源代码和实际用于编译可执行文件的源代码似乎很可能是同一文件的不同版本。
您可以使用
info source
GDB 命令询问 GDB(Eclipse 有一个 GDB 控制台窗口)实际使用什么源来构建可执行文件,以及 GDB 在哪里找到它正在显示的源(向 Eclipse)。我敢打赌编译目录+当前源文件!=位于
。It seems pretty likely that the source that Eclipse is showing, and the source that was actually used to compile the executable are different versions of the same file.
You can ask GDB (Eclipse has a console window for GDB) what source was actually used to build the executable, and where GDB found the source it is showing (to Eclipse) with
info source
GDB command. I bet theCompilation directory + Current source file != Located in
.检查您的可执行文件是否是最新的。由于某种原因,eclipse 生成的 makefile 不包含对静态库的依赖项。如果您在项目中使用静态库,则可能需要手动重建它们。
Check your executable is up to date. For some reason the makefile eclipse generates doesn't include dependencies on static libraries. If you are using static libraries as part of your project, you may need to rebuild them manually.