fix parseQEMUtoGDB.py to pass on interrupt messages correctly

This commit is contained in:
bbracker 2022-04-07 04:47:15 -07:00
parent 241ec053e8
commit 95438fca0d

View File

@ -29,10 +29,14 @@ def printPC(l):
def printCSRs(): def printCSRs():
global parseState, inPageFault, CSRs, pageFaultCSRs, regs, pageFaultCSRs, instrs global parseState, inPageFault, CSRs, pageFaultCSRs, regs, pageFaultCSRs, instrs
global interrupt_line
if not inPageFault: if not inPageFault:
for (csr,val) in CSRs.items(): for (csr,val) in CSRs.items():
print('{}{}{:#x} {}'.format(csr, ' '*(15-len(csr)), val, val)) print('{}{}{:#x} {}'.format(csr, ' '*(15-len(csr)), val, val))
print('-----') print('-----') # end of current instruction
if len(interrupt_line)>0: # squish interrupts in between instructions
print(interrupt_line)
interrupt_line=""
def parseCSRs(l): def parseCSRs(l):
global parseState, inPageFault, CSRs, pageFaultCSRs, regs, pageFaultCSRs, instrs global parseState, inPageFault, CSRs, pageFaultCSRs, regs, pageFaultCSRs, instrs
@ -119,15 +123,9 @@ for l in fileinput.input():
break break
elif l.startswith('IN:'): elif l.startswith('IN:'):
# New disassembled instr # New disassembled instr
if len(interrupt_line)>0:
print(interrupt_line)
interrupt_line=""
parseState = "instr" parseState = "instr"
elif (parseState == "instr") and l.startswith('0x'): elif (parseState == "instr") and l.startswith('0x'):
# New instruction # New instruction
if len(interrupt_line)>0:
print(interrupt_line)
interrupt_line=""
if "out of bounds" in l: if "out of bounds" in l:
sys.stderr.write("Detected QEMU page fault error\n") sys.stderr.write("Detected QEMU page fault error\n")
beginPageFault = not inPageFault beginPageFault = not inPageFault