Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » GDB under High Sierra - no joy!
GDB under High Sierra - no joy! [message #1793946] Tue, 21 August 2018 01:20 Go to next message
Andrew Voelkel is currently offline Andrew VoelkelFriend
Messages: 16
Registered: September 2016
Junior Member
I have a C++ only Mac project and I'm sick of dealing with the poor C++ environment in Xcode. So I'd like to use Eclipse Photon.

I've tried various recipes on Stack Overflow etc. to get native gdb to work with Mac OS High Sierra and Eclipse. After spending a couple hours still no joy. The variety of error messages is too great to enumerate. From the looks of the comments to the recipes I've found, this is far from a slam dunk.

The problems seem to be:

a) gdb 8.1 compatibility with Eclipse Photon.
b) Big time code signing crapola with gdb and High Sierra.

Should I just give up on this? I'm pretty damn frustrated at this point.

It sure would be nice if I could just get a code signed version of gdb.

I guess that most folks doing this sort of thing just use Xcode?
Re: GDB under High Sierra - no joy! [message #1795142 is a reply to message #1793946] Sun, 16 September 2018 22:19 Go to previous messageGo to next message
Marc-André Laperle is currently offline Marc-André LaperleFriend
Messages: 252
Registered: July 2009
Senior Member
I was able to make GDB 8.0.1 work OK on High Sierra, compiling it from source and following the instructions here https://sourceware.org/gdb/wiki/BuildingOnDarwin. There is some discussion here:
https://sourceware.org/bugzilla/show_bug.cgi?id=20266
Otherwise, you could also try the integration with LLDB, which I have been looking at improving, see https://wiki.eclipse.org/CDT/User/FAQ#How_do_I_get_the_LLDB_debugger.3F and following sections. It might not be a good solution for you yet but any feedback and bug reports are appreciated.
Re: GDB under High Sierra - no joy! [message #1795147 is a reply to message #1795142] Mon, 17 September 2018 05:26 Go to previous messageGo to next message
Andrew Voelkel is currently offline Andrew VoelkelFriend
Messages: 16
Registered: September 2016
Junior Member
I tried lldb-mi. It seemed to work, but then I tried debugging some stuff which uses the STL container library, and it was pretty useless.

I don't actually know that gdb would be much better. I've seen post about "pretty printing" and python scripts, but that doesn't exactly sound like gdb is truly STL aware.

For all its faults, Xcode actually handles this part "OK". It is a terrible C++ composition environment, but at least you can debug STL containers.

I'm kind of shaking my head that STL container debugging isn't completely integrated and old hat in Eclipse by now. How long has STL been around? A long time.

So at this point I use Eclipse for C++ composition and Xcode for debug. It seems pretty silly that is what I have to do, but there you have it. CLion is OK, but it isn't free and it has issues too.

If I were in Windows, Visual Studio would "just work". But I gave up on Windows when Windows 8 came out and I'm not going back anytime soon.
Re: GDB under High Sierra - no joy! [message #1795181 is a reply to message #1795147] Tue, 18 September 2018 04:06 Go to previous messageGo to next message
Marc-André Laperle is currently offline Marc-André LaperleFriend
Messages: 252
Registered: July 2009
Senior Member
You bring up a good point about STL support. I created a bug to track STL support https://bugs.eclipse.org/bugs/show_bug.cgi?id=539168
Most of the debug support in Eclipse was done for Linux and GNU toolchain (GCC, libstdc++ and GDB). With this combination, you can have good support for STL pretty printing and it should work out of the box. The way I understand it, GDB pretty printers are heavily tied to the standard library implementation details, so on macOS the pretty printing support would need to be implemented there for libc++ (I think that's the standard library being used?). I actually don't know how this works in Xcode but it sounds promising and maybe we can add it to lldb-mi support too.

I do understand your pain, I've used Eclipse+Xcode combination and Eclipse+VisualStudio combination for a very long time. Pre-lldb in Xcode, it got to a point where Apple-gdb support was pretty on par (i.e. as bad) as Xcode. In the end, no one in the... thousands of users?... cares enough to make this work as well as on Linux.
Re: GDB under High Sierra - no joy! [message #1795187 is a reply to message #1795181] Tue, 18 September 2018 06:32 Go to previous messageGo to next message
Andrew Voelkel is currently offline Andrew VoelkelFriend
Messages: 16
Registered: September 2016
Junior Member
I'm curious about what this "pretty printing" buys you. With LLDB in either Xcode or CLion, you can dive down into STL containers interactively, looking at individual elements in the containers, and opening them up in a tree view pretty seamlessly. Does pretty printing let you do this? It kinda doesn't sound like it.

I haven't been over to Windows to try this stuff on Visual Studio for a while, not since starting to use STL containers heavily. I'd be surprised if the experience were not at least as good as LLDB with Xcode or Clion, but I really don't know. I would think it would be a decent C++ composition tool also. But it isn't worth running Windows to do it. Not unless I'm hired to do a sizable C++ project on Windows, and I'm not holding my breath on that one.

Without good debug support, using STL containers definitely loses a lot of its appeal! I should be thankful to have it, even if I have to use one IDE for composition and one for debug.
Re: GDB under High Sierra - no joy! [message #1795292 is a reply to message #1795187] Thu, 20 September 2018 04:37 Go to previous messageGo to next message
Marc-André Laperle is currently offline Marc-André LaperleFriend
Messages: 252
Registered: July 2009
Senior Member
Quote:
I'm curious about what this "pretty printing" buys you. With LLDB in either Xcode or CLion, you can dive down into STL containers interactively, looking at individual elements in the containers, and opening them up in a tree view pretty seamlessly. Does pretty printing let you do this? It kinda doesn't sound like it.


Yes, it lets you do that.
Without: https://wiki.eclipse.org/images/3/31/NoPrettyPrint.png
With: https://wiki.eclipse.org/images/8/81/FullPrettyPrint.png
And you can also add your own. In LLVM for example, there are gdb pretty printers for a few base types, right in the repo.
Re: GDB under High Sierra - no joy! [message #1795341 is a reply to message #1795292] Thu, 20 September 2018 14:46 Go to previous messageGo to next message
Andrew Voelkel is currently offline Andrew VoelkelFriend
Messages: 16
Registered: September 2016
Junior Member
That's excellent news about STL "pretty printing". I'm about to do a cross development project Mac Host / Linux Target. This should make life much better.

It might also motivate me at some point to get gdb working on the Mac target.
Too bad it doesn't work outta the box though!
Re: GDB under High Sierra - no joy! [message #1795568 is a reply to message #1793946] Tue, 25 September 2018 11:25 Go to previous messageGo to next message
Avarro mickllov is currently offline Avarro mickllovFriend
Messages: 2
Registered: September 2018
Junior Member
in my case downgrading to 8.0.1 didn't help.
but the following steps helped.

(i inserted step 12, "check if it works" because, instead of restarting i've tested gdb and it worked just fine. i didn't follow the steps 12+)

Open Keychain Access
In menu, open Keychain Access > Certificate Assistant > Create a certificate
Give it a name (e.g. gdb-cert)
Identity type: Self Signed Root
Certificate type: Code Signing
Check: let me override defaults
Continue until "specify a location for..."
Set Keychain location to System
Create certificate and close Certificate Assistant.
Find certificate in System keychain.
Double click the certificate
Expand Trust, set Code signing to always trust
Restart taskgated in terminal: killall taskgated
Codesign gdb using your certificate: codesign -fs gdb-cert /usr/local/bin/gdb FetLife IMVU Canva
--- CHECK IF IT WORKS ---
Shut down your mac and restart in recovery mode (hold down command-Runtil apple logo appears)
Open terminal window
Modify System Integrity Protection to allow debugging: csrutil enable --without debug
Reboot your Mac
Debugging with gdb should now work as expected.

[Updated on: Wed, 26 September 2018 17:48]

Report message to a moderator

Re: GDB under High Sierra - no joy! [message #1795745 is a reply to message #1795568] Thu, 27 September 2018 15:45 Go to previous messageGo to next message
Andrew Voelkel is currently offline Andrew VoelkelFriend
Messages: 16
Registered: September 2016
Junior Member
Does STL pretty printing work for you?
Re: GDB under High Sierra - no joy! [message #1795799 is a reply to message #1795745] Sat, 29 September 2018 00:11 Go to previous message
Marc-André Laperle is currently offline Marc-André LaperleFriend
Messages: 252
Registered: July 2009
Senior Member
With GDB on macOS target? No, I don't think it's supposed to work out of the box right now since there would need to be pretty printers installed along with libc++. They are often installed with libstdc++ which is more commonly used on Linux. I did find this however but never tried it: https://libcxx.llvm.org/docs/UsingLibcxx.html#gdb-pretty-printers-for-libc
Previous Topic:undefined reference to class::class
Next Topic: Consequence of not using centeralized CDocumentProvider
Goto Forum:
  


Current Time: Sat Nov 17 03:00:41 GMT 2018

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

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

Back to the top