Search code examples
iphoneiosgdbjailbreak

iPhone GDB Segmentation fault when attaching to running process


I have a jailbroken iPhone 5 running iOS 6.0.1. I installed gdb using pod2g's tutorial here: www.pod2g.org/2012/02/working-gnu-debugger-on-ios-43.html

All of the steps worked, and I copied gdb over to my jailbroken iPhone so I could use it there. gdb starts just fine, but when i try to attach to SpringBoard (or any other running process like Twitter) using

(gdb) attach SpringBoard

this happens:

Attaching to process 7366.
Segmentation fault:11

and I'm returned to the MobileTerminal or ssh prompt (not the gdb prompt). It looks like gdb has crashed, not SpringBoard, because my iPhone does not respring (as it normally does when SpringBoard crashes or is killed). I have tried attaching to SpringBoard using the gdb from the cydia.radare.org source as well, and the exact same thing happens each time. About a week ago, the gdb from the cydia.radare.org source worked just fine, but now both the gdb from pod2g's tutorial and the one from the Cydia source produce the above output. I've tried running gdb as root and the same thing happens. I've googled, and I can't seem to find anything like this. What's wrong and how do I fix it?


Solution

  • Apple has added a PTrace option to prevent debuggers (like GDB) from attaching to processes. Fortunately, you can use GDB to circumvent this as well. Here is an excellent description: http://iphonedevwiki.net/index.php/Crack_prevention#PT_DENY_ATTACH