2

I'd like to debug to debug a remote application with GDB.

My target system is a FreeBSD 8.3 box with gdbserver running. The application has been compiled successfully on that box. My Eclipse CDT 4.2 runs on Windows 7 with recent MinGW installed.

This is an external program I'd like to debug. It is neither written by me nor I do have it as a library. I do not intend to write my own program. In this case it is Subversion 1.8.0-dev which I want to debug.

I have created a simple C project, attached the source of Subversion. Created a remote debug config and attached the sources to the running thread in gdbserver.

Now, eclipse enters the main function of Subversion but when I set a breakpoint in another attached source file, Eclipse says: No source file named ra_loader.c or it simply says "No source available".

Then It simply exists the application.

What am I missing here?

Michael-O
  • 18,123
  • 6
  • 55
  • 121
  • Possible duplicate of [Remote debugging C++ applications with Eclipse CDT/RSE/RDT](https://stackoverflow.com/questions/15685104/remote-debugging-c-applications-with-eclipse-cdt-rse-rdt) – Ciro Santilli OurBigBook.com Aug 20 '17 at 13:19

1 Answers1

0

Try the suggestion made on this thread

Quote :

  • 1) run a debug session and open the gdb console inside Eclipse
    ('Console' tab -> 'Display Selected Console' button -> choose the one ending with 'gdb')

  • 2) use command 'pwd' in the console to print gdb's current working dir

  • 3) use command 'info line main' to get the source file where gdb expect to find of my "int main(...)" function

  • 4) concatenate the result of step 2 with result of step 3 (which should be a relative path) to see if it matches the correct source file I want

  • 5) use the 'cd' command in gdb (to change the current working dir) till I get the correct match in step 4 Knowing the initial working directory (2) and the correct working directory (5) for gdb , I had 2 options: 1) Use gdb's 'cd' command every time I launch a debug session (I could setup a .gdbinit file in the gdb initial working directory to do this automatically) or 2) Setup the 'Source' tab, in 'Debug Configurations', to make Eclipse use paths that match with gdb's initial working dir ('Project - Path Relative to Source Folders' worked for me)

user18428
  • 1,216
  • 11
  • 17