|
1 | 1 | /*
|
2 |
| - * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD |
| 2 | + * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD |
3 | 3 | *
|
4 | 4 | * SPDX-License-Identifier: Apache-2.0
|
5 | 5 | */
|
|
10 | 10 | #include "esp_private/freertos_debug.h"
|
11 | 11 | #include "esp_err.h"
|
12 | 12 | #include "esp_attr.h"
|
13 |
| -#include "riscv/rvruntime-frames.h" |
| 13 | +#include "esp_private/esp_cpu_internal.h" |
| 14 | +#include "esp_private/panic_internal.h" |
| 15 | +#include <string.h> |
14 | 16 |
|
15 | 17 | #if CONFIG_ESP_SYSTEM_USE_EH_FRAME
|
16 | 18 | #include "esp_private/eh_frame_parser.h"
|
@@ -47,13 +49,18 @@ esp_err_t IRAM_ATTR esp_backtrace_print(int depth)
|
47 | 49 |
|
48 | 50 | void *frame = snapshot.pxTopOfStack;
|
49 | 51 |
|
| 52 | + esp_cpu_frame_t backtrace_frame = {}; |
| 53 | + memcpy(&backtrace_frame, frame, sizeof(esp_cpu_frame_t)); |
| 54 | + |
50 | 55 | #if CONFIG_ESP_SYSTEM_USE_EH_FRAME
|
51 |
| - esp_rom_printf("Print CPU %d (current core) backtrace\n", current_core); |
52 |
| - esp_eh_frame_print_backtrace(frame); |
| 56 | + esp_rom_printf("esp_backtrace_print: Print CPU %d (current core) backtrace\n", current_core); |
| 57 | + esp_eh_frame_print_backtrace(frame); |
53 | 58 | #else // CONFIG_ESP_SYSTEM_USE_EH_FRAME
|
54 |
| - esp_rom_printf("Print CPU %d (current core) registers\n", current_core); |
55 |
| - panic_print_registers(frame, current_core); |
56 |
| - esp_rom_printf("\r\n"); |
| 59 | + esp_rom_printf("esp_backtrace_print: Print CPU %d (current core) registers\n", current_core); |
| 60 | + panic_prepare_frame_from_ctx(&backtrace_frame); |
| 61 | + |
| 62 | + panic_print_registers(&backtrace_frame, current_core); |
| 63 | + esp_rom_printf("\r\n"); |
57 | 64 | #endif // CONFIG_ESP_SYSTEM_USE_EH_FRAME
|
58 | 65 |
|
59 | 66 | return ESP_OK;
|
|
0 commit comments