tools/gdb: catch exception when there's no selected frame
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
This commit is contained in:
parent
bbf51ba071
commit
ad1be85be7
1 changed files with 6 additions and 3 deletions
|
|
@ -141,9 +141,12 @@ def get_symbol_value(name, locspec="nx_start", cacheable=True):
|
|||
# If there is a current stack frame, GDB uses the macros in scope at that frame’s source code line.
|
||||
# Otherwise, GDB uses the macros in scope at the current listing location.
|
||||
# Reference: https://sourceware.org/gdb/current/onlinedocs/gdb.html/Macros.html#Macros
|
||||
if not gdb.selected_frame():
|
||||
gdb.execute(f"list {locspec}", to_string=True)
|
||||
return gdb_eval_or_none(name)
|
||||
try:
|
||||
if not gdb.selected_frame():
|
||||
gdb.execute(f"list {locspec}", to_string=True)
|
||||
return gdb_eval_or_none(name)
|
||||
except gdb.error:
|
||||
pass
|
||||
|
||||
# Try current frame
|
||||
value = gdb_eval_or_none(name)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue