def invoke(self, args, from_tty): try: f = str(args).split(" ")[0] gdb.write("Loading SVD file {}...\n".format(f)) except: gdb.write("Please provide a filename (svd_load [filename])\n") return svd_file = SVDFile(f) SVD(svd_file) gdb.write("Done!\n")
def invoke(args, from_tty): args = gdb.string_to_argv(args) argc = len(args) if argc == 1: gdb.write("Loading SVD file {}...\n".format(args[0])) f = args[0] elif argc == 2: gdb.write("Loading SVD file {}/{}...\n".format(args[0], args[1])) f = pkg_resources.resource_filename("cmsis_svd", "data/{}/{}".format(args[0], args[1])) else: raise gdb.GdbError("Usage: svd_load <vendor> <device.svd> or svd_load <path/to/filename.svd>\n") try: SVD(SVDFile(f)) except Exception as e: raise gdb.GdbError("Could not load SVD file {} : {}...\n".format(f, e))