question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug Report]: F5 to debug, error with "Failed to init Debug Adapter" (VSC-837)

See original GitHub issue

Press F5 to launch debug , a message box with the error “Failed to init Debug Adapter”. But if I manually execute “idf.py gdbgui” , everything works fine.

OS: Windows11 21H2(22000.469) VSCode: 1.64.1 vscode-esp-idf-extension: v1.3.0 esp-idf: release-4.4 [8153bfe4]

There’re many different development environments in my laptop, stm32, esp32, dotnet, java… So I’m not starting vscode as most other people doing. Instead, I start a command shell window, executing “$HOME/.espressif/idf_cmd_init.bat esp-idf-esp-idf-3bca1dcff0a1a9a66f79892b92e8174c” first, as pic below image

After that change to a workspace, then execute cmd “code .” to start the vscode for my project.

esp-tools chain is installed into C:\Users\acebear\.espressif esp-idf is installed into C:\Users\acebear\source\esp-idf before executing idf_cmd_init.bat, only 2 esp related env-variables defined

IDF_PATH=C:\Users\acebear\source\esp-idf
IDF_TOOLS_PATH=C:\Users\acebear\.espressif

building, flash and any other functions are working fine, except “F5 Debug”, when I launch debug, there’s always a message box with the error “Failed to init Debug Adapter”. Any suggestion can I have a try?

the Debug console only 2 lines:

Debug adapter -> Extension: DEBUG_ADAPTER_STARTED
Debug adapter -> Extension: DEBUG_ADAPTER_READY2CONNECT

the output for “ESP-IDF Debug Adapter”:

DEBUG_ADAPTER_STARTED
2022-02-09 22:59:48,751 - Debug Adapter (main) - CRITICAL - Debug adapter -> Extension: DEBUG_ADAPTER_STARTED
DEBUG_ADAPTER_READY2CONNECT
2022-02-09 22:59:48,757 - Debug Adapter (main) - CRITICAL - Debug adapter -> Extension: DEBUG_ADAPTER_READY2CONNECT
DEBUG_ADAPTER_STOPPED
2022-02-09 22:59:48,799 - Debug Adapter (main) - CRITICAL - Debug adapter -> Extension: DEBUG_ADAPTER_STOPPED
[Stopped] : ESP-IDF Debug Adapter

the output for “OpenOCD”:

Open On-Chip Debugger  v0.11.0-esp32-20211220 (2021-12-20-15:43)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
debug_level: 2

Info : only one transport option; autoselect 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
Warn : Transport "jtag" was already selected
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Info : clock speed 40000 kHz
Info : JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32s3.cpu0: Target halted, PC=0x420072B8, debug_reason=00000001
Info : esp32s3.cpu1: Target halted, PC=0x420189A6, debug_reason=00000000
Info : starting gdb server for esp32s3.cpu0 on 3333
Info : Listening on port 3333 for gdb connections

if I manually execute idf.py gdbgui, the web gdb debugger looks good image

launch.json

{
    "version": "0.2.0",
    "configurations": [
      {
        "type": "espidf",
        "name": "debug",
        "request": "launch"
      }
    ]
  }

.vscode/settings.json

{
    "git.autoRepositoryDetection": "subFolders",
    "makefile.extensionOutputFolder": "./.vscode",

    "idf.pythonBinPathWin": "${env:IDF_PYTHON}",
    "idf.espIdfPathWin": "${env:IDF_PATH}",
    "idf.customExtraPaths": "${env:PATH}",
    "idf.adapterTargetName": "esp32s3",
    "idf.customExtraVars": "{\"OPENOCD_SCRIPTS\":\"C:/Users/acebear/.espressif/tools/openocd-esp32/v0.11.0-esp32-20211220/openocd-esp32/share/openocd/scripts\"}",
    "idf.openOcdConfigs": [
        "board/esp32s3-builtin.cfg"
    ],
    "idf.openOcdDebugLevel": 2,
    "idf.portWin": "COM5",
    "idf.flashType": "JTAG",
    "files.associations": {
        "timer.h": "c"
    }
}

the ESP-IDF: Doctor Command report looks very bad, but I think it is the “doctor command” perhaps has some bug, not the environment.

---------------------------------------------- ESP-IDF Extension for Visual Studio Code report --------------------------------------------- OS win32 x64 10.0.22000 System environment variable IDF_PYTHON_ENV_PATH C:\Users\acebear.espressif\python_env\idf4.4_py3.8_env System environment variable PATH C:\Users\acebear.espressif\tools\xtensa-esp32s3-elf\esp-2021r2-patch2-8.4.0\xtensa-esp32s3-elf\bin;C:\Users\acebear.espressif\tools\riscv32-esp-elf\esp-2021r2-patch2-8.4.0\riscv32-esp-elf\bin;C:\Users\acebear.espressif\tools\esp32s2ulp-elf\2.28.51-esp-20191205\esp32s2ulp-elf-binutils\bin;C:\Users\acebear.espressif\tools\cmake\3.20.3\bin;C:\Users\acebear.espressif\tools\openocd-esp32\v0.11.0-esp32-20211220\openocd-esp32\bin;C:\Users\acebear.espressif\tools\ninja\1.10.2;C:\Users\acebear.espressif\tools\idf-exe\1.0.3;C:\Users\acebear.espressif\tools\ccache\4.3\ccache-4.3-windows-64;C:\Users\acebear.espressif\tools\dfu-util\0.9\dfu-util-0.9-win64;C:\Users\acebear\source\esp-idf\tools;C:\Users\acebear.espressif\python_env\idf4.4_py3.8_env\Scripts;C:\Users\acebear.espressif\tools\idf-git\2.30.1\cmd;C:\Users\acebear.espressif;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\SystemInternals;C:\Program Files\LLVM\LLVM\bin;C:\Program Files (x86)\gnu-make\gnu-make\bin;C:\Program Files\dotnet;C:\Program Files\JAVA\jdk\bin;C:\Users\acebear\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Python\Python;C:\Program Files\Python\Python\Scripts;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\libnvvp;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\NVIDIA Corporation\Nsight Compute 2021.2.0;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\include;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\extras\CUPTI\lib64;C:\Program Files\NVIDIA GPU Computing Toolkit\cuDNN\v8.2.2\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\gcc-arm\gcc-arm\bin;C:\Program Files (x86)\STMicroelectronics\st_toolset\asm;C:\Users\acebear\AppData\Local\Microsoft\WindowsApps;C:\Users\acebear.dotnet\tools;C:\Users\acebear\AppData\Roaming\Python\Python\Scripts;C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8;C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM32 System environment variable PYTHON undefined Visual Studio Code version 1.64.1 Visual Studio Code language en Visual Studio Code shell C:\WINDOWS\System32\cmd.exe ESP-IDF Extension version 1.3.0 ---------------------------------------------------- Extension configuration settings ------------------------------------------------------ ESP-ADF Path (idf.espAdfPath) ${env:ADF_PATH} ESP-IDF Path (idf.espIdfPath) ${env:IDF_PATH} ESP-MDF Path (idf.espMdfPath) ${env:MDF_PATH} Custom extra paths (idf.customExtraPaths) ${env:PATH} Custom extra vars (idf.customExtraVars) {“OPENOCD_SCRIPTS”:“C:/Users/acebear/.espressif/tools/openocd-esp32/v0.11.0-esp32-20211220/openocd-esp32/share/openocd/scripts”} Virtual env Python Path (idf.pythonBinPath) ${env:IDF_PYTHON} Serial port (idf.port) COM5 OpenOCD Configs (idf.openOcdConfigs) board/esp32s3-builtin.cfg ESP-IDF Tools Path (idf.toolsPath) ${env:IDF_TOOLS_PATH} Git Path (idf.gitPath) /usr/bin/git -------------------------------------------------------- Configurations access ------------------------------------------------------------- Access to ESP-ADF Path (idf.espAdfPath) false Access to ESP-IDF Path (idf.espIdfPath) false Access to ESP-MDF Path (idf.espMdfPath) false Access to ESP-IDF Custom extra paths Access to ${env:PATH}: false Access to Virtual env Python Path (idf.pythonBinPath) false Access to CMake in environment PATH undefined Access to Ninja in environment PATH undefined Access to ESP-IDF Tools Path (idf.toolsPath) false ----------------------------------------------------------- Executables Versions ----------------------------------------------------------- Git version undefined ESP-IDF version undefined Python version undefined Python’s pip version undefined -------------------------------------------------- Python packages in idf.pythonBinPath ---------------------------------------------------- ---------------------------------------------------- Check ESP-IDF python requirements.txt ------------------------------------------------- Check ESP-IDF Python packages undefined ---------------------------------------------------- Check extension requirements.txt ------------------------------------------------------ Check Extension Python packages undefined ---------------------------------------------------- Check ESP-IDF debug adapter requirements.txt ------------------------------------------ Check Debug AdapterPython packages undefined ----------------------------------------------------------- Latest error ----------------------------------------------------------------- Latest error at Command failed: “/usr/bin/git” --version ϵͳ�Ҳ���ָ����·����


Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
brianignacio5commented, Feb 17, 2022

Thanks for your feedback @acebearxp closing this issue then.

Please let me know if you have an additional issue, will be releasing this new version to marketplace soon!

0reactions
acebearxpcommented, Feb 16, 2022

After power-off chip restart openocd and vscode, this time, it works!

here is the same log file, but every thing is ok. DEBUG CONSOLE_GOOD.txt OUTPUT-ESP-IDF Debug Adapter_GOOD.txt OUTPUT-OpenOCD_GOOD.txt

Read more comments on GitHub >

github_iconTop Results From Across the Web

debug adapter failed to launch - Visual Studio Feedback
When i click debug it gives a feedback that debug adapter failed to launch and also that session-1 timed waiting for debuggage to...
Read more >
Bug ID 760395: Windows Driver Verifier running causes a ...
If your company requires F5-based VPN connections when working from a remote environment, this issue prevents you from debugging and testing Windows drivers ......
Read more >
JTAG Debugging - ESP32-S2 - Espressif Systems
Description how ESP32-S2, JTAG interface, OpenOCD and GDB are interconnected and working together to enable debugging of ESP32-S2. Selecting JTAG Adapter.
Read more >
VSCODE ESP-IDF Plugin Debug Problem - ESP32 Forum
Hitting F5 (to launch the default esp-idf debugger configuration) I receive the following error code: Code: Select all
Read more >
Unable to debug Blazor hosted webassembly 3.2.0 from ...
applicationUrl to only http://localhost:port in launchsettings.json. I think the debug adapter has an underlying security related problem. Good ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found