首页 > 解决方案 > 与 `-s` 选项相比,LLDB 中`image lookup` 的`-n` 选项如何操作?

问题描述

我知道该-s选项在符号表 ( image dump symtab) 中搜索符号匹配<symbol>

但是,我不明白该-n选项是如何运作的。它从 中返回不同的结果-s,如果它没有在符号表中搜索函数/符号,它在哪里寻找<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.

标签: iosmacosdebugginglldb

解决方案


官方GDB 到 LLDB 命令映射参考说:

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. 

因此,image lookup -n只搜索调试符号,而image lookup -s搜索非调试符号。


推荐阅读