This article applies to macOS only.
The officially supported debugging package for Mac OS X is lldb, which is a fine debugger. However, many people including me still prefer to use gdb, the GNU debugger. In fact, I use cgdb, which provides nice color interface to gdb, and that is why I must install gdb on my Mac. Jun 11, 2017 The officially supported debugging package for Mac OS X is lldb, which is a fine debugger. However, many people including me still prefer to use gdb, the GNU debugger. In fact, I use cgdb, which provides nice color interface to gdb, and that is why I must install gdb on my Mac.
Mac Mojave Gdb
Question Installation of GDB on Mac (Mojave) (self.CProgramming) submitted 11 hours ago by Devreckas. Hey, I’ve just started taking a class in C. https://hyperever262.weebly.com/download-pictures-from-camera-to-mac.html. I have some programming exp in Java and Python, but not a ton with C. Anyways, I’ve been trying to get GDB installed on my system for debugging and I’ve been constantly running into errors. Debugging on Mac OS X. Lldb is the debugger XCode version 5 and above uses under the hood (previous versions used gdb).
See also: Multiplatform Programming Guide Citrix ica client for mac os x 10.5 8.
- 2Homebrew
- 3Fink
https://vbvxjy.weebly.com/blog/microsoft-word-2011-for-mac. This page explains how to build and install gdb on OS X using #Homebrew or #Fink. Microsoft remote desktop connection for mac.
Since OS X Mavericks 10.9, Xcode 5 no longer installs gdb by default and not globally.
Shou for mac. For general notes about installing FPC and Lazarus on OS X see Installing Lazarus on MacOS X.
About using gdb see GDB Debugger Tips.
Install homebrew
Open a Terminal and install homebrew:
Here is an example output:
Install gdb
or
Here is an example output:
The new gdb does not run yet. You will get the error:
Follow the instructions in the #Codesigning gdb section to solve this.
Install Fink
Install fink according to the description here: http://www.finkproject.org/download/index.php
Install a version of gdb
There is the choice between gdb with modifications of apple and more recent version of gdb without apple mods.
Band in a box 2001. The first gives you /sw/bin/gdb, the second /sw/bin/fsf-gdb. You can use either of the two, but only after you have code signed them (See below).
Follow the instructions on the gdb wiki. That page also contains troubleshooting hints.
If you installed apple-gdb via fink, there are two issues: Flipboard for mac.
- The file /sw/bin/gdb is a script that invokes the actual gdb binary. Codesigning the script is possible, but does not achieve anything. The actual binary that you have to codesign is located at /sw/lib/apple-gdb/gdb
- The author of the /sw/bin/gdb script does not like the codesigning method of giving gdb permissions to debug programs (because you still have to provide an administrator password in that case), and therefore that script will still produce an error even after codesigning the gdb binary. The easiest way to work around this is to start the debugger directly using /sw/lib/apple-gdb/gdb instead.
Gdb Debugger For Mac
- Breakpoints might not work: If that happens, go to your Project Options and change the Type of debug info from Automatic to Dwarf2 (-gw2). Do a project Build, and try running your application again via the IDE.
Retrieved from 'https://wiki.lazarus.freepascal.org/index.php?title=GDB_on_OS_X_Mavericks_or_newer_and_Xcode_5_or_newer&oldid=107128'
The officially supported debugging package for Mac OS X is lldb, which is a fine debugger. However, many people including me still prefer to use gdb, the GNU debugger. In fact, I use cgdb, which provides nice color interface to gdb, and that is why I must install gdb on my Mac. Unfortunately, it is not so easy to install and enable gdb to debug on Mac. In the previous post, I presented a method to do this, but I figure now that it was quite unsafe way to do so. For more details, please take a look at the official documentation.Gdb For Mac Os
Here is a better way of enabling gdb on your Mac. First, if you haven't installed gdb, do so.
$ brew install gdb
If you are using Sierra or above, run the following as well:
$ echo 'set startup-with-shell off' >> ~/.gdbinit
Next, this is the part where we give gdb debug other processes. Open up Keychain Access application and on the menu select Keychain Access -> Certificate Assistant -> Create a certificate.
Enter gdb-cert for the name, select Self Signed Root for Identity Type, select Code Signing for Certificate Type, and check the box Let me override defaults.
Click Continue several times until you see Specify a Location For the Certificate window. Select System for the Keychain and proceed.
Once the certificate is created, double click on it, and in the Trust section locate Code Signing item. Select Always Trust and exit. You will be prompted with your admin password to make the change.
Finally, you can close Keychain Access app and type in the following in terminal:
$ sudo killall taskgated
$ codesign -fs gdb-cert $(which gdb)
That's it! You will be able to use gdb on your Mac!
$ brew install gdb
If you are using Sierra or above, run the following as well:
$ echo 'set startup-with-shell off' >> ~/.gdbinit
Next, this is the part where we give gdb debug other processes. Open up Keychain Access application and on the menu select Keychain Access -> Certificate Assistant -> Create a certificate.
Enter gdb-cert for the name, select Self Signed Root for Identity Type, select Code Signing for Certificate Type, and check the box Let me override defaults.
Click Continue several times until you see Specify a Location For the Certificate window. Select System for the Keychain and proceed.
Once the certificate is created, double click on it, and in the Trust section locate Code Signing item. Select Always Trust and exit. You will be prompted with your admin password to make the change.
Finally, you can close Keychain Access app and type in the following in terminal:
$ sudo killall taskgated
$ codesign -fs gdb-cert $(which gdb)
That's it! You will be able to use gdb on your Mac!