Skip to content

Add dump subcommand to python -m profiling.sampling for one-shot stack snapshots #149296

@pablogsal

Description

@pablogsal

Add a dump subcommand to the sampling profiler that prints a single, immediate snapshot of a running Python process's stack similar to gdb's py-bt, but built on the existing _remote_debugging unwinder.

The output should be formatted like a traceback (most recent call last), with file paths, line numbers, source lines with caret-style highlights, optional bytecode opcode names, and per-thread status (main thread / has GIL / on CPU / waiting for GIL / has exception / idle).

It should support the same flags as run (as many as possible)

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-profilingtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions