From dde4d2e9ebfad3e88fc80e5179b816dab16351c2 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 1 Mar 2020 04:01:22 +0100 Subject: [PATCH 1/3] Make espcoredump more resilient when decoding specific thread stack Merges https://github.com/espressif/esp-idf/pull/4865 --- components/espcoredump/espcoredump.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/espcoredump/espcoredump.py b/components/espcoredump/espcoredump.py index ce1f547701..a909cea664 100755 --- a/components/espcoredump/espcoredump.py +++ b/components/espcoredump/espcoredump.py @@ -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: From b3eff244588869a5be04aabc7e6ab8efb5c145e0 Mon Sep 17 00:00:00 2001 From: aleks Date: Thu, 5 Mar 2020 16:16:31 +0100 Subject: [PATCH 2/3] espcoredump: update expected test output --- components/espcoredump/test/expected_output | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/espcoredump/test/expected_output b/components/espcoredump/test/expected_output index 3fdfbd071c..613b3c7562 100644 --- a/components/espcoredump/test/expected_output +++ b/components/espcoredump/test/expected_output @@ -78,6 +78,13 @@ a15 0x0 0 9 process 1073434712 xQueueGenericReceive (xQueue=0x3ffb4bdc , pvBuffer=0x0, xTicksToWait=, 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 From 45c844c1d1a4c60bef9b7826c6f422aed04ea87e Mon Sep 17 00:00:00 2001 From: "aleks@espressif.com" Date: Tue, 24 Mar 2020 11:48:18 +0100 Subject: [PATCH 3/3] espcoredump: fix idf_monitor test artifacts --- tools/test_idf_monitor/tests/core1_out.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/test_idf_monitor/tests/core1_out.txt b/tools/test_idf_monitor/tests/core1_out.txt index d9fd9da967..5118f34f2b 100644 --- a/tools/test_idf_monitor/tests/core1_out.txt +++ b/tools/test_idf_monitor/tests/core1_out.txt @@ -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