parrot_debugger

Langue: en

Autres versions - même langue

Version: 2010-09-21 (fedora - 01/12/10)

Section: 1 (Commandes utilisateur)

NAME

parrot_debugger - The Parrot Debugger

DESCRIPTION

The Parrot debugger

SYNOPSIS

     parrot_debugger programfile
     parrot_debugger --script scriptfile programfile
 
 

COMMANDS

disassemble
Disassemble the bytecode.

Use this if you have a PBC file but not the PASM.

load
Load a source code file.
list or l
List the source code file.
run or r
Run the program.
break or b
Add a breakpoint at the line number given or the current line if none is given.
     (pdb) b
     Breakpoint 1 at pos 0
 
     (pdb) b 10
     Breakpoint 1 at pos 10
 
 
watch or w
Add a watchpoint.
delete or d
Given a number n, deletes the n-th breakpoint. To delete the first breakpoint:
     (pdb) d 1
     Breakpoint 1 deleted
 
 
disable
Disable a breakpoint.
enable
Reenable a disabled breakpoint.
continue or c
Continue the program execution.
next or n
Run the next instruction
eval or e
Run an instruction.
trace or t
Trace the next instruction. This is equivalent to printing the source of the next instruction and then executing it.
print or p
Print an interpreter register. If a register I0 has been used, this would look like:
     (pdb) p I0
     2
 
 

If no register number is given then all registers of that type will be printed. If the two registers I0 and I1 have been used, then this would look like:

     (pdb) p I
     I0 = 2
     I1 = 5
 
 

It would be nice if ``p'' with no arguments printed all registers, but this is currently not the case.

stack or s
Examine the stack.
info
Print interpreter information relating to memory allocation and garbage collection.
gcdebug
Toggle garbage collection debugging mode. In gcdebug mode a garbage collection cycle is run before each opcode, which is the same as using the gcdebug core.
quit or q
Exit the debugger.
help or h
Print the help.

Debug Ops

You can also debug Parrot code by using the "debug_init", "debug_load" and "debug_break" ops in ops/debug.ops.
int main(int argc, const char *argv[])
Reads the PIR, PASM, or PBC file from argv[1], loads it, and then calls Parrot_debug().
static void PDB_run_code(PARROT_INTERP, int argc, const char *argv[])
Runs the code, catching exceptions if they are left unhandled.
static void PDB_printwelcome(void)
Prints out the welcome string.

SEE ALSO

src/debug.c, include/parrot/debug.h.

HISTORY

*
Initial version by Daniel Grunblatt on 2002.5.19.
*
Start of rewrite - leo 2005.02.16

The debugger now uses its own interpreter. User code is run in Interp* debugee. We have:

   debug_interp->pdb->debugee->debugger
     ^                            |
     |                            v
     +------------- := -----------+
 
 

Debug commands are mostly run inside the "debugger". User code runs of course in the "debugee".

TODO

*
Check the user input for bad commands, it's quite easy to make it bang now, try listing the source before loading or disassembling it.
*
Print the interpreter info.
*
Make the user interface better (add command history/completion).

HISTORY

Renamed from pdb.c on 2008.7.15