Przeglądaj źródła

Merge branch 'bugfix/xtensa_extra_info_register_values' into 'master'

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

See merge request espressif/esp-idf!14448
Shubham Patil 4 lat temu
rodzic
commit
3e84e5e668

+ 23 - 26
components/espcoredump/corefile/xtensa.py

@@ -89,19 +89,19 @@ class ExceptionRegisters(object):
     # extra regs IDs used in EXTRA_INFO note
     # extra regs IDs used in EXTRA_INFO note
     EXCCAUSE_IDX = 0
     EXCCAUSE_IDX = 0
     EXCVADDR_IDX = 1
     EXCVADDR_IDX = 1
-    EPS2_IDX = 2
-    EPS3_IDX = 3
-    EPS4_IDX = 4
-    EPS5_IDX = 5
-    EPS6_IDX = 6
-    EPS7_IDX = 7
-    EPC1_IDX = 8
-    EPC2_IDX = 9
-    EPC3_IDX = 10
-    EPC4_IDX = 11
-    EPC5_IDX = 12
-    EPC6_IDX = 13
-    EPC7_IDX = 14
+    EPC1_IDX = 177
+    EPC2_IDX = 178
+    EPC3_IDX = 179
+    EPC4_IDX = 180
+    EPC5_IDX = 181
+    EPC6_IDX = 182
+    EPC7_IDX = 183
+    EPS2_IDX = 194
+    EPS3_IDX = 195
+    EPS4_IDX = 196
+    EPS5_IDX = 197
+    EPS6_IDX = 198
+    EPS7_IDX = 199
 
 
     @property
     @property
     def registers(self):  # type: () -> dict[str, int]
     def registers(self):  # type: () -> dict[str, int]
@@ -142,19 +142,16 @@ def print_exc_regs_info(extra_info):  # type: (list[int]) -> None
         exccause_str = ('Invalid EXCCAUSE code', 'Invalid EXCAUSE description or not found.')
         exccause_str = ('Invalid EXCCAUSE code', 'Invalid EXCAUSE description or not found.')
     print('exccause       0x%x (%s)' % (exccause, exccause_str[0]))
     print('exccause       0x%x (%s)' % (exccause, exccause_str[0]))
     print('excvaddr       0x%x' % extra_info[1 + 2 * ExceptionRegisters.EXCVADDR_IDX + 1])
     print('excvaddr       0x%x' % extra_info[1 + 2 * ExceptionRegisters.EXCVADDR_IDX + 1])
-    print('epc1           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPC1_IDX + 1])
-    print('epc2           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPC2_IDX + 1])
-    print('epc3           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPC3_IDX + 1])
-    print('epc4           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPC4_IDX + 1])
-    print('epc5           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPC5_IDX + 1])
-    print('epc6           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPC6_IDX + 1])
-    print('epc7           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPC7_IDX + 1])
-    print('eps2           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPS2_IDX + 1])
-    print('eps3           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPS3_IDX + 1])
-    print('eps4           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPS4_IDX + 1])
-    print('eps5           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPS5_IDX + 1])
-    print('eps6           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPS6_IDX + 1])
-    print('eps7           0x%x' % extra_info[1 + 2 * ExceptionRegisters.EPS7_IDX + 1])
+
+    # skip crashed_task_tcb, exccause, and excvaddr
+    for i in range(5, len(extra_info), 2):
+        if (extra_info[i] >= ExceptionRegisters.EPC1_IDX and extra_info[i] <= ExceptionRegisters.EPC7_IDX):
+            print('epc%d           0x%x' % ((extra_info[i] - ExceptionRegisters.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] >= ExceptionRegisters.EPS2_IDX and extra_info[i] <= ExceptionRegisters.EPS7_IDX):
+            print('eps%d           0x%x' % ((extra_info[i] - ExceptionRegisters.EPS2_IDX + 2), extra_info[i + 1]))
 
 
 
 
 # from "gdb/xtensa-tdep.h"
 # from "gdb/xtensa-tdep.h"

+ 1 - 3
tools/test_idf_monitor/tests/core1_out.txt

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