Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Debugging with GDB - incorrect path to executable
Debugging with GDB - incorrect path to executable [message #1834836] Wed, 18 November 2020 19:32 Go to next message
Andrew Johnson is currently offline Andrew JohnsonFriend
Messages: 2
Registered: November 2020
Junior Member
I've installed Eclipse 2020-09, with Cygwin64 and packages gcc-core 10.2.0-1; gcc-g++ 10.2.0-1. This is on a Windows 10 VM running on MacOS.

I have a very simple helloworld program which compiles and runs in Eclipse, outputting "hello world!" on the console. When I try to debug this, I get a gdb error which I can't fathom:

"failed to execute MI command: -exec-run .... Error creating process: /cygdrive/c/eclipse/C:/Users/andrewjohnson/eclipse-workspace/HelloWorld/C:/Users/andrewjohnson/eclipse-workspace/HelloWorld/Debug/HelloWorld.exe, (error 2)."

Error 2 is a Windows code relating to file not found I believe. Not surprising given that path!

If I run If I run gdb from the command line in the HelloWorld\Debug directory - gdb .\HelloWorld.exe - it works fine and I get "hello world!" output.

I can't work out how Eclipse is building that path to pass to GDB. I do have a Path Mapping set in Source Lookup Path /cydrive/c -> C:\ (although I get that incorrect path generated irrespective).

What's being generated looks like a concatenation of Cygwin_Home, eclipse, CWD or PWD and the project executable. I'm pretty new to this so I've run out of ideas of what to check: it must be a configuration issue with Eclipse that I'm missing so if anyone can help I'd really appreciate it.

thanks
Re: Debugging with GDB - incorrect path to executable [message #1834866 is a reply to message #1834836] Thu, 19 November 2020 11:51 Go to previous messageGo to next message
Andrew Johnson is currently offline Andrew JohnsonFriend
Messages: 2
Registered: November 2020
Junior Member
I downgraded gdb v10.1-1 (sorry, I didn't post that information in the original post) to V8.3.1-1 and it works fine. Obviously Eclipse isn't ready to play with V10 yet.
Re: Debugging with GDB - incorrect path to executable [message #1844432 is a reply to message #1834866] Mon, 13 September 2021 23:39 Go to previous messageGo to next message
Vladimir Grishchenko is currently offline Vladimir GrishchenkoFriend
Messages: 104
Registered: July 2009
Senior Member
9.2-1 worked for me with Cygwin, gdb 10.2 works with MinGW however.
Re: Debugging with GDB - incorrect path to executable [message #1847185 is a reply to message #1834836] Mon, 18 October 2021 14:38 Go to previous messageGo to next message
Dirk Osswald is currently offline Dirk OsswaldFriend
Messages: 1
Registered: October 2021
Junior Member
Hi,

I can confirm this behaviour.
Eclipse 2021-03 / 4.19 with CDT 10.2.0 does not work with latest cygwin gdb 10.2.0 on

Error in final launch sequence:

Failed to execute MI command:
-exec-run
Error message from debugger back end:
Error creating process /cygdrive/c/ti/ccs1100/ccs/eclipse/C:/Users/r001483/workspace_v11/ccs11_cygwin_managed/C:/Users/r001483/workspace_v11/ccs11_cygwin_managed/Debug/ccs11_cygwin_managed.exe, (error 2).
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Error creating process /cygdrive/c/ti/ccs1100/ccs/eclipse/C:/Users/r001483/workspace_v11/ccs11_cygwin_managed/C:/Users/r001483/workspace_v11/ccs11_cygwin_managed/Debug/ccs11_cygwin_managed.exe, (error 2).
Error creating process /cygdrive/c/ti/ccs1100/ccs/eclipse/C:/Users/r001483/workspace_v11/ccs11_cygwin_managed/C:/Users/r001483/workspace_v11/ccs11_cygwin_managed/Debug/ccs11_cygwin_managed.exe, (error 2).


Its clear why the launch fails - the executable is searched in a path with cygwin and windows parts weirdly intermangled.
Re: Debugging with GDB - incorrect path to executable [message #1847401 is a reply to message #1847185] Tue, 26 October 2021 02:08 Go to previous messageGo to next message
David Mueller is currently offline David MuellerFriend
Messages: 1
Registered: October 2021
Junior Member
Confirming what Dirk saw; I get the same error, with intermangled paths.

This is on Eclipse 2021-09 RC1 (4.21.0 RC1) with CDT 10.4.0 and Cygwin gdb 10.2-1.

Rolling Cygwin gdb back to 9.2-1 fixes the problem.

Error in final launch sequence:

Failed to execute MI command:
-exec-run
Error message from debugger back end:
Error creating process /cygdrive/c/WINDOWS/system32/C:/Users/David/Desktop/AllProjects/SelectProject/C:/Users/David/Desktop/AllProjects/SelectProject/SelectProject.exe, (error 2).
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Error creating process /cygdrive/c/WINDOWS/system32/C:/Users/David/Desktop/AllProjects/SelectProject/C:/Users/David/Desktop/AllProjects/SelectProject/SelectProject.exe, (error 2).
Error creating process /cygdrive/c/WINDOWS/system32/C:/Users/David/Desktop/AllProjects/SelectProject/C:/Users/David/Desktop/AllProjects/SelectProject/SelectProject.exe, (error 2).
Re: Debugging with GDB - incorrect path to executable [message #1849589 is a reply to message #1847185] Wed, 26 January 2022 11:36 Go to previous messageGo to next message
manu goswami is currently offline manu goswamiFriend
Messages: 1
Registered: January 2022
Junior Member
Hi Developers,

Nothing works. No solution as above worked except below

I simply replaced gdb with msys gdb

ie. for example

current configuration

... Application Configuration .. Debug .. Debug

GDB Debugger gdb


to

GDB Debugger path to msys gdb (like for example c:\msys\bin\gdb.exe


Re: Debugging with GDB - incorrect path to executable [message #1850349 is a reply to message #1849589] Fri, 25 February 2022 17:47 Go to previous messageGo to next message
Mike Wilson is currently offline Mike WilsonFriend
Messages: 1
Registered: August 2019
Junior Member
I am using arm-linux-gnueabihf-gdb 8.3

and getting error:
Error in final launch sequence:

Failed to execute MI command:
-exec-run
Error message from debugger back end:
Don't know how to run.  Try "help target".
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Don't know how to run.  Try "help target".
Don't know how to run.  Try "help target".
Re: Debugging with GDB - incorrect path to executable [message #1850359 is a reply to message #1850349] Sat, 26 February 2022 18:20 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
Are you attempting to use an ARM-Linux native debugger on a Windows machine?


--

Tauno Voipio
Re: Debugging with GDB - incorrect path to executable [message #1858822 is a reply to message #1850349] Mon, 24 April 2023 19:06 Go to previous messageGo to next message
iklef mallem is currently offline iklef mallemFriend
Messages: 1
Registered: April 2023
Junior Member
Hi everyone,
I found a quick and dirty way to fix the issue in my environment eclipse (STM32CubeIDE Version: 1.12.0) and gdb v13.1 on cygwin
The way I fixed it implies the gdb binary recompilation .
I downloaded the latest version (13.1, in test) and modified a specific file before recompiling the binary.
what I changed is the file named windows-nat.c located in the gdb folder (where i uncompress the downloaded tar) : gdb13.1/gdb/windows-nat.c
what I modified in that file is a couple of line : find the following lines :

args = (wchar_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2)
* sizeof (wchar_t));
wcscpy (args, toexec);
wcscat (args, L" ");
wcscat (args, cygallargs);

and make them look like this :

args = (wchar_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2)
* sizeof (wchar_t));
wcscpy (args, wcsstr (toexec, L"Debug"));
// wcscat (args, L" ");
// wcscat (args, cygallargs);

then recompile the binary.
then in eclipse, in the debug configuration configure the debugger to run the newly compiled gdb binary.

Remember, this is a quick and dirty workaround, not a permanent fix.
hope this helps.
Re: Debugging with GDB - incorrect path to executable [message #1860371 is a reply to message #1858822] Tue, 01 August 2023 13:05 Go to previous message
rev plant is currently offline rev plantFriend
Messages: 1
Registered: August 2023
Junior Member
I get the same error, with intermangled paths.
Hubspot partner agency
stock market courses

[Updated on: Thu, 24 August 2023 13:51]

Report message to a moderator

Previous Topic:Project-->Properties-->C/C++ General does not appear
Next Topic:Can't run .exe files from eclipse!
Goto Forum:
  


Current Time: Thu Oct 03 11:12:11 GMT 2024

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

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

Back to the top