Merge branch 'feature/espcoredump_resilient_stack_decoding' into 'master'

espcoredump: fix espcoredump to make it more resilient when decoding erroneous thread stack

Closes IDFGH-2802

See merge request espressif/esp-idf!7892
This commit is contained in:
Ivan Grokhotkov 2020-03-24 21:08:57 +08:00
commit 349dc125e8
3 changed files with 21 additions and 3 deletions

View file

@ -1668,15 +1668,17 @@ def info_corefile(args):
p = gdbmi_getinfo(p, handlers, "info threads")
# THREADS STACKS
p,threads,cur_thread = gdbmi_get_thread_ids(p)
print()
for thr_id in threads:
task_index = int(thr_id) - 1
if thr_id == cur_thread:
continue
p = gdbmi_switch_thread(p, thr_id)
p,thr_info_res = gdbmi_get_thread_info(p, thr_id)
if not thr_info_res.target_id:
print("WARNING: Unable to switch to thread %s\n" % thr_id)
continue
tcb_addr = gdb2freertos_thread_id(thr_info_res.target_id)
p,task_name = gdbmi_freertos_get_task_name(p, tcb_addr)
print("\n==================== THREAD %s (TCB: 0x%x, name: '%s') =====================" % (thr_id, tcb_addr, task_name))
print("==================== THREAD %s (TCB: 0x%x, name: '%s') =====================" % (thr_id, tcb_addr, task_name))
p = gdbmi_getinfo(p, handlers, "bt")
if task_info and task_info[task_index].task_flags != EspCoreDumpTaskStatus.TASK_STATUS_CORRECT:
print("The task '%s' is corrupted." % thr_id)
@ -1684,6 +1686,7 @@ def info_corefile(args):
task_info[task_index].task_flags,
task_info[task_index].task_tcb_addr,
task_info[task_index].task_stack_start))
print()
print("\n======================= ALL MEMORY REGIONS ========================")
print("Name Address Size Attrs")
for ms in merged_segs:

View file

@ -78,6 +78,13 @@ a15 0x0 0
9 process 1073434712 xQueueGenericReceive (xQueue=0x3ffb4bdc <tasks+576>, pvBuffer=0x0, xTicksToWait=<optimized out>, xJustPeeking=0) at /home/alexey/projects/esp/esp-idf/components/freertos/queue.c:1546
10 process 1073432952 0x40081414 in esp_crosscore_isr (arg=0x0) at /home/alexey/projects/esp/esp-idf/components/esp32/crosscore_int.c:60
==================== THREAD 1 (TCB: 0x3ffb6260, name: 'unaligned_ptr_t') =====================
#0 0x400d0e45 in recur_func () at /home/alexey/projects/esp/esp-idf/components/espcoredump/test/test_core_dump.c:61
#1 0x400d0e20 in bad_ptr_task (pvParameter=0x1) at /home/alexey/projects/esp/esp-idf/components/espcoredump/test/test_core_dump.c:44
#2 0x400d0e20 in bad_ptr_task (pvParameter=0xa) at /home/alexey/projects/esp/esp-idf/components/espcoredump/test/test_core_dump.c:44
#3 0x400d0e68 in recur_func () at /home/alexey/projects/esp/esp-idf/components/espcoredump/test/test_core_dump.c:68
#4 0x40088160 in xthal_restore_extra_nw () at /Users/igrokhotkov/e/esp32/hal/hal/state_asm.S:97
==================== THREAD 2 (TCB: 0x3ffba278, name: 'unityTask') =====================
#0 0x400092dc in ?? ()
#1 0x4000930f in ?? ()
@ -136,6 +143,7 @@ a15 0x0 0
#2 0x40081d0f in esp_vApplicationTickHook () at /home/alexey/projects/esp/esp-idf/components/esp_common/src/freertos_hooks.c:41
#3 0x40088160 in xthal_restore_extra_nw () at /Users/igrokhotkov/e/esp32/hal/hal/state_asm.S:97
======================= ALL MEMORY REGIONS ========================
Name Address Size Attrs
.rtc.text 0x400c0000 0x0 RW

View file

@ -114,6 +114,12 @@ a15 0x0 0
8 process 1073413520 0x400812c4 in ?? ()
ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \"file\" command.")!
==================== THREAD 1 (TCB: 0x3ffb5e80, name: '') =====================
#0 0x400e37f7 in ?? ()
#1 0x400d0c31 in ?? ()
#2 0x40087018 in ?? ()
ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \"file\" command.")!
==================== THREAD 2 (TCB: 0x3ffb6d48, name: '') =====================
#0 0x40087010 in ?? ()
ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \"file\" command.")!
@ -155,6 +161,7 @@ ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \
#2 0x40081a2b in ?? ()
#3 0x40087018 in ?? ()
======================= ALL MEMORY REGIONS ========================
Name Address Size Attrs
.data 0x400054 0x4 RW A