espcoredump.py: Parse EPS and EPC register values using register index

pull/7949/head
Shubham Patil 2021-07-20 17:33:18 +05:30
rodzic 764f0db002
commit c06d8f8521
2 zmienionych plików z 24 dodań i 29 usunięć

Wyświetl plik

@ -328,19 +328,19 @@ class ESPCoreDumpElfFile(esptool.ELFFile):
# extra regs IDs used in EXTRA_INFO note
REG_EXCCAUSE_IDX = 0
REG_EXCVADDR_IDX = 1
REG_EPS2_IDX = 2
REG_EPS3_IDX = 3
REG_EPS4_IDX = 4
REG_EPS5_IDX = 5
REG_EPS6_IDX = 6
REG_EPS7_IDX = 7
REG_EPC1_IDX = 8
REG_EPC2_IDX = 9
REG_EPC3_IDX = 10
REG_EPC4_IDX = 11
REG_EPC5_IDX = 12
REG_EPC6_IDX = 13
REG_EPC7_IDX = 14
REG_EPC1_IDX = 177
REG_EPC2_IDX = 178
REG_EPC3_IDX = 179
REG_EPC4_IDX = 180
REG_EPC5_IDX = 181
REG_EPC6_IDX = 182
REG_EPC7_IDX = 183
REG_EPS2_IDX = 194
REG_EPS3_IDX = 195
REG_EPS4_IDX = 196
REG_EPS5_IDX = 197
REG_EPS6_IDX = 198
REG_EPS7_IDX = 199
# ELF file type
ET_NONE = 0x0 # No file type
ET_REL = 0x1 # Relocatable file
@ -1640,19 +1640,16 @@ def info_corefile(args):
exccause_str = ("Invalid EXCCAUSE code", "Invalid EXCAUSE description or not found.")
print("exccause 0x%x (%s)" % (exccause, exccause_str[0]))
print("excvaddr 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EXCVADDR_IDX + 1])
print("epc1 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPC1_IDX + 1])
print("epc2 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPC2_IDX + 1])
print("epc3 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPC3_IDX + 1])
print("epc4 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPC4_IDX + 1])
print("epc5 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPC5_IDX + 1])
print("epc6 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPC6_IDX + 1])
print("epc7 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPC7_IDX + 1])
print("eps2 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPS2_IDX + 1])
print("eps3 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPS3_IDX + 1])
print("eps4 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPS4_IDX + 1])
print("eps5 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPS5_IDX + 1])
print("eps6 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPS6_IDX + 1])
print("eps7 0x%x" % extra_info[1 + 2 * ESPCoreDumpElfFile.REG_EPS7_IDX + 1])
# skip crashed_task_tcb, exccause, and excvaddr
for i in range(5, len(extra_info), 2):
if (extra_info[i] >= ESPCoreDumpElfFile.REG_EPC1_IDX and extra_info[i] <= ESPCoreDumpElfFile.REG_EPC7_IDX):
print('epc%d 0x%x' % ((extra_info[i] - ESPCoreDumpElfFile.REG_EPC1_IDX + 1), extra_info[i + 1]))
# skip crashed_task_tcb, exccause, and excvaddr
for i in range(5, len(extra_info), 2):
if (extra_info[i] >= ESPCoreDumpElfFile.REG_EPS2_IDX and extra_info[i] <= ESPCoreDumpElfFile.REG_EPS7_IDX):
print('eps%d 0x%x' % ((extra_info[i] - ESPCoreDumpElfFile.REG_EPS2_IDX + 2), extra_info[i + 1]))
else:
print("Exception registers have not been found!")
p = gdbmi_getinfo(p, handlers, "info registers")

Wyświetl plik

@ -46,19 +46,17 @@ Crashed task handle: 0x3ffb5e80, name: '', GDB name: 'process 1073438336'
================== CURRENT THREAD REGISTERS ===================
exccause 0x1d (StoreProhibitedCause)
excvaddr 0x1
epc1 0x0
epc1 0x400e38bf
epc2 0x0
epc3 0x0
epc4 0x0
epc5 0x0
epc6 0x0
epc7 0x0
eps2 0x0
eps3 0x0
eps4 0x0
eps5 0x0
eps6 0x0
eps7 0x400e38bf
pc 0x400e37f7 0x400e37f7
lbeg 0x0 0
lend 0x0 0