Ho un errore durante il debug di un programma C in NetBeans.
GDB has unexpectedly stopped with return 127
Ecco uno screenshot degli strumenti di creazione:
Questo è quello che ho fatto per installare GDB (sotto Yosemite):
Installa brew
: link
Aggiorna brew
. Se hai già installato brew
, controlla gli aggiornamenti. Nel terminale:
$ brew update
Questo passaggio è risultato decisivo per me poiché, prima dell'aggiornamento, brew
non ha trovato alcun pacchetto gdb
:
$ brew install gdb # Error: No available formula for gdb
E dopo quello:
$ brew update
$ brew search | grep gdb # cgdb gdb gdbm pgdbf
$ brew install gdb
Creating a certificate
Start Keychain Access application (
/Applications/Utilities/Keychain Access.app
)Open menu
/Keychain Access/Certificate Assistant/Create a Certificate...
Choose a name (
gdb-cert
in the example), setIdentity Type
toSelf Signed Root
, setCertificate Type
toCode Signing
and select theLet me override defaults
. Click several times onContinue
until you get to theSpecify a Location For The Certificate
screen, then setKeychain
toSystem
.If you can't store the certificate in the
System
keychain, create it in thelogin
keychain, then exported it. You can then imported it into theSystem
keychain.Finally, using the contextual menu for the certificate, select
Get Info
, open theTrust
item, and setCode Signing
toAlways Trust
.You must quit Keychain Access application in order to use the certificate and restart
taskgated
service by killing the current running taskgated process (comment: for example withsudo pkill taskgated
or restarting).
E poi
Giving gdb permission to control other processes
If the certificate is known as
gdb-cert
, just use:$ codesign -s gdb-cert gdb
Comment: if
gdb
is not found, then add the path where it was installed. In my case:$ codesign -s gdb-cert /usr/local/Cellar/gdb/7.10/bin/gdb
gdb
o il percorso in cui è stato installato gdb (ad esempio /usr/local/Cellar/gdb/7.10/bin/gdb
) nel menu /Netbeans/Preferences/C/C++/Build Tools
campo Debugger Command field
.