问题
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