Hi everyone, I need to debug an objective-c program. When setting a breakpoint on main() function , I've got:
Reading symbols from /usr/bin/pbcopy...done.
(gdb) break main
Function "main" not defined.
Invoking "start" from reply the same error. I suspect the way of doing things is different on max os x ?
What is the equivalent with objective c program?
BTW how to break on exit() function?
Edit: I try breaking on -[NSApplication run] as proposed by Lyndsey
(gdb) file pbcopy
Reading symbols for shared libraries ........ done
Reading symbols from /usr/bin/pbcopy...done.
(gdb) break -[NSApplication run]
Breakpoint 1 at 0x35a8356
(gdb) run
Starting program: /usr/bin/pbcopy
Reading symbols for shared libraries +++++++.................................................................... done
Breakpoint 1 at 0x95a97356
helo
^C
Program received signal SIGINT, Interrupt.
0x9574eeda in read$UNIX2003 ()
(gdb) bt
#0 0x9574eeda in read$UNIX2003 ()
#1 0x94d4e5b6 in _NSReadFromFileDescriptor ()
#2 0x94d4e4b6 in -[NSConcreteFileHandle readDataOfLength:] ()
#3 0x94d7f2fa in -[NSConcreteFileHandle readDataToEndOfFile] ()
#4 0x00002a11 in ?? ()
#5 0x00002736 in ?? ()
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x95a97356 <-[NSApplication run]+6>
(gdb)
That's quite weird , how does gdb find the address of the symbol but is not breaking at it... BTW it seems GDB change the address of breakpoint after loading the dynamic library. But it doesn't hurt me, as I suppose that ld needs to do relocating. Seeing the stacktrace, I see many ?? which let me suppose the usual way of triggering application is not use here (?? big supposition ...:/)