Chapter 4. API Guides
4.12.4 GDB Stub
If the CONFIG_ESP_SYSTEM_PANIC_GDBSTUB option is enabled, the panic handler will not reset the chip when
a fatal error happens. Instead, it will start a GDB remote protocol server, commonly referred to as GDB Stub. When
this happens, a GDB instance running on the host computer can be instructed to connect to the ESP32-S2 UART
port.
If IDF Monitor is used, GDB is started automatically when a GDB Stub prompt is detected on the UART. The output
looks like this:
Entering gdb stub now.
$T0b#e6GNU gdb (crosstool-NG crosstool-ng-1.22.0-80-gff1f415) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_apple-darwin16.3.0 --target=xtensa-
,→esp32s2-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /Users/user/esp/example/build/example.elf...done.
Remote debugging using /dev/cu.usbserial-31301
0x400e1b41 in app_main ()
at /Users/user/esp/example/main/main.cpp:36
36 *((int*) 0) = 0;
(gdb)
The GDB prompt can be used to inspect CPU registers, local and static variables, and arbitrary locations in memory. It
is not possible to set breakpoints, change the PC, or continue execution. To reset the program, exit GDB and perform
an external reset: Ctrl-T Ctrl-R in IDF Monitor, or using the external reset button on the development board.
4.12.5 Guru Meditation Errors
This section explains the meaning of different error causes, printed in parens after the Guru Meditation Er-
ror: Core panic'ed message.
Note: See the Guru Meditation Wikipedia article for historical origins of “Guru Meditation”.
IllegalInstruction
This CPU exception indicates that the instruction which was executed was not a valid instruction. Most common
reasons for this error include:
• FreeRTOS task function has returned. In FreeRTOS, if a task function needs to terminate, it should call
vTaskDelete() and delete itself, instead of returning.
• Failure to read next instruction from SPI flash. This usually happens if:
– Application has reconfigured the SPI flash pins as some other function (GPIO, UART, etc.). Consult the
Hardware Design Guidelines and the datasheet for the chip or module for details about the SPI flash pins.
– Some external device has accidentally been connected to the SPI flash pins, and has interfered with
communication between ESP32-S2 and SPI flash.
Espressif Systems 1338
Submit Document Feedback
Release v4.4