Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions backtrace_with_time/backtrace_with_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@ def invoke(arg, from_tty):
# hitting anything we shouldn't.
with udb.time.auto_reverting(), debugger_utils.breakpoints_suspended():
# Get the whole backtrace.
backtrace = debugger_utils.execute_to_string("where")
backtrace = debugger_utils.execute_to_string("where", styled=True)
backtrace = backtrace.splitlines()

# The bbcount now is the largest that will be printed, so
# it can define the width of the column
bbcount_width = len(str(udb.time.get().bbcount))

exception_hit = False
for line in backtrace:
if not exception_hit:
# Print time at start of each backtrace line.
time = udb.time.get()
print("[{}]\t{}".format(str(time.bbcount), line))
print(f"[{time.bbcount:{bbcount_width}}] {line}")
try:
# Go back to previous frame
debugger_utils.execute_to_string("rf")
Expand Down