From 7444890a03b1fbcd5e354e22e627556ffc758edd Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Tue, 20 Feb 2024 12:45:45 +0100 Subject: [PATCH] fix(esp_system): Updated the conditions for the GDBStub on Panic Kconfig option This commit updates the Panic handler behavior Kconfig setting to make the GDBStub on Panic (CONFIG_ESP_SYSTEM_PANIC_GDBSTUB) option to be only available when esp_gdbstub is part of the component list of the build. Closes https://github.com/espressif/esp-idf/issues/13218 --- components/esp_gdbstub/Kconfig | 3 ++- components/esp_system/Kconfig | 2 +- docs/en/api-guides/fatal-errors.rst | 4 ++++ docs/en/migration-guides/release-5.x/5.2/system.rst | 6 ++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/components/esp_gdbstub/Kconfig b/components/esp_gdbstub/Kconfig index bedc9bb3f9..a1729b95b6 100644 --- a/components/esp_gdbstub/Kconfig +++ b/components/esp_gdbstub/Kconfig @@ -1,9 +1,10 @@ menu "GDB Stub" - # Hidden option which is selected from the "Panic handler behavior" + # Hidden option which adds GDBStub on panic option to the "Panic handler behavior" # menu in the target component. config ESP_GDBSTUB_ENABLED bool + default y config ESP_SYSTEM_GDBSTUB_RUNTIME bool "GDBStub at runtime" diff --git a/components/esp_system/Kconfig b/components/esp_system/Kconfig index a8763770ec..39c4d77aa5 100644 --- a/components/esp_system/Kconfig +++ b/components/esp_system/Kconfig @@ -38,7 +38,7 @@ menu "ESP System Settings" config ESP_SYSTEM_PANIC_GDBSTUB bool "GDBStub on panic" - select ESP_GDBSTUB_ENABLED + depends on ESP_GDBSTUB_ENABLED help Invoke gdbstub on the serial port, allowing for gdb to attach to it to do a postmortem of the crash. diff --git a/docs/en/api-guides/fatal-errors.rst b/docs/en/api-guides/fatal-errors.rst index 7091c5cb77..2ab7e0b612 100644 --- a/docs/en/api-guides/fatal-errors.rst +++ b/docs/en/api-guides/fatal-errors.rst @@ -66,6 +66,10 @@ Subsequent behavior of the panic handler can be set using :ref:`CONFIG_ESP_SYSTE Start GDB server which can communicate with GDB over console UART port. This option will only provide read-only debugging or post-mortem debugging. See `GDB Stub`_ for more details. +.. note:: + + ``CONFIG_ESP_SYSTEM_PANIC_GDBSTUB`` choice in the configuration option :ref:`CONFIG_ESP_SYSTEM_PANIC` is only available when the component ``esp_gdbstub`` is included in the build. + The behavior of the panic handler is affected by three other configuration options. - If :ref:`CONFIG_ESP_DEBUG_OCDAWARE` is enabled (which is the default), the panic handler will detect whether a JTAG debugger is connected. If it is, execution will be halted and control will be passed to the debugger. In this case, registers and backtrace are not dumped to the console, and GDBStub / Core Dump functions are not used. diff --git a/docs/en/migration-guides/release-5.x/5.2/system.rst b/docs/en/migration-guides/release-5.x/5.2/system.rst index 7f2b7a8c82..ec4381f4c9 100644 --- a/docs/en/migration-guides/release-5.x/5.2/system.rst +++ b/docs/en/migration-guides/release-5.x/5.2/system.rst @@ -34,3 +34,9 @@ The Task Snapshot API has been made private due to a lack of a practical way for - ``#include "freertos/xtensa_api.h"`` is deprecated, please use ``#include "xtensa_api.h"`` instead. - ``#include "freertos/xtensa_context.h"`` is deprecated, please use ``#include "xtensa_context.h"`` instead. - ``#include "freertos/xtensa_timer.h"`` is deprecated, please use ``#include "xtensa_timer.h"`` instead. + + +Panic Handler Behavior +---------------------- + +The choice ``CONFIG_ESP_SYSTEM_PANIC_GDBSTUB`` in the configuration option :ref:`CONFIG_ESP_SYSTEM_PANIC` has been made dependent on whether the ``esp_gdbstub`` component is included in the build. When trimming the list of components in the build using ``set(COMPONENTS main)``, ``esp_gdbstub`` component has to be added to this list of components to make the ``CONFIG_ESP_SYSTEM_PANIC_GDBSTUB`` option available.