mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
RISC-V: fix PC not saved when using backtrace
This commit is contained in:
parent
d580f6b076
commit
6fe563163c
@ -622,14 +622,12 @@ FORCE_INLINE_ATTR UBaseType_t uxInitialiseStackTLS(UBaseType_t uxStackPointer, u
|
||||
* Wrapper to allow task functions to return. Force the optimization option -O1 on that function to make sure there
|
||||
* is no tail-call. Indeed, we need the compiler to keep the return address to this function when calling `panic_abort`.
|
||||
*
|
||||
* Thanks to the `naked` attribute, GDB stub backtrace doesn't print:
|
||||
* #2 0x00000000 in ?? ()
|
||||
*
|
||||
* However, this also means that when calculating vPortTaskWrapper's call frame in a backtrace, return address
|
||||
* register `ra`, will NOT contain 0x00000000.
|
||||
* Thanks to `naked` attribute, the compiler won't generate a prologue and epilogue for the function, which saves time
|
||||
* and stack space.
|
||||
*/
|
||||
static void __attribute__((optimize("O1"), naked)) vPortTaskWrapper(TaskFunction_t pxCode, void *pvParameters)
|
||||
{
|
||||
asm volatile(".cfi_undefined ra\n");
|
||||
extern void __attribute__((noreturn)) panic_abort(const char *details);
|
||||
static char DRAM_ATTR msg[80] = "FreeRTOS: FreeRTOS Task \"\0";
|
||||
pxCode(pvParameters);
|
||||
@ -639,7 +637,6 @@ static void __attribute__((optimize("O1"), naked)) vPortTaskWrapper(TaskFunction
|
||||
strcat(msg, pcTaskName);
|
||||
strcat(msg, "\" should not return, Aborting now!");
|
||||
panic_abort(msg);
|
||||
|
||||
}
|
||||
#endif // CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER
|
||||
|
||||
|
@ -200,14 +200,12 @@ FORCE_INLINE_ATTR UBaseType_t uxInitialiseStackTLS(UBaseType_t uxStackPointer, u
|
||||
* Wrapper to allow task functions to return. Force the optimization option -O1 on that function to make sure there
|
||||
* is no tail-call. Indeed, we need the compiler to keep the return address to this function when calling `panic_abort`.
|
||||
*
|
||||
* Thanks to the `naked` attribute, GDB stub backtrace doesn't print:
|
||||
* #2 0x00000000 in ?? ()
|
||||
*
|
||||
* However, this also means that when calculating vPortTaskWrapper's call frame in a backtrace, return address
|
||||
* register `ra`, will NOT contain 0x00000000.
|
||||
* Thanks to `naked` attribute, the compiler won't generate a prologue and epilogue for the function, which saves time
|
||||
* and stack space.
|
||||
*/
|
||||
static void __attribute__((optimize("O1"), naked)) vPortTaskWrapper(TaskFunction_t pxCode, void *pvParameters)
|
||||
{
|
||||
asm volatile(".cfi_undefined ra\n");
|
||||
extern void __attribute__((noreturn)) panic_abort(const char *details);
|
||||
static char DRAM_ATTR msg[80] = "FreeRTOS: FreeRTOS Task \"\0";
|
||||
pxCode(pvParameters);
|
||||
@ -217,7 +215,6 @@ static void __attribute__((optimize("O1"), naked)) vPortTaskWrapper(TaskFunction
|
||||
strcat(msg, pcTaskName);
|
||||
strcat(msg, "\" should not return, Aborting now!");
|
||||
panic_abort(msg);
|
||||
|
||||
}
|
||||
#endif // CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user