From 575bd310604f358e7e901eb9e52d07ceb9459222 Mon Sep 17 00:00:00 2001 From: Andrew Chong Date: Tue, 27 Aug 2019 13:32:16 +0800 Subject: [PATCH] print_error_report: Don't care about osRtxStackFillPattern and dump whole remaining. --- .astylerc | 2 +- platform/source/mbed_error.c | 21 +-------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/.astylerc b/.astylerc index 7e0bc337f3..ec0880a527 100644 --- a/.astylerc +++ b/.astylerc @@ -34,4 +34,4 @@ attach-classes # Extend longer lines, define maximum 120 value. This results in aligned code, # otherwise the lines are broken and not consistent -max-continuation-indent=120 +# max-continuation-indent=120 diff --git a/platform/source/mbed_error.c b/platform/source/mbed_error.c index 5b8c302c03..890b2455a7 100644 --- a/platform/source/mbed_error.c +++ b/platform/source/mbed_error.c @@ -577,28 +577,9 @@ static void print_error_report(const mbed_error_ctx *ctx, const char *error_msg, #endif #if MBED_STACK_DUMP_ENABLED && defined(MBED_CONF_RTOS_PRESENT) - /** The internal threshold to detect the end of the stack. - * The stack is filled with osRtxStackFillPattern at the end. - * However, it is possible that the call stack parameters can theoretically have consecutive osRtxStackFillPattern instances. - * For the best effort stack end detection, we will consider STACK_END_MARK_CNT consecutive osRtxStackFillPattern instances as the stack end. */ -#define STACK_END_MARK_CNT 3 #define STACK_DUMP_WIDTH 8 mbed_error_printf("\n\nStack Dump:"); - // Find the stack end. - int stack_end_cnt = 0; - uint32_t st_end = ctx->thread_current_sp; - for (; st_end <= ctx->thread_stack_mem + ctx->thread_stack_size; st_end += sizeof(int)) { - uint32_t st_val = *((uint32_t *)st_end); - if (st_val == osRtxStackFillPattern) { - stack_end_cnt++; - } else { - stack_end_cnt = 0; - } - if (stack_end_cnt >= STACK_END_MARK_CNT) { - st_end -= (STACK_END_MARK_CNT - 1) * sizeof(int); - break; - } - } + uint32_t st_end = ctx->thread_stack_mem + ctx->thread_stack_size; for (uint32_t st = ctx->thread_current_sp; st <= st_end; st += sizeof(int) * STACK_DUMP_WIDTH) { mbed_error_printf("\n0x%08" PRIX32 ":", st); for (int i = 0; i < STACK_DUMP_WIDTH; i++) {