From dde4d2e9ebfad3e88fc80e5179b816dab16351c2 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 1 Mar 2020 04:01:22 +0100 Subject: [PATCH] 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 ce1f54770..a909cea66 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: