“please check gdb is codesigned – see taskgated(8)” – How to get gdb installed with homebrew code signed?

This error occurs because OSX implements a pid access policy which requires a digital signature for binaries to access other processes pids. To enable gdb access to other processes, we must first code sign the binary. This signature depends on a particular certificate, which the user must create and register with the system. To create … Read more

How can I make gdb save the command history?

Short answer: mkdir -p ~/.config/gdb echo ‘set history save on’ >> ~/.config/gdb/gdbinit Long answer: Command history is covered in the GDB manual, 22.3 Command History. Create a file $HOME/.config/gdb/gdbinit, and add the following line: set history save on You can set the number of past commands saved with the following. The command is described as … Read more

Use gdb to Modify Binary

but the corresponding file is not changed. It’s hard to say what address you are actually modifying, and so whether your change should actually modify the binary or not. In the past, I’ve found that after modifying the binary, I need to immediately quit. If I do anything other than quit (e.g. run), then GDB … Read more

gdb gives strange output when using math.h functions [duplicate]

(Ref: http://lists.gnu.org/archive/html/gdb/2009-12/msg00004.html) gdb is missing the debug information of the cos function, and therefore assume it is an int cos(…) function, so the values are not returned correctly (esp. on x86 as the registers to store floating point return and integer return are different). This could be worked around by specifying the type: (gdb) p … Read more