Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Gdb remote debugging error: Can't fine source file at ...(How to tell Eclipse to define the correct source path for GDB remote debugging)
Gdb remote debugging error: Can't fine source file at ... [message #1752981] Tue, 31 January 2017 16:11 Go to next message
chanthy toeung is currently offline chanthy toeungFriend
Messages: 2
Registered: January 2017
Junior Member
Hi,

I tried to create a GDB remote debugging using "C/C++ Remote Application". However, when i launch Eclipse debug session, i got the following error:

Can't find a source file at "/cygdrive/c/Users/.../src/test.c"
Locate the file or edit the source lookup path to include its location.

The source file is actually in "c/Users/.../src/test.c"

I have no idea why Eclipse tries to look for "/cygdrive/c/User/..."

Can you please help, how do I tell Eclipse not to look for "Cygdrive/..." ?

Regards,
Chanthy
Re: Gdb remote debugging error: Can't fine source file at ... [message #1753024 is a reply to message #1752981] Wed, 01 February 2017 09:11 Go to previous messageGo to next message
Alex Freidin is currently offline Alex FreidinFriend
Messages: 32
Registered: July 2009
Member
When compiling with Cygwin tool-chain, Cygwin GCC embeds the paths in the form /cygdrive/<drive>/<path> into the debug info of the object files and the binary.

I would first check these:
0. Are you using Cygwin tool-chain for Windows or a tool-chain for embedded development built with Cygwin? Explain your setup.
1. Switch to debug as a Local C/C++ Application and see if it shows the same error.
2. Check if your binary parser is Cygwin
3. Is your main() located in test.c and "Stop on startup at main" checked in your debug configuration?
4. Check what GDB is used in local setup, is it GDB from Cygwin?
5. As a workaround, you can always try the "Source" tab to define source lookup path manually.
6. To observe how the paths are defined for each source file, open the Executables view and add your binary.
Re: Gdb remote debugging error: Can't fine source file at ... [message #1753073 is a reply to message #1753024] Wed, 01 February 2017 15:21 Go to previous messageGo to next message
chanthy toeung is currently offline chanthy toeungFriend
Messages: 2
Registered: January 2017
Junior Member
Thank you for the quick response.
0. Are you using Cygwin tool-chain for Windows or a tool-chain for embedded development built with Cygwin? Explain your setup.
I m using tool-chain for embedded dev. built with Cygwin. I installed a gcc cross compiler for a PowerPC target using Cygwin. After that I install the GDB cross debugger for PowerPC the same manner i built my GCC tool-chain.

1. I cannot switch to debug as a local C/C++ Application because I am debugging with an Emulator. I don't have a HW target yet, and the only way i figure out how it works with Eclipse is to use the "C/C++ Remote Application"

2. Check if your binary parser is Cygwin
I don't know how to check this, can you provide a hint?

3. Is your main() located in test.c and "Stop on startup at main" checked in your debug configuration?
Yes. I configured the debugger tab to stop at the "main" of my application.

4. Check what GDB is used in local setup, is it GDB from Cygwin?
In my configuration, i configured it to use "cross-gdb" from Cygwin.
5. As a workaround, you can always try the "Source" tab to define source lookup path manually.
I tried it, but it didn't work. However, i tried another workaround, when my Eclipse is connected with GDBserver, then i can manually specify my source file by using "Locate File" button. However, i find this workaround is not practical, and i would like to find a solution that can avoid manual step.

6. To observe how the paths are defined for each source file, open the Executables view and add your binary.
After adding my binary file, i can see that each source file are located in \cygdrive\<drive>\<path>, so I guess the problem is from my binary file, and not Eclipse?

Re: Gdb remote debugging error: Can't fine source file at ... [message #1753155 is a reply to message #1752981] Thu, 02 February 2017 09:42 Go to previous message
Alex Freidin is currently offline Alex FreidinFriend
Messages: 32
Registered: July 2009
Member
The problem is probably in Eclipse/CDT. I had a similar issue with ARM cross compiler built with Cygwin and ended up patching the binary parser to handle Cygwin path syntax correctly. For details, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=337780 and references.
Binary parsers are configured in project properties:
index.php/fa/28301/0/

If it's binary parser issue, then the right way to solve it is by adding Cygwin ELF Parser to Eclipse/CDT.
As temporary solution, you may try to replace the paths from /cygdrive/c to c:/ using "debugedit" utility. If it is available in Cygwin, you may add it to Post-Build step of your project to avoid doing it manually after every build.

http://manpages.ubuntu.com/manpages/zesty/man8/debugedit.8.html

Try to click on the files in Executables view, that probably doesn't work as well.
Previous Topic:Build targets and configurations.
Next Topic:Chained dependency order in Eclipse CDT
Goto Forum:
  


Current Time: Thu Apr 25 16:26:44 GMT 2024

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

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

Back to the top