Reputation: 8905
I have installed gdb 8.1 with brew.
I have codesign gdb also and .gdbinit as below:
set startup-with-shell off
.
I have disabled SIP feature:
$ csrutil status
System Integrity Protection status: disabled.
But gdb still doesn't work:
#include <iostream>
using namespace std;
int main() {
cout << "hello world!" << endl;
return 0;
}
Compile command:
g++ -g test.cpp
gdb output:
GNU gdb (GDB) 8.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin17.3.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...Reading symbols from /Users/mypc/Downloads/a.out.dSYM/Contents/Resources/DWARF/a.out...done.
done.
(gdb) run
Starting program: /Users/mypc/Downloads/a.out
[New Thread 0x2503 of process 802]
[New Thread 0x2303 of process 802]
During startup program terminated with signal ?, Unknown signal.
(gdb)
What correct steps to make gdb work on macos sierra?
Upvotes: 47
Views: 18170
Reputation: 21
I'm using macOS 10.13.6 and I was having the same issue that " (please check gdb is codesigned - see taskgated(8))" ...
When I downgraded the GDB from 8.2.1 to 8.0.1 and then created and signed the gdb-cert again and it simply worked..
Don't forget to change the path of gdb from 8.2.1 to 8.0.1 in debugger of eclipse, restart and it will work.
Upvotes: 0
Reputation: 3072
This is caused by latest gdb 8.1, downgrade gdb to 8.0.1 could solve this problem.
brew unlink gdb
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/9ec9fb27a33698fc7636afce5c1c16787e9ce3f3/Formula/gdb.rb
brew pin gdb
Upvotes: 61
Reputation: 662
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+)
gdb-cert
)
killall taskgated
codesign -fs gdb-cert /usr/local/bin/gdb
command-R
until apple logo appears)csrutil enable --without debug
information source:
pre Sierra: https://gist.github.com/hlissner/898b7dfc0a3b63824a70e15cd0180154
Sierra: https://gist.github.com/gravitylow/fb595186ce6068537a6e9da6d8b5b96d
Upvotes: 3