picdb.py
=
=
=
=
'''
Connects to a PIC target.
Usage: connect <PIC device>
ex: connect PIC32MX150F128B
'''
=
'''
Prints a variable or register.
Usage: print <variable or register>
Supported registers:
* $pc
'''
=
'''
Drops to a Python prompt for debug-level introspection.
Usage: debug
'''
'''
Load an ELF file onto target board.
Usage: load <file>
<file> can be a full absolute path, or relative to the working directory.
'''
=
=
=
= + +
return
=
'''Return address for instruction at given line of given file.'''
return
'''Return address of function fn (string)'''
return
'''Return address of instruction at given line in current file'''
=
=
return
'''Try to convert string to int, return None on failure'''
return
return None
'''
Set a breakpoint
Usage:
break *<address>
break <file>:<line>
break <line>
break <function name>
<address> is a memory address specified in decimal, or hexadecimal with an '0x'
prefix.
'''
=
# *<address>
=
>= 2:
=
=
=
=
=
=
'''
List all set breakpoints. Outputs a numbered list of breakpoints, their memory
address, their source file and line, and an asterisk if they are enabled.
Usage: breakpoints
'''
=
'''
Continue running target from current PC.
Usage: continue
'''
# block
# It doesn't know where it is immediately after stopping.
# But it also LIES.
# Ask, wait, ask again. It'll figure it out.
# Hopefully.
=
=
=
=
=
, =
=
'''
Step target over one line of source. Descends into functions.
Usage: step
'''
'''
Step target over one single instruction.
Usage: stepi
'''
'''
Step target over one line of source. If line is a function call, does not
descend into it.
Usage: step
'''
'''
Quit debugger.
Usage: quit
'''
'''
Request list of commands, or help on a specific command.
Usage: help [command]
'''
=
+=
=
= False
=
'''Set main loop to stop running.'''
= False
'''Disconnect from debugger and quit.'''
# this will interrupt raw_input()
'''Quit cleanly on ^C.'''
'''Display the debugger prompt.'''
'''Wait for (and return) input from user. EOF terminates.'''
=
return
return
'''Determine if string from user starts with a known command.'''
= False
=
=
= True
return
'''Main loop listening for commands from user.'''
=
continue
print
'''Run debugger.'''
= True
# Wrap the whole main loop in an outer loop here so we can catch
# exceptions from the pdb debugger.
pass # pdb quit, but we're still runnin'
=
=
=
=
=
print