Search code examples
lldb

Use lldb to find a non-external symbol named like '_OBJC_IVAR_$_DIRect._width' in main binary?


I know how to use image lookup -n with a symbol name. But seems '_OBJC_IVAR_$_DIRect._width' contain a . in its name, lldb can't handle this as a normal case.

_OBJC_IVAR_$_DIRect._width is a symbol generated by compiler.

(__DATA,__objc_ivar) non-external (was a private external) _OBJC_IVAR_$_DIRect._width


Solution

  • -n is supposed to look for "function-or-symbol" - i.e. things that have debug information as well as symbols that come from the symbol table. It is supposed to be equivalent to supplying -F and -s with the same argument. But it actually only looks for functions and CODE symbols - it doesn't look for data symbols. Not sure whether that's by design and the help string is just wrong or it's a bug.

    Fortunately, the straight symbol lookup (using the -s option instead of -n) does search all symbols, including data symbols. Try using the -s option.