开发者

Break at program start on OS X?

How can I break at the very start of a program on OS X (10.6) without debug symbols?

I'm debugging an issue where my machine hangs and can't do certain things (at least anything involving networking). The programs I can use to try to identify the hang also hang on launch, so I'd like to start a program but not actually run it until the hang occurs, in the hopes that either the p开发者_运维知识库rogram runs or the place it hangs helps me to diagnose the issue.

I tried just setting breakpoints at the addresses that show up in the backtrace, but execution didn't stop.

Breakpoint 2, 0x000000010005cc78 in write$NOCANCEL ()
(gdb) bt
#0  0x000000010005cc78 in write$NOCANCEL ()
#1  0x000000010005cc74 in __swrite ()
#2  0x000000010005cbfd in _swrite ()
#3  0x000000010005cb42 in __sflush ()
#4  0x0000000100061361 in __swbuf ()
#5  0x0000000100093474 in putchar ()
#6  0x0000000100003ce7 in ?? ()
#7  0x000000010000090c in ?? ()
(gdb) b *0x000000010000090c
Breakpoint 3 at 0x10000090c
(gdb) b *0x0000000100003ce7
Breakpoint 4 at 0x100003ce7
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: [...]

Breakpoint 2, 0x000000010005cc78 in write$NOCANCEL ()
(gdb) bt
#0  0x000000010005cc78 in write$NOCANCEL ()
#1  0x000000010005cc74 in __swrite ()
#2  0x000000010005cbfd in _swrite ()
#3  0x000000010005cb42 in __sflush ()
#4  0x0000000100061361 in __swbuf ()
#5  0x0000000100093474 in putchar ()
#6  0x0000000100003ce7 in ?? ()
#7  0x000000010000090c in ?? ()


b __dyld__dyld_start works. (Thanks to @kongtomorrow.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜