Don't barf on spaces in command line arguments. Check for ELF file before giving it to microchip's libraries.
def load(self, file):
# Load ELF file onto target
self.loader = self.assembly.getLookup().lookup(Loader)
- print "Loading ELF file..."
try:
self.loader.Load(file)
self.mdb.Program(Debugger.PROGRAM_OPERATION.AUTO_SELECT)
Usage: debug
'''
pdb.set_trace()
-
+
def cmdLoad(self, args):
'''
Load an ELF file onto target board.
Usage: load <file>
<file> can be a full absolute path, or relative to the working directory.
'''
- self.dbg.load(args)
+ fullpath = args
+ if fullpath[0] != '/':
+ cwd = os.getcwd()
+ path = args if args[0:2] != "./" else args[2:]
+ fullpath = cwd + "/" + path
+ self.log.info("Loading ELF: %s" % fullpath)
+ if not os.path.exists(fullpath):
+ self.log.error("File does not exist.")
+ return
+ self.dbg.load(fullpath)
self.log.info("Resetting target...")
self.dbg.reset()
pc = self.dbg.getPC()
help="Debug script to execute.")
(options, args) = parser.parse_args()
+
interp = CommandInterpreter()
if hasattr(options, "target"):
interp.executeCommand("connect %s" % options.target)
MPLAB_JAR_PATH=/Applications/microchip/mplabx/mplab_ipe.app/Contents/Resources/Java/lib
JAVAARGS=
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-CLASSPATH=$(echo "$MPLAB_JAR_PATH/"*.jar | tr ' ' ':') jython $JAVAARGS "$DIR"/picdb.py $@
+CLASSPATH=$(echo "$MPLAB_JAR_PATH/"*.jar | tr ' ' ':') jython $JAVAARGS "$DIR"/picdb.py "$@"