From 69ef694178e219fa2af88a9b1c41f7b485688046 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Wed, 7 Aug 2019 11:49:55 +0530 Subject: [PATCH] esp32_gdbstub: fix build error with esp32-2019r1 toolchain Fixes https://github.com/espressif/esp-idf/issues/3866 Closes https://github.com/espressif/esp-idf/issues/3834 --- components/esp32/panic.c | 2 ++ components/esp_gdbstub/src/gdbstub.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/esp32/panic.c b/components/esp32/panic.c index e7ed6540e..ec3ded73f 100644 --- a/components/esp32/panic.c +++ b/components/esp32/panic.c @@ -429,6 +429,7 @@ static inline void disableAllWdts() TIMERG1.wdt_wprotect = 0; } +#if CONFIG_ESP32_PANIC_PRINT_REBOOT || CONFIG_ESP32_PANIC_SILENT_REBOOT static void esp_panic_dig_reset() __attribute__((noreturn)); static void esp_panic_dig_reset() @@ -444,6 +445,7 @@ static void esp_panic_dig_reset() ; } } +#endif static void putEntry(uint32_t pc, uint32_t sp) { diff --git a/components/esp_gdbstub/src/gdbstub.c b/components/esp_gdbstub/src/gdbstub.c index 4d1f4cf54..4fd02b343 100644 --- a/components/esp_gdbstub/src/gdbstub.c +++ b/components/esp_gdbstub/src/gdbstub.c @@ -205,12 +205,14 @@ static void handle_H_command(const unsigned char* cmd, int len) } else if (requested_task_index > s_scratch.task_count) { ret = "E00"; } else { - TaskHandle_t handle; + TaskHandle_t handle = NULL; get_task_handle(requested_task_index, &handle); /* FIXME: for the task currently running on the other CPU, extracting the registers from TCB * isn't valid. Need to use some IPC mechanism to obtain the registers of the other CPU */ - esp_gdbstub_tcb_to_regfile(handle, &s_scratch.regfile); + if (handle != NULL) { + esp_gdbstub_tcb_to_regfile(handle, &s_scratch.regfile); + } } esp_gdbstub_send_str_packet(ret); } else {