How to Use Gdb in Eclipse for C/C++ Debugging

How do I use GDB in Eclipse for C/C++ Debugging?

The following instructions are for Eclipse 3.5 (Galileo). For 3.6 (Helios), they are similar except for the link in step 2.

  1. Go to Help > Install New Software.
  2. Add the CDT repository http://download.eclipse.org/tools/cdt/releases/galileo to the list of repositories.
  3. Select the CDT Repository. Now you need to install the CDT plugin along with GDB support from the list of available plugins (Select the CDT Main Features as well as CDT GNU Toolchain Debug support).

You should now be able to set breakpoints and inspect values of variables in Eclipse.

An alternative is to install DDD (an GUI frontend for GDB).

Eclipse Neon for c++ gdb debugger not working

Ok, so I don't exactly know what happened, but the debugger works now. I fiddled with the environment variables a bit, and it started working after that. I tried isolating the solution, so I reinstalled Eclipse to see what setting actually fixed the debugger, but after this reinstall the debugger just worked normally unlike the previous times.

For those who have this problem I have a few suggestions on trying to get it to work. All of the suggestions involve adding the MinGW bin path to some environment variable:

  1. Add the MinGW bin path to your Environment variables (the user one or system one or you could try both).
  2. Add the MinGW bin path to your Eclipse's build environment variables (Window -> Preferences -> C/C++ -> Build -> Environment)
  3. Add MinGW bin path to your Run Configurations Environment variables (Run -> Run Configurations -> Environment tab) if it's not already there.
  4. Add the GDB debugger path (should be something like this C:\MinGW\bin\gdb.exe) to your Debug Configurations (Run -> Debug Configurations -> Debugger Tab and in there put the gdb path in GDB debugger).

I don't actually know if this was what fixed the problem. My debugger just started to work after I tried those things (not necessarily in the stated order).

Debugging C++ code with gdb in Eclipse

Those sed commands are for replacing all instances of yy with eqvyy. You could add on to that to replace names in the source file as well:

sed s/yy/eqvyy/g eqv_yacc.tab.c | sed s/eqv_yacc\.tab\.c/eqv_yacc.c/g > eqv_yacc.C

How to change standard value of GDB debugger in eclipse-cdt programmatically

Use Plugin Spy to find which plugin contributes to UI.

GDB Debugger field is created inside GdbDebuggerPreferencePage

Sample Image



Related Topics



Leave a reply



Submit