I recently installed gdb 9.1 on my mac version 10.0.1. and followed the darwin page to get the keyring set up. Every once in a while I'm able to run gdb executable but a majority of the time it hangs right after the r command.
I'm able to run the code fine, but when I run it in gdb it prints
[New Thread 0x2603 of process 48685]
sometimes it will make two or three new threads but it then hangs. I've tried compiling with both -g and -ggdb as well as setting breakpoints at the start of the code and it freezes regardless.
Its frustrating because I can't kill it with control c, control z, or kill -9 so I usually end up restarting the terminal. I'm not quite sure how to debug this, any help is appreciated
To stop your program while it is running, type "(ctrl) + c" (hold down the ctrl key and press c). gdb will stop your program at whatever line it has just executed. From here you can examine variables and move through your program. To specify other places where gdb should stop, see the section on breakpoints below.
Yes. There are several aspects which slow down when a debugger is attached.
Breakpoints are set with the break command (abbreviated b ). The debugger convenience variable `$bpnum' records the number of the breakpoint you've set most recently; see section Convenience variables, for a discussion of what you can do with convenience variables.
Every time running gdb, start with sudo:
sudo gdb ./main.out
After looking through all the solution, this works for me :)
from this page https://timnash.co.uk/getting-gdb-to-semi-reliably-work-on-mojave-macos/
sudo DevToolsSecurity -disable
works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With