1.3.4 Inheritance from class Cmd

Because Pdb inherts from Cmd, the following conventions are used.

All of the debugger commands listed in are methods of a Pdb object. The method names are the command name prefixed by do_. For example the method handling the "step" command is do_step, and the command handling the "frame" command is do_frame.

If you have a Pdb object, it is possible to call any of the commands listed in 1.2 directly. Parameters needed by the methods (for example breakpoint numbers for the enable command), are passed as a single string argument. The string contains the values of the parameters and multiple parameters are separated by spaces. Each method parses out parameters and performs needed conversions. For example, a Pdb object, p, can enable breakpoint numbers 3, 5, and 10 like this: p.do_enable("3 5 10"), and this has the same effect as if "enable 3 5 10" were issued as a debugger command. String parameters should not have additional quotes in the string. For example to set the filename where history commands are to be saved (1.2.1), the method call would be p.do_set("history filename /tmp/myhistfile") without any quotes around /tmp/myhistfile.

Also inherited Cmd, is the help mechanism, although some customization has been made to allow for subcommand help. See the Python cmd module for more information.

If readline support is available on your OS, Cmd will use that and both command history and command completion will be available. In addition, the debugger complete command is defined (see 1.2.10). The complete command for example is used internally by GNU Emacs debugger gud.

See About this document... for information on suggesting changes.