Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Remote debugging(No source file named)
Remote debugging [message #777454] Tue, 10 January 2012 14:46 Go to next message
zhivko z is currently offline zhivko zFriend
Messages: 4
Registered: January 2012
Junior Member
Hello everybody. I'm working on big C project with own makefiles. I'm trying to debug a binary file. When I start the debugger everything works fine, but when I toggle a breakpoint in test.c. I receive this error message "No source file named test.c". So this thing happens when I use "GDB (DSF) Automatic Remote Debugging Launcher" as "Preferred Launcher". When I use "Standard Remote Create Process Launcher" as "Preferred Launcher" I don't have this error Shocked . I'm sure that I'm using shared libraries with debug symbols on Host and target. Another thing is that in both cases the debugger works fine it stops on break points and enter in functions. I'm using Eclipse Indigo 8.0.1 my operation system is "Linux Ubuntu 10.04 LTS" my target OS is Linux too, gdb version on Host is 7.2 and gdbserver on target is 7.2 too. So my question is: is this an Eclipse CDT bug or I'm doing something wrong.

Note: I made configuration to gdbinit file, it looks like this:

set sysroot /my/debugger/dir
set solib-search-path /my/debugger/lib/dir
set debug-file-directory /my/execfile/dir
Re: Remote debugging [message #777460 is a reply to message #777454] Tue, 10 January 2012 14:54 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
The GDB (DSF) debugger integration uses absolute paths to set breakpoints, while the Standard one uses relative paths (I think). Using absolute paths with a remote target may require you to set a mapping between your host path and your target path. This tells Eclipse to replace the path of the host and use the path of the target and vice versa. You can set this in the launch configuration, Source tab, Add... Path Mapping.

Note that you can see all GDB interactions in the gdb traces console, which can really help figure out what is going on:

Re: Remote debugging [message #778288 is a reply to message #777454] Thu, 12 January 2012 07:43 Go to previous messageGo to next message
zhivko z is currently offline zhivko zFriend
Messages: 4
Registered: January 2012
Junior Member
Thank Marc,

I set path mapping and the error is still there. I was read in one forum that "No source file named x.c" means that your library hasn't been loaded yet at the time when the debugger is trying to set a breakpoint. I checked in gdb traces and I see that gdb is trying to set a breakpoint in my source file before the library file was loaded. It look something like this:

306,128 17-break-insert --thread-group i1 -f /xxx/xxx.c:441
306,129 &"No source file named /xxx/xxx.c.\n"
306,130 17^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/xxx/xxx.c:441",times="0",original-location="/xxx/xxx.c:441"}

306,485 =library-loaded,id="/tmp/",target-name="/tmp/",host-name="/xxx/",symbols-loaded="0",thread-group="i1"

And what means "symbols-loaded="0"" I'm 100% sure that I'm using library with debug symbols.
Re: Remote debugging [message #866395 is a reply to message #778288] Mon, 30 April 2012 21:46 Go to previous message
Sergio Castelani is currently offline Sergio CastelaniFriend
Messages: 1
Registered: April 2012
Junior Member
I got the same problem trying to debug a remote application using CDT (local side) + gdbserver (remote side).
When I tried to set a breakpoint at Eclipse, a "No source file named ..." message came up.

I used this steps to check what was going on at my gdb session and fix the problem:

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)
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)
Previous Topic:configure GDB for eclipse to use jlink edu
Next Topic:Starting Debug: Exception occurred during launch
Goto Forum:

Current Time: Thu May 24 00:47:44 GMT 2018

Powered by FUDForum. Page generated in 0.01969 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top