Why is gdb not working in eclipse when it is working fine from command line?

大城市里の小女人 提交于 2020-01-15 03:49:30

问题


I have created and successfully compiled a C++ application for Linux using eclipse. When I debug it from the command line everything works perfect, I can debug just fine.

But I require debugging in eclipse because is more convenient and easy. I configure the debug session and when trying to launch it I get the error:

Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Warning:\nCannot insert breakpoint 1.\nCannot access memory at address 0x1fff82e8\nCannot insert breakpoint 2.\nCannot access memory at address 0x80001ea4\n
Warning:\nCannot insert breakpoint 1.\nCannot access memory at address 0x1fff82e8\nCannot insert breakpoint 2.\nCannot access memory at address 0x80001ea4\n

But I have no idea why I am getting that error, especially because gdb is working fine when I execute it from cmd.

These are my c++ compiler flags in eclipse:

-std=c++98 -O0 -g3 -Wall -c -fmessage-length=0

When creating the project I chose the "Hello world C++ Project" and the "Linux GCC" as the toolchain.

I'm working with the following versions of GDB and Eclipse:

  • Eclipse Neon.1a Release (4.6.1)
  • GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1

回答1:


The only way I can reproduce this problem is to have address breakpoints enabled. As far as I am concerned this is a bug in CDT, but in the meantime as a workaround remove or disable any address breakpoints from the Breakpoints view.

I have submitted Bug 509894 to track the issue in CDT.



来源:https://stackoverflow.com/questions/41453034/why-is-gdb-not-working-in-eclipse-when-it-is-working-fine-from-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!