Skip to content

Commit d573cfc

Browse files
style: Fix error handling and formatting in stack-loc-to-pc.py
Co-Authored-By: bsatrom@blues.com <bsatrom@blues.com>
1 parent 8d91b37 commit d573cfc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tools/stack-loc-to-pc.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Pipe in disassembly like so:
55
66
arm-none-eabi-objdump --disassemble=mp_execute_bytecode build-metro_m0_express/firmware.elf | python ../../tools/stack-loc-to-pc.py
7-
87
"""
98

109
import sys
@@ -16,11 +15,12 @@
1615
for line in sys.stdin:
1716
if "sp" in line:
1817
m = offset.search(line)
19-
o = int(m.groups()[0])
20-
pc = line.split(":")[0]
21-
if o not in offsets:
22-
offsets[o] = []
23-
offsets[o].append(pc.strip())
18+
if m:
19+
o = int(m.groups()[0])
20+
pc = line.split(":")[0].strip()
21+
if o not in offsets:
22+
offsets[o] = []
23+
offsets[o].append(pc)
2424

2525
print("Offset", "Size", "PCs", sep="\t")
2626
last_o = 0

0 commit comments

Comments
 (0)