Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some VFS helpers #90

Merged
merged 7 commits into from
Jun 28, 2024
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",):
brenns10 marked this conversation as resolved.
Show resolved Hide resolved
continue
except (IndexError, LookupError):
pass
bt(prog, cpu=cpu, **kwargs)
print()

Expand Down