Search code examples
iosmacosdebugginglldb

How does the `-n` option to `image lookup` in LLDB operate compared to the `-s` option?


I know that the -s option searches the symbol table (image dump symtab) for symbols matching <symbol>.

However, I don't understand how the -n option operates. It returns different results from -s, and if it doesn't search the symbol table for functions/symbols, where does it look for <function-or-symbol>?

help image lookup:

-s <symbol> ( --symbol <symbol> )
            Lookup a symbol by name in the symbol tables in one or more target modules.

-n <function-or-symbol> ( --name <function-or-symbol> )
            Lookup a function or symbol by name in one or more target modules.

Solution

  • The official GDB to LLDB command map reference says that:

    This one finds debug symbols:
    (lldb) image lookup -r -n <FUNC_REGEX>
    
    This one finds non-debug symbols:
    (lldb) image lookup -r -s <FUNC_REGEX>
    
    Provide a list of binaries as arguments to limit the search. 
    

    So, image lookup -n only searches debug symbols, while image lookup -s searches non-debug symbols.