Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access static Method in GDB

I recently discovered the GDB in Xcode which makes up for some functionality which IMHO seems to be lacking in Xcode.

So I can do the following in GDB:

(gdb) po [LoginManager sharedSession].loginToken
20D52FE9-3573-437E-9A65-846572B63726

However, I have another Service class, which is currently not loaded so I get the following error:

(gdb) po [SessionService displaySessionInfoForToken:@"XXX"]
No symbol "SessionService" in current context.

I don't understand why the LoginManager can be loaded but not the SessionService.

like image 511
Besi Avatar asked Apr 28 '26 00:04

Besi


1 Answers

Try using NSClassFromString, like this:

(gdb) po [NSClassFromString(@"SessionService") displaySessionInfoForToken:@"XXX"]

It's hard to say exactly what's going on, but using NSClassFromString may tickle the right thing in the runtime to do what you want.

like image 97
ipmcc Avatar answered Apr 29 '26 14:04

ipmcc