tools: Print useful error message from idf_monitor when toolchain isn't available
This commit is contained in:
parent
1e20664952
commit
b0a43f07d9
1 changed files with 16 additions and 11 deletions
|
@ -565,12 +565,14 @@ class Monitor(object):
|
||||||
self.output_enable(True)
|
self.output_enable(True)
|
||||||
|
|
||||||
def lookup_pc_address(self, pc_addr):
|
def lookup_pc_address(self, pc_addr):
|
||||||
translation = subprocess.check_output(
|
cmd = ["%saddr2line" % self.toolchain_prefix,
|
||||||
["%saddr2line" % self.toolchain_prefix,
|
"-pfiaC", "-e", self.elf_file, pc_addr]
|
||||||
"-pfiaC", "-e", self.elf_file, pc_addr],
|
try:
|
||||||
cwd=".")
|
translation = subprocess.check_output(cmd, cwd=".")
|
||||||
if b"?? ??:0" not in translation:
|
if b"?? ??:0" not in translation:
|
||||||
yellow_print(translation.decode())
|
yellow_print(translation.decode())
|
||||||
|
except OSError as e:
|
||||||
|
red_print("%s: %s" % (" ".join(cmd), e))
|
||||||
|
|
||||||
def check_gdbstub_trigger(self, line):
|
def check_gdbstub_trigger(self, line):
|
||||||
line = self._gdb_buffer + line
|
line = self._gdb_buffer + line
|
||||||
|
@ -591,12 +593,15 @@ class Monitor(object):
|
||||||
with self: # disable console control
|
with self: # disable console control
|
||||||
sys.stderr.write(ANSI_NORMAL)
|
sys.stderr.write(ANSI_NORMAL)
|
||||||
try:
|
try:
|
||||||
process = subprocess.Popen(["%sgdb" % self.toolchain_prefix,
|
cmd = ["%sgdb" % self.toolchain_prefix,
|
||||||
"-ex", "set serial baud %d" % self.serial.baudrate,
|
"-ex", "set serial baud %d" % self.serial.baudrate,
|
||||||
"-ex", "target remote %s" % self.serial.port,
|
"-ex", "target remote %s" % self.serial.port,
|
||||||
"-ex", "interrupt", # monitor has already parsed the first 'reason' command, need a second
|
"-ex", "interrupt", # monitor has already parsed the first 'reason' command, need a second
|
||||||
self.elf_file], cwd=".")
|
self.elf_file]
|
||||||
|
process = subprocess.Popen(cmd, cwd=".")
|
||||||
process.wait()
|
process.wait()
|
||||||
|
except OSError as e:
|
||||||
|
red_print("%s: %s" % (" ".join(cmd), e))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass # happens on Windows, maybe other OSes
|
pass # happens on Windows, maybe other OSes
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in a new issue