From 9478f5b6d405403fe91989340e1d2a28bdb58ed0 Mon Sep 17 00:00:00 2001 From: anjiahao Date: Thu, 27 Jun 2024 14:14:36 +0800 Subject: [PATCH] tools/gdb:add get_symbol_value api Signed-off-by: anjiahao --- tools/gdb/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/gdb/utils.py b/tools/gdb/utils.py index 2381e0916e..2e49b2cf6c 100644 --- a/tools/gdb/utils.py +++ b/tools/gdb/utils.py @@ -179,3 +179,10 @@ def is_target_smp(): return True else: return False + + +def get_symbol_value(name): + """Return the value of a symbol value etc: Variable, Marco""" + + gdb.execute("set $_%s = %s" % (name, name)) + return gdb.parse_and_eval("$_%s" % name)