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?
Unable to find Mach task port for process-id 62995: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))
? – Exhilarationsudo gdb
so that you never see any complaints about mach ports, you would still get this issue of breakpoint trap with two threads, assuming that you're using the latest brew gdb 8.1 instead of 8.0.1 – KirkDuring startup program terminated with signal SIGTRAP, Trace/breakpoint trap.
instead under the two lines of[New Thread 0x____ of process ____]
, but it's clearly the same issue. – Kirk(gdb) run
. Message in OP's question occurs with(gdb) start
. This is almost certainly the same issue. – Kirk