Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get gdb working with Eclipse CDT under windows (fails to find source code)

Tags:

eclipse

cygwin

I installed cygwin (the latest 1.7.xx?), and then installed eclipse cdt (Juno).

When I tried to build a hello world project, despite eclipse identifying that cygwin was installed, it didn't work.

So I manually added c:\cygwin\bin to the path, which found all the executables in cygwin, including g++, make ld, etc.

Now, eclipse can build the project, but when debugging, gdb starts up and can't find the source code. It claims that it can't find:

/cygdrive/c/users/me/workspace/test1/test1.cc . even though that's exactly where it is. It's as though cygwin's directory system doesn't work.

I can manually load the source from:

c:\users\me\workspace\test1\test1.cc

and the debugger works, but the next time I start a new project, I have to do it again. How do you instruct the eclipse/cygwin combo to correctly find source code?

Alternatively, is Mingw any easier? I have experienced similar problems with eclipse seeing that mingw is there, but build failing because it doesn't find the executable.

like image 756
Dov Avatar asked Jun 24 '13 03:06

Dov


People also ask

Can we use GDB in Windows?

Installing gdb[edit] If you are using Linux, you probably already have gdb, but if you are using Windows, you will need to install it. MinGW distributes a Windows version of gdb. You can get the latest mingw installer here which can in turn install gdb.

Does Eclipse use GDB?

Set Eclipse for using gdb Select a launch configuration from the list on the left (e.g. C/C++ Application) Open the Debugger tab from the menu on the right. Set GDB debugger to the full path of your gdb binary file (the same used for signing the certificate) Set GDB command file to the full path of your .


1 Answers

Here is how I made it work.

  1. I goto Window ==> Preferences ==> C/C++ ==> Debug ==> Source Lookup Path
  2. I Add a Path Mapping: Project Source
  3. On the left side I put the path that Cygwin expects, i.e. \home\MyName\projects and on the right side I put the Windows path, i.e. C:\cygwin\home\MyName\projects

Then when I debug it finds the source file fine.

like image 123
ParthaM Avatar answered Nov 04 '22 21:11

ParthaM