Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GDB Objective-c debugging (no symbol table)

I have an executable and I am debugging it using gdb. This is my first time using gdb so bear with me please.

I want to set a breakpoint at a function and I know the name of the function using class dump. Now it won't let me add breakpoint to that function because it say's that there's no symbol table. I tried adding the symbol table but it still complains that no symbol table loaded.

So, is there's anyway I can set a breakpoint at this method? It's an objective c method, not c (If that makes a difference). All I need to do is examine the argument of this method.

like image 261
user635064 Avatar asked Feb 24 '23 17:02

user635064


1 Answers

In class-dump there is an -A option will can print the function's address, e.g.

@interface FooObject : NSObject
{
}

- (void)y;  // IMP=0x100000d54

@end

With this you can set a break point using the address:

(gdb) b *0x100000d54
Breakpoint 1 at 0x100000d54

Note that, unless you have stripped the executable, you should always be possible to set a break point using the method's name

(gdb) b -[FooObject y]
Breakpoint 2 at 0x100000d60

(The address isn't the same as the latter skips some frame set-up code.)

like image 164
kennytm Avatar answered Mar 11 '23 11:03

kennytm