Hi everybody.
Can you help me understand what this backtrace is talking about?
My knowledge was only enough to get a transcript.
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x400919e3 PS : 0x00060d33 A0 : 0x80091aa4 A1 : 0x3ffbcfe0
A2 : 0x3ffd5a50 A3 : 0x00000001 A4 : 0x3ffd5a6c A5 : 0x00000000
A6 : 0x3ffd5a5c A7 : 0x00000000 A8 : 0x00000000 A9 : 0x00000000
A10 : 0x00000000 A11 : 0x0000000b A12 : 0x00060d20 A13 : 0x00060d23
A14 : 0x3ffd5a50 A15 : 0x0000cdcd SAR : 0x00000000 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000004 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
Backtrace: 0x400919e0:0x3ffbcfe0 0x40091aa1:0x3ffbd000 0x400915f6:0x3ffbd020 0x4009171b:0x3ffbd060 0x40090c39:0x3ffbd090
0x400919e0: xEventGroupSetBits at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/event_groups.c:584
0x40091aa1: vEventGroupSetBitsCallback at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/event_groups.c:752
0x400915f6: prvProcessReceivedCommands at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/timers.c:820
0x4009171b: prvTimerTask at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/timers.c:637 (discriminator 1)
0x40090c39: vPortTaskWrapper at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134
Explain the decryption of the backtrace
-
MicroController
- Posts: 2672
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Explain the decryption of the backtrace
SureCan you help me understand what this backtrace is talking about?
A load/read was attempted from a memory address which could not be read. Likely because of an invalid address being used; most commonly some null pointer being dereferenced.Code: Select all
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
The offending load instruction is at address (PC) 0x400919e3, and the (virtual) memory address it was trying to read from wasCode: Select all
Core 0 register dump: PC : 0x400919e3 ... ... EXCVADDR: 0x00000004 ...
(EXCVADDR) 0x00000004. Almost certainly an attempt to access a struct member via a null pointer.
Call stack, most recent call at the top. I.e., leading to the exception the call hierarchy was vPortTaskWrapper->prvTimerTask->prvProcessReceivedCommands->vEventGroupSetBitsCallback->xEventGroupSetBits.Code: Select all
0x400919e0: xEventGroupSetBits at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/event_groups.c:584 0x40091aa1: vEventGroupSetBitsCallback at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/event_groups.c:752 0x400915f6: prvProcessReceivedCommands at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/timers.c:820 0x4009171b: prvTimerTask at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/timers.c:637 (discriminator 1) 0x40090c39: vPortTaskWrapper at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134
None of your application code was directly involved, but inside the system's timer task prvProcessReceivedCommands (...) called vEventGroupSetBitsCallback(...) with what must have been a null pointer to an event group object.
Can't tell though where that null pointer came from. Possibly a failed heap allocation which was not caught early, or some form of memory corruption, e.g. stack overflow, a write beyond the end of an array, or a use-after-free.
Re: Explain the decryption of the backtrace
Thanks! It became a little clearer. And what is meant by "use-after-free"?
-
MicroController
- Posts: 2672
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Explain the decryption of the backtrace
Now it gives out this:
0x40091dc3: prvSelectHighestPriorityTaskSMP at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/tasks.c:3571 (discriminator 1)
0x40092726: vTaskSwitchContext at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/tasks.c:3675
0x40091118: _frxt_dispatch at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S:451
0x400910ca: _frxt_int_exit at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S:246
As I understand it, there is an incorrect context switch in the timer interrupt handler. Is that right?
Here is the handler itself:
static uint64_t count_cycle = 0;
static bool IRAM_ATTR timer_isr_callback(void *args)
{
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xEventGroupSetBitsFromISR(WorkFlags,FLAG_TIMER_INTERRUPT,&xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
count_cycle++;
return false;
}
0x40091dc3: prvSelectHighestPriorityTaskSMP at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/tasks.c:3571 (discriminator 1)
0x40092726: vTaskSwitchContext at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/tasks.c:3675
0x40091118: _frxt_dispatch at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S:451
0x400910ca: _frxt_int_exit at C:/Espressif/frameworks/esp-idf-v5.2.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S:246
As I understand it, there is an incorrect context switch in the timer interrupt handler. Is that right?
Here is the handler itself:
static uint64_t count_cycle = 0;
static bool IRAM_ATTR timer_isr_callback(void *args)
{
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xEventGroupSetBitsFromISR(WorkFlags,FLAG_TIMER_INTERRUPT,&xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
count_cycle++;
return false;
}
Who is online
Users browsing this forum: No registered users and 3 guests