I\'m under osx 10.8.4 and have installed gdb 7.5.1 with homebrew (motivation get a new gdb with new features such as --with-python etc... )
Long story short when I
I experienced the same issue with GDB.
I am running under Mac OS X 10.8.5
aka Mountain Lion.
I am using GDB version 7.7.1
.
I compiled my test program with following command:
g++ -o gdb-sample.out -g gdb-sample.cpp
If I entered the command gdb sample.out
, I get the same cryptic error message:
"Unable to find Mach task port for process-id 46234: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))"
This error message however is a red herring.
The solution I found that worked for me was to simply invoke GDB using the superuser acct:
sudo gdb sample.out.
That works fine for me.
And that from that point I could run GDB example.out without using sudo.
Hope this helps and works for others. RSVP if it doesn't.
This may not be related. You can use lldb on macos instead of gdb. You don't need this hassle to install gdb.
lldb(http://lldb.llvm.org) is already installed by default in High Sierra
None of this worked for me and I had to go with a long run. Here is a full list of steps I've done to get it working.
Unfortunately, system certificate gave me Unknown Error = -2,147,414,007
which is very helpful, so I had to go with a workaround.
KeyChain Assistant -> Create certificate ->
Pick login
, gdb-cert
, Code Signing
Copy/move certificate to the System keychain (enter password)
gdb-cert
) click Get info
-> Trust Always
startup-with-shell
Enter in console: set startup-with-shell off
Remember configuration:
echo "set startup-with-shell off" >> ~/. gdbinit
Go to System Preferences
-> Users & Groups
-> Unlock it
-> Login Options
-> Network Account Server
-> Join
-> Unlock it
-> Edit
(menu) -> Enable Root User
sudo killall taskgated
codesign -fs gdb-cert "$(which gdb)"
PS. I end up using lldb
because it just works (tutorial)
I wonder if the global change in the highest voted answer here has some unintended consequences.
Rather than enabling the old Tiger convention, taskgated does allow signed code to run. So it might be better to just get a signed cert for gdb, similar to the answer here.
After this I was able to sudo
use gdb. If you need to use gdb w/o sudo then perhaps this link will help though, disclaimer, I haven't tried it yet because using sudo
is an ok solution for now`.