Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The pymontrace Command

Name

pymontrace - A production oriented Python debugger.

Synopsis

pymontrace [-h] (-c pyprog | -p pid) (-e prog_text | -l probe_filter)

Description

The pymontrace utility attaches to a running python program or starts ones and injects debugging statements into selected probe sites.

Options

-c pyprog

Runs a Python program with the the specificed tracing enabled. pyprog is Python script file and any command arguments to be provided to it.

-e prog_text

Install the probes specified by the given pymontrace program into the target. prog_text must be quoted to prevent interpretation by the shell. See pymontrace programs for a reference on how to write pymontrace programs.

-h

Print a short help message.

-l probe_filter

Prints a list of detectable probe sites and then exits. probe_filter is of the form

probe [ ':' glob pattern [ ':' glob pattern ] ]

The func probe and line probes are listed based on modules that have been imported thus far in the target.

Note: The -l isn't very effective with the -c option as the listing happens before the target program has had a chance to import modules.

Bugs

The -l option is unable to find nested functions nor functions in modules that have not yet been imported by the target program.