尝试使用 gdb.lookup_symbol('*&foo') 不起作用。
那是因为*&foo
二进制文件中没有命名符号。
是否可以使用gdb的命令行从python解引用解析器,然后得到一个gdb.Value作为回报?
你的问题不是很清楚,但我认为你要求parse_and_eval:
Function: gdb.parse_and_eval (expression)
Parse expression, which must be a string, as an expression in the current language,
evaluate it, and return the result as a gdb.Value.
This function can be useful when implementing a new command (see Commands In Python),
as it provides a way to parse the command’s argument as an expression.
It is also useful simply to compute values, for example, it is the only way to get
the value of a convenience variable (see Convenience Vars) as a gdb.Value.