Debugger

QuickStart

Pfp comes with a built-in debugger. You can drop into the interactive debugger by calling the Int3() function within a template.

All commands are documented below in the debug reference documentation. Command methods begin with do_.

Internals

While the pfp interpreter is handling AST nodes, it decides if a node can be “breaked” on using the _node_is_breakable method. If the interpreter is in a debug state, and the current node can be breaked on, the user will be dropped into the interactive debugger.

Debugger Reference Documentation

class pfp.dbg.PfpDbg(interp)[source]

The pfp debugger cmd.Cmd class

do_EOF(args)[source]

The eof command

do_continue(args)[source]

Continue the interpreter

do_eval(args)[source]

Eval the user-supplied statement. Note that you can do anything with this command that you can do in a template.

The resulting value of your statement will be displayed.

do_list(args)[source]

List the current location in the template

do_next(args)[source]

Step over the next statement

do_peek(args)[source]

Peek at the next 16 bytes in the stream:

Example:

The peek command will display the next 16 hex bytes in the input stream:

pfp> peek
89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 .PNG........IHDR
do_quit(args)[source]

The quit command

do_s(args)[source]

Step into the next statement

do_show(args)[source]

Show the current structure of __root (no args), or show the result of the expression (something that can be eval’d).

do_step(args)[source]

Step INTO the next statement

do_x(args)[source]

Show the current structure of __root (no args), or show the result of the expression (something that can be eval’d).

pfp.native.dbg.int3(*args, **kwargs)[source]

Define the Int3() function in the interpreter. Calling Int3() will drop the user into an interactive debugger.