Skip to content

Commit

Permalink
Merge branch 'fix/esp_system_requires_esp_gdbstub' into 'master'
Browse files Browse the repository at this point in the history
fix(esp_system): Updated the CMakeLists.txt to add requirement for esp_gdbstub component

Closes IDFGH-12162

See merge request espressif/esp-idf!29132
  • Loading branch information
sudeep-mohanty committed Mar 7, 2024
2 parents dc86c17 + c42b839 commit 0de2912
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion components/esp_gdbstub/Kconfig
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion components/esp_system/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions docs/en/api-guides/fatal-errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

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.

- 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.
Expand Down
6 changes: 6 additions & 0 deletions docs/en/migration-guides/release-5.x/5.2/system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 4 additions & 0 deletions docs/zh_CN/api-guides/fatal-errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 的功能。
Expand Down

0 comments on commit 0de2912

Please sign in to comment.