Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Debugging with gdb on macOS Sierra
Debugging with gdb on macOS Sierra [message #1766814] Tue, 27 June 2017 14:02 Go to next message
Stephan Muehlstrasser is currently offline Stephan MuehlstrasserFriend
Messages: 33
Registered: July 2009
Member
I found this earlier thread about debugging with CDT on macOS Sierra:

https://www.eclipse.org/forums/index.php?t=msg&th=1083362&goto=1750664&#msg_1750664

It points to https://bugs.eclipse.org/bugs/show_bug.cgi?id=509737, which is resolved in CDT 9.2.1 if I understand it correctly. I'm not seeing the problem described in the bug report, but I have different symptom that prevents debugging with gdb.

I have the following environment:


  • Eclipse Neon.3, which comes with CDT 9.2.1
  • Xcode 8.3.3
  • gdb 7.12.1 from MacPorts, installed as /opt/local/bin/ggdb, codesigned


I followed the recommendation from various places to put "set startup-with-shell off" into my .gdbinit file (found here: https://stackoverflow.com/questions/43188431/gdb-on-macos-sierra-10-12-4).

With this setup I can successfully debug C programs with gdb's command line interface.

When I try to use this gdb from Eclipse CDT, the application to debug is launched successfully, but apparently it doesn't see any of the command line arguments that I have applied in the "Program arguments" window in the run configuration. It will always display its usage message, as if no arguments were supplied on the command line

Is this a known issue, and is there a workaround?

Thanks
Stephan

Re: Debugging with gdb on macOS Sierra [message #1766817 is a reply to message #1766814] Tue, 27 June 2017 14:32 Go to previous messageGo to next message
Stephan Muehlstrasser is currently offline Stephan MuehlstrasserFriend
Messages: 33
Registered: July 2009
Member
Stephan Muehlstrasser wrote on Tue, 27 June 2017 10:02
When I try to use this gdb from Eclipse CDT, the application to debug is launched successfully, but apparently it doesn't see any of the command line arguments that I have applied in the "Program arguments" window in the run configuration. It will always display its usage message, as if no arguments were supplied on the command line


I now see what is happening: The program to debug does actually get all the arguments from "Program arguments" in the run configuration, but each argument is surrounded by additional single quotes.

Eclipse obviously surrounds each arguments with single quotes and expects that gdb launches the program to debug through a shell, which would remove the single quotes. But this is not the case because of the "set startup-with-shell off" command in the .gdbinit file.

The "set startup-with-shell off" command is a necessary workaround, because otherwise gdb will fail to start the application with the error message "During startup program terminated with signal ?, Unknown signal.".
Re: Debugging with gdb on macOS Sierra [message #1766845 is a reply to message #1766817] Wed, 28 June 2017 06:36 Go to previous message
Stephan Muehlstrasser is currently offline Stephan MuehlstrasserFriend
Messages: 33
Registered: July 2009
Member
I found the following bug report about this problem: https://bugs.eclipse.org/bugs/show_bug.cgi?id=516027

It contains the description of a workaround in Comment 5:

Quote:
My workaround is trying to set the arguments in .gdbinit file instead, just put the line like:
-------------------
set args arg1 arg2
-------------------


With that workaround I now can debug successfully with Eclipse Neon.3 on macOS Sierra.
Previous Topic:segmentation fault when starting up eclipse
Next Topic:Want to compile c++ eclipse project from command prompt
Goto Forum:
  


Current Time: Tue Apr 16 05:02:52 GMT 2024

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

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

Back to the top