Eclipse debug: "Error in final sequence - Failed to execute MI command" - c++

I'm running Eclipse on win7. I want to make console applications that can run on either windows or linux. I followed the guide here on how to setup the compiler
I'm trying to compile and run a simple hello world program. It compiles fine, but when I try to debug I get the following error:
'launching test' has encountered a problem.
Error in final launch sequence.
Clicking details reveals the following information.
Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Don't know how to run. Try "help target".
Don't know how to run. Try "help target".
My gdb debugger path is C:\codesourcery\bin\arm-none-eabi-gdb.exe
I'm not exactly sure how to proceed.

If you're creating a windows console then I would think you would need gdb found in c:\minGW or wherever you have your Windows 7 gcc toolchain.
To change your debugger on Eclipse Kepler go to:
Run->Debug Configurations. Select Debugger tab and in the "GDB debugger:" field, enter the path of your Windows gdb.exe file (c:\MinGW\bin\gdb.exe if you're using minGW)

I realize this is an old question, but hoping it will help someone. In my case, there was a breakpoint set with only a memory address (no file name associated with it). Not sure how I got into this situation... Once I removed the breakpoint, I was able to launch my program with debugger. Note, I am using Eclipse Luna CDT (SR2)

Related

VS Studio Code cant run GDB on helloworld.cpp on Ubuntu Linux

Successfully downloaded and installed Visual Studio Code for Ubuntu and went thru the config process OK including setup the GDB. Then I add a break point on the main procedure as told by intro tutorial. When I try to 'step over' (F10) I get this error message in the Debug output console:
ERROR: Unexpected GDB output from command "-exec-next". Cannot enable
the TUI when the interpreter is 'mi'
In my case, it was a problem that I had a hook-next defined in ~/.gdbinit.

can't do remote-debugging with j-link in Clion IDE

I am trying to remote-debug a project in Clion but I can't seem to get a working debugging session. I think I've correctly launched my gdb server/client because my gdb client connects to the JLinkGDBServerCL.exe process
and they communicate.However, in clion, I can't break in the source code. The only thing that I get from clion is a disassembly of my program with no symbol at all which is odd because there is a symbol table in the .elf
that I am trying to debug. And one last detail, I can't "step in" the assembly code neither (but I can run commands in the gdb client in Clion).
Here is a picture of my debug configuration : debug config
And here is what I'm talking about when I say I can't get a proper debugging session : "debugging session"
Does anybody know what the problem is ?
System info:
OS: Windows 10
IDE: Clion 2018.1.6
GDB Server: JLinkGDBServerCL.exe
Target: TM4C129 (cortex M4) (no OS, just a firmware)
Program: USBMicroloader.elf (debug mode)
I'm having the same issue. I found that if I add the path to the elf file from the build directory into the "Symbol file" (in the run configuration where you set up the remote gdb connection), it fixes your issue. This seems a bit kludgey, but I haven't been able to find a better solution.
However, the next issue I run into is that I can only run that configuration a single time. When I stop debugging I get a message in the console that reads Remote doesn't know how to detach. Debugger disconnected. The clean and build menu options are greyed out until I restart CLion.

CLion run program in separate system terminal

I have an ncurses program that I'd like to interactively debug using CLion. The problem is that when I run the program in CLion to debug it, the inbuilt console where the program is run doesn't display the output of the ncurses program properly.
I'd like to have the program run in my systems terminal so I can see the output properly whilst debugging the program with CLions debugger.
Is there any way to do this?
The best way to accomplish this is to use GDB now it can be really frustrating to get started so Ill show you how I accomplished it in linux
open a terminal and go to your project debug file and type gdbserver localhost:1234 ./myFile
open clion to myFile project and in the upper right corner you should see a build all (or your projects name) click it and go to "edit configurations"
in the upper left corner you should see a plus sign, click it and press "GDB remote debug"
then in "target remote" type tcp:127.0.0.1:1234
Next in "path mappings" press the plus and type /location/to/file/myFile (same file as in 1.) in both Remote and Location
Press OK and in the upper right corner select the name of the configuration that you just made and press debug
you might need to try to restart the gdbserver one more time for this to work but if you did all the steps above you should see a debug prompt come up and on the terminal you should see your project running.
There are some limitations with this for example you always have to run gdbserver localhost:1234 ./myFile command on your terminal for it to work.
Some Video/documentation that helped me:
Debugging with GDB at 33:35 (Video by JetBrain)
GDB documentation on Jetbrain
I hope this helped :)
In other debuggers, you would do this by running the ncurses application in a terminal, and attaching the debugger to the process using ncurses.
Doing that avoids interference between ncurses (which changes the terminal I/O modes) and the debugger's command-line.
The attach feature is a recently released feature of the CLions debugger:
Further reading:
More power to debug: Attach to local process (January 20, 2016)
CLion 1.2 roadmap (August 31, 2015)
Debugging in CLion (May 8, 2015 )
CLion answers frequently asked questions (September 16, 2014)
Debugging ncurses application with gdb
Using GNU's GDB Debugger:
Debugging Ncurses Programs

Gdb attach fail: debugging fastcgi C++ app with Netbeans

I have written a test fastcgi app. I want to debug it, using the Netbeans IDE. When I attempt to attach to the process, I get the error:
Gdb could not attach to the specified process.
I then tried the following:
sudo -i /bin/sh "path/to/netbeans"
Attaching to the process still failed (Got the message: Gdb could not attach to the specified process).
I then tried the suggestion made at this link
That also failed. I got the nessage: The executable associated with the selected project does not match the selected process ID.. after changing the run path so that the project executable now points to my cgi-bin directory, I now get the error: Gdb could not attach to the specified process.
I am now at a loss as to how to debug my app, using Netbeans. In case netbeans can't do this, is there another visual debugger that I can use?
I am running Linux Ubuntu.
Netbeans does have the ability to use gdb to attach to a process. From the link you posted did you also follow the "update" from the comments describing how to fix the kernel ptrace_scope issue in Ubuntu?
Another thing to try is to see if you get the same error attaching gdb via commandline, or if you really want to use a gui DDD. That way you can isolate whether it is Netbeans, gdb, or a permission problemn in Ubuntu.

Error in basic C++ program running in Netbeans IDE with Cygwin

I recently started learning C++ and I installed Netbeans IDE 6.9.1 and also the Cygwin compiler packages and configured them, and added Cygwin to my environment variable PATH like the instructions told me to.
I wrote a basic "Hello World" program and when I press Ctrl+F5 to "Debug Main Project" it seems to build fine but the black console/command prompt window flashes then disappears.
Then when I go to Run > Run Main Project, it builds and then a command prompt window pops up with the directory to "sh.exe" in its title.
I took a screenshot of the error message:
Does anyone know why this is happening and why I can't get the program to run properly even in debug?
Notice that in the screenshot I switched over to the MinGW tools because I thought maybe Cygwin was the problem, but the same error still occurs.
Any help would be greatly appreciated. Thank you.
"No such file or directory" in the error message is the key. When you run the project, it wants to access a file which is not there. Make sure that the paths are set up correctly.