Skip to content

Commit 48ed480

Browse files
authored
Resolve Context Trace Symbols (#743)
* add symbol resolving for traces
1 parent 8719457 commit 48ed480

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

gef.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8832,7 +8832,15 @@ def context_trace(self):
88328832
insn = next(gef_disassemble(pc, 1))
88338833
except gdb.MemoryError:
88348834
break
8835-
items.append(Color.redify("{} {}".format(insn.mnemonic, ", ".join(insn.operands))))
8835+
8836+
# check if the gdb symbol table may know the address
8837+
sym_found = gdb_get_location_from_symbol(pc)
8838+
symbol = ""
8839+
if sym_found:
8840+
sym_name, offset = sym_found
8841+
symbol = " <{}+{:x}> ".format(sym_name, offset)
8842+
8843+
items.append(Color.redify("{}{} {}".format(symbol, insn.mnemonic, ", ".join(insn.operands))))
88368844

88378845
gef_print("[{}] {}".format(Color.colorify("#{}".format(level), "bold green" if current_frame == orig_frame else "bold pink"),
88388846
RIGHT_ARROW.join(items)))

0 commit comments

Comments
 (0)