@@ -270,11 +270,16 @@ mbed_error_status_t mbed_clear_all_errors(void)
270
270
return status ;
271
271
}
272
272
273
+ static const char * name_or_unnamed (const char * name )
274
+ {
275
+ return name ? name : "<unnamed>" ;
276
+ }
277
+
273
278
#if MBED_CONF_PLATFORM_ERROR_ALL_THREADS_INFO && defined(MBED_CONF_RTOS_PRESENT )
274
279
/* Prints info of a thread(using osRtxThread_t struct)*/
275
280
static void print_thread (const osRtxThread_t * thread )
276
281
{
277
- 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 );
282
+ mbed_error_printf ("\n%s State : 0x%X Entry: 0x%08X Stack Size: 0x%08X Mem: 0x%08X SP: 0x%08X" , name_or_unnamed ( thread -> name ) , thread -> state , thread -> thread_addr , thread -> stack_size , (uint32_t )thread -> stack_mem , thread -> sp );
278
283
}
279
284
280
285
/* Prints thread info from a list */
@@ -348,8 +353,11 @@ static void print_error_report(mbed_error_ctx *ctx, const char *error_msg)
348
353
#endif
349
354
350
355
mbed_error_printf ("\nError Value: 0x%X" , ctx -> error_value );
351
- mbed_error_printf ("\nCurrent Thread: Id: 0x%X Entry: 0x%X StackSize: 0x%X StackMem: 0x%X SP: 0x%X " ,
356
+ #ifdef MBED_CONF_RTOS_PRESENT
357
+ mbed_error_printf ("\nCurrent Thread: %s Id: 0x%X Entry: 0x%X StackSize: 0x%X StackMem: 0x%X SP: 0x%X " ,
358
+ name_or_unnamed (((osRtxThread_t * )ctx -> thread_id )-> name ),
352
359
ctx -> thread_id , ctx -> thread_entry_address , ctx -> thread_stack_size , ctx -> thread_stack_mem , ctx -> thread_current_sp );
360
+ #endif
353
361
354
362
#if MBED_CONF_PLATFORM_ERROR_ALL_THREADS_INFO && defined(MBED_CONF_RTOS_PRESENT )
355
363
mbed_error_printf ("\nNext:" );
0 commit comments