eATM

记录解决vscode中ESP-IDF不能调试的问题.

调试控制台输出信息
				
					Debug adapter -> Extension: DEBUG_ADAPTER_STARTED_
Debug adapter -> Extension: DEBUG_ADAPTER_READY2CONNECT
				
			

这明显的缺少详细信息,所以定位到了ESP-IDF扩展中的的esp_debug_adapter文件夹

找到修改debug_adapter\cli.py文件,设置调试等级

详细错误信息
				
					2024-03-17 19:01:59,607 - Gdb - DEBUG - MI->: -file-exec-and-symbols e:/esp_project/vscode_project/build/vscode_project.elf

[Debug Adapter]
2024-03-17 19:02:04,617 - Gdb - DEBUG - MI<-:
[]

[Debug Adapter]
2024-03-17 19:02:04,618 - Debug Adapter (main) - ERROR - Failed to wait for completion of command "-file-exec-and-symbols e:/esp_project/vscode_project/build/vscode_project.elf" / 5!
Traceback (most recent call last):
  File "c:\Users\Admin\.vscode\extensions\espressif.esp-idf-extension-1.7.0\esp_debug_adapter\debug_adapter\command_processor.py", line 52, in __call__
    on_request(protocol_message)
  File "c:\Users\Admin\.vscode\extensions\espressif.esp-idf-extension-1.7.0\esp_debug_adapter\debug_adapter\command_processor.py", line 75, in on_initialize_request
    raise e
  File "c:\Users\Admin\.vscode\extensions\espressif.esp-idf-extension-1.7.0\esp_debug_adapter\debug_adapter\command_processor.py", line 70, in on_initialize_request
    self.da.adapter_init()
  File "c:\Users\Admin\.vscode\extensions\espressif.esp-idf-extension-1.7.0\esp_debug_adapter\debug_adapter\debug_adapter.py", line 329, in adapter_init
    raise e
  File "c:\Users\Admin\.vscode\extensions\espressif.esp-idf-extension-1.7.0\esp_debug_adapter\debug_adapter\debug_adapter.py", line 325, in adapter_init
    self.start_gdb()
  File "c:\Users\Admin\.vscode\extensions\espressif.esp-idf-extension-1.7.0\esp_debug_adapter\debug_adapter\debug_adapter.py", line 678, in start_gdb
    raise e
  File "c:\Users\Admin\.vscode\extensions\espressif.esp-idf-extension-1.7.0\esp_debug_adapter\debug_adapter\debug_adapter.py", line 666, in start_gdb
    self._gdb.exec_file_set(elf)
  File "d:\Espressif\idf_tools\python_env\idf5.2_py3.11_env\Lib\site-packages\esp_debug_backend\gdb.py", line 283, in exec_file_set
    res, _ = self._mi_cmd_run('-file-exec-and-symbols %s' % local_file_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Espressif\idf_tools\python_env\idf5.2_py3.11_env\Lib\site-packages\esp_debug_backend\gdb.py", line 206, in _mi_cmd_run
    raise DebuggerTargetStateTimeoutError(
esp_debug_backend.defs.DebuggerTargetStateTimeoutError: Failed to wait for completion of command "-file-exec-and-symbols e:/esp_project/vscode_project/build/vscode_project.elf" / 5!

				
			

看上去是加载符号文件的问题,但符号文件是正常的

手动启动xtensa-esp32s3-elf-gdb.exe,并执行该条gdb命令,发现直接不返回了,等了1分钟…

所以判断是gdb的问题,

尝试去VisualGDB中的xtensa-esp32s3-elf-gdb.exe版本执行同样的命令,是正常的.

从VisualGDB中复制它的xtensa-esp32s3-elf-gdb.exe版本到路径D:\Espressif\idf_tools\tools\xtensa-esp-elf-gdb\12.1_20231023\xtensa-esp-elf-gdb\bin\

发现完全OK了,貌似要好几个文件

像esp32c3的不知道有没有问题,同样有问题的话得去找可用的gdb版本,没有安装VisualGDB的话,可以看看Arduino,里面也有可用的版本

但这两个xtensa-esp32s3-elf-gdb.exe文件,大小区别奇大..

ESP-IDF tools中的xtensa-esp32s3-elf-gdb.exe只有390KB

而VisualGDB中的xtensa-esp32s3-elf-gdb.exe有6MB+

成功断点

 

可用的s3 gdb:xtensa-esp32s3-elf-gdb

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注