mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-06-10 18:15:59 +00:00
Implement robust task name printing
This commit is contained in:
parent
ced0bd1a2a
commit
f866e27081
@ -8,14 +8,25 @@
|
||||
#include <task.h>
|
||||
|
||||
|
||||
extern "C" void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName)
|
||||
extern "C" void vApplicationStackOverflowHook(xTaskHandle xTask, char * pcTaskName)
|
||||
{
|
||||
// TODO Handle corrupted parameters
|
||||
// * check pcTaskName is cstring (look for \0 within ? bytes)
|
||||
STA_DEBUG_PRINT("Stack overflow detected in task ");
|
||||
if (pcTaskName)
|
||||
{
|
||||
STA_DEBUG_PRINTLN(pcTaskName);
|
||||
// Manually calculate string length
|
||||
// Limited to configMAX_TASK_NAME_LEN to avoid reading
|
||||
// garbage values in case TCB has been corrupted
|
||||
size_t len = 0;
|
||||
while (len < configMAX_TASK_NAME_LEN)
|
||||
{
|
||||
if (pcTaskName[len] == '\0')
|
||||
{
|
||||
break;
|
||||
}
|
||||
++len;
|
||||
}
|
||||
|
||||
STA_DEBUG_PRINTLN(pcTaskName, len);
|
||||
}
|
||||
STA_HALT();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user