Skip to content

Commit c3d0e2c

Browse files
committed
mbed_error: Correct full thread info print
Casts were covering up a type mismatch. Print the "ready" list, and remove the explicit print of the idle thread (it should be in the ready list).
1 parent 25d0fba commit c3d0e2c

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

platform/mbed_error.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ mbed_error_status_t mbed_clear_all_errors(void)
272272

273273
#if MBED_CONF_PLATFORM_ERROR_ALL_THREADS_INFO && defined(MBED_CONF_RTOS_PRESENT)
274274
/* Prints info of a thread(using osRtxThread_t struct)*/
275-
static void print_thread(osRtxThread_t *thread)
275+
static void print_thread(const osRtxThread_t *thread)
276276
{
277277
mbed_error_printf("\nState: 0x%08X Entry: 0x%08X Stack Size: 0x%08X Mem: 0x%08X SP: 0x%08X", thread->state, thread->thread_addr, thread->stack_size, (uint32_t)thread->stack_mem, thread->sp);
278278
}
279279

280280
/* Prints thread info from a list */
281-
static void print_threads_info(osRtxThread_t *threads)
281+
static void print_threads_info(const osRtxThread_t *threads)
282282
{
283283
while (threads != NULL) {
284284
print_thread(threads);
@@ -355,17 +355,14 @@ static void print_error_report(mbed_error_ctx *ctx, const char *error_msg)
355355
mbed_error_printf("\nNext:");
356356
print_thread(osRtxInfo.thread.run.next);
357357

358+
mbed_error_printf("\nReady:");
359+
print_threads_info(osRtxInfo.thread.ready.thread_list);
360+
358361
mbed_error_printf("\nWait:");
359-
osRtxThread_t *threads = (osRtxThread_t *)&osRtxInfo.thread.wait_list;
360-
print_threads_info(threads);
362+
print_threads_info(osRtxInfo.thread.wait_list);
361363

362364
mbed_error_printf("\nDelay:");
363-
threads = (osRtxThread_t *)&osRtxInfo.thread.delay_list;
364-
print_threads_info(threads);
365-
366-
mbed_error_printf("\nIdle:");
367-
threads = (osRtxThread_t *)&osRtxInfo.thread.idle;
368-
print_threads_info(threads);
365+
print_threads_info(osRtxInfo.thread.delay_list);
369366
#endif
370367
mbed_error_printf(MBED_CONF_PLATFORM_ERROR_DECODE_HTTP_URL_STR, ctx->error_status);
371368
mbed_error_printf("\n-- MbedOS Error Info --\n");

0 commit comments

Comments
 (0)