From 5c2fe285b6bb53acb3ef06fb8409dfba530cfe83 Mon Sep 17 00:00:00 2001 From: Zion Date: Wed, 13 Oct 2021 19:24:46 -0700 Subject: [PATCH] add thread symbol resolving like traces (#744) --- gef.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gef.py b/gef.py index a6f16613..a77ab224 100644 --- a/gef.py +++ b/gef.py @@ -8901,7 +8901,16 @@ class ContextCommand(GenericCommand): line += Color.colorify("stopped", "bold red") thread.switch() frame = gdb.selected_frame() - line += " {:s} in {:s} ()".format(Color.colorify("{:#x}".format(frame.pc()), "blue"), Color.colorify(frame.name() or "??", "bold yellow")) + frame_name = frame.name() + + # check if the gdb symbol table may know the address + if not frame_name: + sym_found = gdb_get_location_from_symbol(frame.pc()) + if sym_found: + sym_name, offset = sym_found + frame_name = "<{}+{:x}>".format(sym_name, offset) + + line += " {:s} in {:s} ()".format(Color.colorify("{:#x}".format(frame.pc()), "blue"), Color.colorify(frame_name or "??", "bold yellow")) line += ", reason: {}".format(Color.colorify(reason(), "bold pink")) elif thread.is_exited(): line += Color.colorify("exited", "bold yellow")