Debugging GDB Objective-c (no character table)

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

I want to set a breakpoint on a function, and I know the name of the function using the class dump. Now it will not allow me to add a breakpoint to this function, because it says that there is no symbol table. I tried to add a character table, but it still complains that the character table is not loaded.

So, is there a way to set a breakpoint with this method? This is an objective method of c, not c (if that matters). All I have to do is check the argument of this method.

+4
source share
1 answer

In the dump class, there is the -A option, which can print the address of a function, for example.

@interface FooObject : NSObject { } - (void)y; // IMP=0x100000d54 @end 

With this, you can set a breakpoint using the address:

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

Please note that if you did not split the executable, you can always set a breakpoint using the method name

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

(The address does not match the address that skips some frame setting code.)

+8
source

Source: https://habr.com/ru/post/1345314/


All Articles