set python3 as default python interpreter, fix whitespace and encoding issues
This commit is contained in:
parent
46499c0f26
commit
b65d64b905
1 changed files with 10 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# A thin Python wrapper around addr2line, can monitor esp-open-rtos
|
# A thin Python wrapper around addr2line, can monitor esp-open-rtos
|
||||||
# output and uses gdb to convert any suitable looking hex numbers
|
# output and uses gdb to convert any suitable looking hex numbers
|
||||||
|
@ -74,17 +74,17 @@ def main():
|
||||||
print("Reading from stdin...")
|
print("Reading from stdin...")
|
||||||
port = sys.stdin
|
port = sys.stdin
|
||||||
# disable echo
|
# disable echo
|
||||||
try:
|
try:
|
||||||
old_attr = termios.tcgetattr(sys.stdin.fileno())
|
old_attr = termios.tcgetattr(sys.stdin.fileno())
|
||||||
attr = termios.tcgetattr(sys.stdin.fileno())
|
attr = termios.tcgetattr(sys.stdin.fileno())
|
||||||
attr[3] = attr[3] & ~termios.ECHO
|
attr[3] = attr[3] & ~termios.ECHO
|
||||||
termios.tcsetattr(sys.stdin.fileno(), termios.TCSADRAIN, attr)
|
termios.tcsetattr(sys.stdin.fileno(), termios.TCSADRAIN, attr)
|
||||||
except termios.error:
|
except termios.error:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
line = port.readline()
|
line = port.readline().decode('ISO-8859-1')
|
||||||
if line == '':
|
if line == '':
|
||||||
break
|
break
|
||||||
print(line.strip())
|
print(line.strip())
|
||||||
|
@ -94,7 +94,8 @@ def main():
|
||||||
addr = "0x"+addr
|
addr = "0x"+addr
|
||||||
# keeping addr2line and feeding it addresses on stdin didn't seem to work smoothly
|
# keeping addr2line and feeding it addresses on stdin didn't seem to work smoothly
|
||||||
addr2line = subprocess.check_output(["xtensa-lx106-elf-addr2line","-pfia","-e","%s" % args.elf, addr], cwd=".").strip()
|
addr2line = subprocess.check_output(["xtensa-lx106-elf-addr2line","-pfia","-e","%s" % args.elf, addr], cwd=".").strip()
|
||||||
if not addr2line.endswith(": ?? ??:0"):
|
pattern = ": ?? ??:0"
|
||||||
|
if not addr2line.endswith(pattern.encode()):
|
||||||
print("\n%s\n" % addr2line.strip())
|
print("\n%s\n" % addr2line.strip())
|
||||||
finally:
|
finally:
|
||||||
if args.port is None:
|
if args.port is None:
|
||||||
|
|
Loading…
Reference in a new issue