Fix stack trace decode for latest platformio (#830)

This commit is contained in:
Otto Winter 2019-11-02 21:19:15 +01:00 committed by GitHub
parent dc2279b74f
commit 16c2dc2aaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -101,12 +101,14 @@ def run_idedata(config):
args = ['-t', 'idedata']
stdout = run_platformio_cli_run(config, False, *args, capture_stdout=True)
stdout = decode_text(stdout)
match = re.search(r'{.*}', stdout)
match = re.search(r'{\s*".*}', stdout)
if match is None:
_LOGGER.debug("Could not match IDEData for %s", stdout)
return IDEData(None)
try:
return IDEData(json.loads(match.group()))
except ValueError:
_LOGGER.debug("Could not load IDEData for %s", stdout, exc_info=1)
return IDEData(None)
@ -165,11 +167,13 @@ ESP8266_EXCEPTION_CODES = {
def _decode_pc(config, addr):
idedata = get_idedata(config)
if not idedata.addr2line_path or not idedata.firmware_elf_path:
_LOGGER.debug("decode_pc no addr2line")
return
command = [idedata.addr2line_path, '-pfiaC', '-e', idedata.firmware_elf_path, addr]
try:
translation = subprocess.check_output(command).strip()
translation = decode_text(subprocess.check_output(command)).strip()
except Exception: # pylint: disable=broad-except
_LOGGER.debug("Caught exception for command %s", command, exc_info=1)
return
if "?? ??:0" in translation: