Skip to content
Merged
Changes from 1 commit
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
16 changes: 15 additions & 1 deletion drgn_tools/bt.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,27 @@ def bt_has(
return bt_has_any(prog, [funcname], task)


def print_online_bt(prog: Program, **kwargs: t.Any) -> None:
def print_online_bt(
prog: Program, skip_idle: bool = True, **kwargs: t.Any
) -> None:
"""
Prints the stack trace of all on-CPU tasks

:kwargs: passed to bt() to control backtrace format
"""
for cpu in for_each_online_cpu(prog):
task = cpu_curr(prog, cpu)
if skip_idle and task.comm.string_().decode() == f"swapper/{cpu}":
# Just because it's the swapper task, does not mean it is idling.
# Check the symbol at the top of the stack to ensure it's the
# architecture idle function.
trace = prog.stack_trace(task)
try:
sym = trace[0].symbol().name
if sym in ("intel_idle",):
continue
except (IndexError, LookupError):
pass
bt(prog, cpu=cpu, **kwargs)
print()

Expand Down