OMNeT++ allows you to use gdb for debugging your simulations. There are some subtle steps that must be taken to allow gdb to run your application. Signing gdb will tell the Mac that it is authorized to allow gdb to launch other programs on the Mac (like omnetpp).
Installing and signing gdb
The following instructions assume you have installed homebrew on your Mac.
From a Terminal session:
$ brew install gdb $ gdb (gdb) quit
If you try to use gdb without signing it you will likely receive this message:
Unable to find Mach task port for process-id 28885: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))
To create a self-signed certificate for gdb:
- Launch the Keychain Access Utility as follows:
Finder > Go > Applications > Utilities > Keychain Access
- Create a certificate from the Keychain Access menu:
Certificate Assistant > Create a Certificate...
- Build the certificate.
Name: gdb-cert Identity Type: Self Signed Root Certificate Type: Code Signing Let me override defaults: (checked)
- Click Continue repeatedly until you reach the prompt for the location to store the certificate. Try to put it in the System keychain. If that fails you can put it in the Login keychain; then export it (Keychain Access (menu) > File > Export Items…) and import it into the System keychain (Keychain Access (menu) > File > Import Items…).
- Verify the certificate now exists in the System keychain:
- Open the info on the certificate and set Trust > Code Signing to Always Trust:
- Quit the Keychain Access application and reboot the Mac.
- Because of problems seen on some MacBooks you should use the following steps to be sure the gdb application is signed with the gdb-cert certificate that was just created:
$ sudo killall taskgated $ codesign -fs gdb-cert "$(which gdb)" $ codesign -vvv "$(which gdb)" /usr/local/bin/gdb: valid on disk /usr/local/bin/gdb: satisfies its Designated Requirement $
- Finally, you may also want to stop gdb from opening the application you are debugging via a shell:
$ echo "set startup-with-shell off" > ~/.gdbinit