Skip to content

Commit 575bd31

Browse files
committed
print_error_report: Don't care about osRtxStackFillPattern and dump whole remaining.
1 parent 2487461 commit 575bd31

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

.astylerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ attach-classes
3434

3535
# Extend longer lines, define maximum 120 value. This results in aligned code,
3636
# otherwise the lines are broken and not consistent
37-
max-continuation-indent=120
37+
# max-continuation-indent=120

platform/source/mbed_error.c

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -577,28 +577,9 @@ static void print_error_report(const mbed_error_ctx *ctx, const char *error_msg,
577577
#endif
578578

579579
#if MBED_STACK_DUMP_ENABLED && defined(MBED_CONF_RTOS_PRESENT)
580-
/** The internal threshold to detect the end of the stack.
581-
* The stack is filled with osRtxStackFillPattern at the end.
582-
* However, it is possible that the call stack parameters can theoretically have consecutive osRtxStackFillPattern instances.
583-
* For the best effort stack end detection, we will consider STACK_END_MARK_CNT consecutive osRtxStackFillPattern instances as the stack end. */
584-
#define STACK_END_MARK_CNT 3
585580
#define STACK_DUMP_WIDTH 8
586581
mbed_error_printf("\n\nStack Dump:");
587-
// Find the stack end.
588-
int stack_end_cnt = 0;
589-
uint32_t st_end = ctx->thread_current_sp;
590-
for (; st_end <= ctx->thread_stack_mem + ctx->thread_stack_size; st_end += sizeof(int)) {
591-
uint32_t st_val = *((uint32_t *)st_end);
592-
if (st_val == osRtxStackFillPattern) {
593-
stack_end_cnt++;
594-
} else {
595-
stack_end_cnt = 0;
596-
}
597-
if (stack_end_cnt >= STACK_END_MARK_CNT) {
598-
st_end -= (STACK_END_MARK_CNT - 1) * sizeof(int);
599-
break;
600-
}
601-
}
582+
uint32_t st_end = ctx->thread_stack_mem + ctx->thread_stack_size;
602583
for (uint32_t st = ctx->thread_current_sp; st <= st_end; st += sizeof(int) * STACK_DUMP_WIDTH) {
603584
mbed_error_printf("\n0x%08" PRIX32 ":", st);
604585
for (int i = 0; i < STACK_DUMP_WIDTH; i++) {

0 commit comments

Comments
 (0)