For instance, I know that 0x46767f0 belongs to an NSString*, is there any way I can find out what NSString it is to help me find some bugs I'm after?
Use info symbol gdb command. 16 Examining the Symbol Table. This is the opposite of the info address command. You can use it to find out the name of a variable or a function given its address.
The symbol table contains debugging information that tells a debugger what memory locations correspond to which symbols (like function names and variable names) in the original source code file. The symbol table is usually stored inside the executable, yes.
To add additional symbols you might use add-symbol-file . The add-symbol-file command reads additional symbol table information from the file filename. You would use this command when filename has been dynamically loaded (by some other means) into the program that is running.
concept: the stack pointer There's an x86 register called ESP called the “stack pointer”. Basically it's the address of the start of the stack for the current function. In gdb you can access it with $sp . When you call a new function or return from a function, the value of the stack pointer changes.
I believe you're looking for:
info symbol <addresss>
Print the name of a symbol which is stored at the address addr. If no symbol is stored exactly at addr, GDB prints the nearest symbol and an offset from it.
Example:
(gdb) info symbol 0x400225 _start + 5 in section .text of /tmp/a.out (gdb) info symbol 0x2aaaac2811cf __read_nocancel + 6 in section .text of /usr/lib64/libc.so.6
You can read more about it here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With