What's in your gdbinit
file, if any?
I ran into a similar error when trying to setup debugging in Clion.
The solution was to set the Debugger binary xtensa-esp32-elf-gdb
in the Toolchain settings, and then select it in the Run Configuration.
Instead of writing -file-exec-and-symbols build/main.elf
in the gdb console just pass the symbol file as command line argument:
xtensa-esp32-elf-gdb -x gdbinit ../build/main.elf