From 7444890a03b1fbcd5e354e22e627556ffc758edd Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Tue, 20 Feb 2024 12:45:45 +0100 Subject: [PATCH 1/2] 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 bedc9bb3f9ab..a1729b95b6a9 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 a8763770ecad..39c4d77aa557 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 7091c5cb7785..2ab7e0b61265 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 7f2b7a8c82c9..ec4381f4c9a3 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. From 3dc5bfd58b25773b9ebf7b20034f4aafd3f7cebe Mon Sep 17 00:00:00 2001 From: mofeifei Date: Tue, 5 Mar 2024 15:48:32 +0800 Subject: [PATCH 2/2] docs: update cn trans fatal-errors --- docs/en/api-guides/fatal-errors.rst | 2 +- docs/zh_CN/api-guides/fatal-errors.rst | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/en/api-guides/fatal-errors.rst b/docs/en/api-guides/fatal-errors.rst index 2ab7e0b61265..389e90ea4a41 100644 --- a/docs/en/api-guides/fatal-errors.rst +++ b/docs/en/api-guides/fatal-errors.rst @@ -68,7 +68,7 @@ Subsequent behavior of the panic handler can be set using :ref:`CONFIG_ESP_SYSTE .. 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 ``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. diff --git a/docs/zh_CN/api-guides/fatal-errors.rst b/docs/zh_CN/api-guides/fatal-errors.rst index 4f2b054d4803..ebeee793f4c4 100644 --- a/docs/zh_CN/api-guides/fatal-errors.rst +++ b/docs/zh_CN/api-guides/fatal-errors.rst @@ -66,6 +66,10 @@ 启动 GDB 服务器,通过控制台 UART 接口与 GDB 进行通信。该选项只提供只读调试或者事后调试,详细信息请参阅 `GDB Stub`_。 +.. note:: + + 仅当构建中包含组件 ``esp_gdbstub`` 时,配置选项 :ref:`CONFIG_ESP_SYSTEM_PANIC` 中的 ``CONFIG_ESP_SYSTEM_PANIC_GDBSTUB`` 选项可用。 + 紧急处理程序的行为还受到另外两个配置项的影响: - 如果使能了 :ref:`CONFIG_ESP_DEBUG_OCDAWARE` (默认),紧急处理程序会检测 {IDF_TARGET_NAME} 是否已经连接 JTAG 调试器。如果检测成功,程序会暂停运行,并将控制权交给调试器。在这种情况下,寄存器和回溯不会被打印到控制台,并且也不会使用 GDB Stub 和 Core Dump 的功能。