Unable to use gdb on Mavericks

I installed gdb via brew and also code-signed it. But even after doing that I am getting this error.

Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Unable to find Mach task port for process-id 14291: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))
Unable to find Mach task port for process-id 14291: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))

Any suggestions as what is going wrong and what I should do?


Solution 1:

Answering my own question. I had to follow the steps enlisted here to get past this error.

  1. Creating a Code-Sign System Certificate from Keychain Access.
  2. Marking that Certificate to Trust Always. This is important.
  3. Finally code signing the gdb executable codesign -s gdb-cert /path/to/gdb

With this, I was able to use gdb on mavericks.