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]: QEMU Doesn't Launch: "Cannot read property 'fsPath' of undefined" (VSC-853)

See original GitHub issue

Describe the bug The QEMU feature does not launch.

I click the [ESP-IDF QEMU] link on the activity bar. It creates merged_qemu.bin, and then prompts me to select Start QEMU. Immediately a status box appears “Cannot read property ‘fsPath’ of undefined”.

To Reproduce I am following the QEMU steps here: https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/QEMU.md

I created the Hello World example using the ESP-IDF: Show Examples Projects in VSCode v1.65 on Windows 11. The I opened the container using VSCode’s dev container support. It opens and builds the container.

(Side note: The first thing that VSCode complains about the “ESP-IDF” configuration in c_cpp_properties.json has a bad “compilerPath” because it is still referencing the windows path. I can fix this manually but it would be nice if this was taken care of automatically somehow. Obviously if I go back to developing without the container in Windows the path is again invalid.)

When I run “Build your project” it fails because I had already built the project in windows. So I remove the windows built ‘build’ folder. It then builds successfully.

I then click the [ESP-IDF QEMU] link on the activity bar. It creates merged_qemu.bin, and then prompts me to select Start QEMU. Immediately a status box appears “Cannot read property ‘fsPath’ of undefined”.

I have figured out how to manually get QEMU running and launch a gdb session through VS Code so I know all the tools and files are there correctly.

Expected behavior QEMU would launch, something like: qemu-system-xtensa -nographic -gdb tcp:3333 -S -machine esp32 -drive file=build/merged_qemu.bin,if=mtd,format=raw

gdb build/merged_qemu.elf would also run with the following start up commands:

target remote localhost:3333
monitor system_reset
tb app_main
c

Environment (please complete the following information):

  • OS Name & Version: Windows 11 21H1 19043.1556, WSL2 Docker
  • VSCode Version: 1.65.0
  • ESP-IDF Version: 1.4.0
---------------------------------------------- ESP-IDF Extension for Visual Studio Code report ---------------------------------------------
OS linux x64 5.10.60.1-microsoft-standard-WSL2 
System environment variable IDF_PYTHON_ENV_PATH 
 /opt/esp/python_env/idf4.3_py3.6_env 
System environment variable PATH 
 /vscode/vscode-server/bin/linux-x64/b5205cc8eb4fbaa726835538cd82372cc0222d43/bin/remote-cli:/opt/esp/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin:/opt/esp/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin:/opt/esp/tools/xtensa-esp32s3-elf/esp-2021r2-8.4.0/xtensa-esp32s3-elf/bin:/opt/esp/tools/riscv32-esp-elf/esp-2021r2-8.4.0/riscv32-esp-elf/bin:/opt/esp/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin:/opt/esp/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin:/opt/esp/tools/cmake/3.16.4/bin:/opt/esp/tools/openocd-esp32/v0.11.0-esp32-20211220/openocd-esp32/bin:/opt/esp/python_env/idf4.3_py3.6_env/bin:/opt/esp/idf/tools:/opt/qemu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 
System environment variable PYTHON 
 undefined 
Visual Studio Code version 1.65.0 
Visual Studio Code language en 
Visual Studio Code shell /bin/bash 
ESP-IDF Extension version 1.4.0 
---------------------------------------------------- Extension configuration settings ------------------------------------------------------
ESP-ADF Path (idf.espAdfPath) ${env:ADF_PATH}
ESP-IDF Path (idf.espIdfPath) /opt/esp/idf
ESP-MDF Path (idf.espMdfPath) ${env:MDF_PATH}
Custom extra paths (idf.customExtraPaths) 
Custom extra vars (idf.customExtraVars) {"OPENOCD_SCRIPTS":"/opt/esp/tools/openocd-esp32/v0.11.0-esp32-20211220/openocd-esp32/share/openocd/scripts"}
Virtual env Python Path (idf.pythonBinPath) /opt/esp/python_env/idf4.3_py3.6_env/bin/python
Serial port (idf.port) /dev/ttyUSB1
OpenOCD Configs (idf.openOcdConfigs) interface/ftdi/esp32_devkitj_v1.cfg,board/esp32-wrover.cfg
ESP-IDF Tools Path (idf.toolsPath) /opt/esp
Git Path (idf.gitPath) /usr/bin/git
-------------------------------------------------------- Configurations access -------------------------------------------------------------
Access to ESP-ADF Path (idf.espAdfPath) false
Access to ESP-IDF Path (idf.espIdfPath) true
Access to ESP-MDF Path (idf.espMdfPath) false
Access to ESP-IDF Custom extra paths
Access to Virtual env Python Path (idf.pythonBinPath) true
Access to CMake in environment PATH true
Access to Ninja in environment PATH true
Access to ESP-IDF Tools Path (idf.toolsPath) true
----------------------------------------------------------- Executables Versions -----------------------------------------------------------
Git version 2.17.1
ESP-IDF version 4.3.2
Python version 3.6.9
Python's pip version 21.3.1
-------------------------------------------------- Python packages in idf.pythonBinPath ----------------------------------------------------
bitstring version: 3.1.9
Brotli version: 1.0.9
cffi version: 1.15.0
click version: 8.0.4
construct version: 2.10.54
cryptography version: 3.4.8
ecdsa version: 0.17.0
Flask version: 0.12.5
Flask-Compress version: 1.11
Flask-SocketIO version: 2.9.6
future version: 0.18.2
gdbgui version: 0.13.2.0
gevent version: 1.5.0
greenlet version: 1.1.2
importlib-metadata version: 4.8.3
itsdangerous version: 2.0.1
Jinja2 version: 3.0.3
kconfiglib version: 13.7.1
MarkupSafe version: 2.0.1
pip version: 21.3.1
pycparser version: 2.21
pyelftools version: 0.28
pygdbmi version: 0.9.0.2
Pygments version: 2.11.2
pyparsing version: 2.3.1
pyserial version: 3.5
python-engineio version: 3.14.2
python-socketio version: 4.6.1
reedsolo version: 1.5.4
setuptools version: 59.6.0
six version: 1.16.0
typing_extensions version: 4.1.1
Werkzeug version: 0.16.1
wheel version: 0.37.1
zipp version: 3.6.0
---------------------------------------------------- Check ESP-IDF python requirements.txt -------------------------------------------------
Check ESP-IDF Python packages Python requirements from /opt/esp/idf/requirements.txt are satisfied.
---------------------------------------------------- Check extension requirements.txt ------------------------------------------------------
Check Extension Python packages Error
---------------------------------------------------- Check ESP-IDF debug adapter requirements.txt ------------------------------------------
Check Debug AdapterPython packages Error
---------------------------------------------------- Visual Studio Code launch.json --------------------------------------------------------
{
  "version": "0.2.0",
  "configurations": [
  
    {
      "type": "espidf",
      "name": "Launch",
      "request": "launch"
    }
  ]
} 
---------------------------------------------------- Visual Studio Code c_cpp_properties.json ----------------------------------------------
{
    "configurations": [
        {
            "name": "ESP-IDF",
            "compilerPath": "C:\\Users\\snoonan\\.espressif\\tools\\xtensa-esp32-elf\\esp-2021r2-patch2-8.4.0\\xtensa-esp32-elf\\bin\\xtensa-esp32-elf-gcc.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "includePath": [
                "${config:idf.espIdfPath}/components/**",
                "${config:idf.espIdfPathWin}/components/**",
                "${config:idf.espAdfPath}/components/**",
                "${config:idf.espAdfPathWin}/components/**",
                "${workspaceFolder}/**"
            ],
            "browse": {
                "path": [
                    "${config:idf.espIdfPath}/components",
                    "${config:idf.espIdfPathWin}/components",
                    "${config:idf.espAdfPath}/components/**",
                    "${config:idf.espAdfPathWin}/components/**",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": false
            }
        }
    ],
    "version": 4
}
 
----------------------------------------------------------- Latest error -----------------------------------------------------------------
Latest error at Command failed: /opt/esp/python_env/idf4.3_py3.6_env/bin/python /opt/esp/idf/tools/check_python_dependencies.py -r "/root/.vscode-server/extensions/espressif.esp-idf-extension-1.4.0/esp_debug_adapter/requirements.txt"

--------------------------------------------------------------------------------------------------------------------------------------------

Logs The relevant logged error in /root/.vscode-server/extensions/espressif.esp-idf-extension-1.4.0/esp_idf_vsc_ext.log: {"user":true,"message":"Cannot read property 'fsPath' of undefined","stack":"TypeError: Cannot read property 'fsPath' of undefined\n\tat u.<anonymous> (/dist/extension.js:8:594999)\n\tat Generator.next (<anonymous>)\n\tat /dist/extension.js:8:593214\n\tat new Promise (<anonymous>)\n\tat l (/dist/extension.js:8:592959)\n\tat u.start (/dist/extension.js:8:594820)\n\tat u.<anonymous> (/dist/extension.js:8:593804)\n\tat Generator.next (<anonymous>)\n\tat s (/dist/extension.js:8:593016)\n\tat runMicrotasks (<anonymous>)\n\tat processTicksAndRejections (internal/process/task_queues.js:93:5)","level":"error","timestamp":"2022-03-04T20:08:01.927Z"}

Extension Configuration settings Entirety of settings.json is:

{
    "idf.gitPath": "/usr/bin/git",
    "idf.espIdfPathWin": "C:\\Users\\snoonan\\esp\\esp-idf",
    "idf.pythonBinPathWin": "C:\\Users\\snoonan\\.espressif\\python_env\\idf4.4_py3.8_env\\Scripts\\python.exe",
    "idf.toolsPathWin": "C:\\Users\\snoonan\\.espressif",
    "idf.customExtraPaths": "C:\\Users\\snoonan\\.espressif\\tools\\xtensa-esp32-elf\\esp-2021r2-patch2-8.4.0\\xtensa-esp32-elf\\bin;C:\\Users\\snoonan\\.espressif\\tools\\xtensa-esp32s2-elf\\esp-2021r2-patch2-8.4.0\\xtensa-esp32s2-elf\\bin;C:\\Users\\snoonan\\.espressif\\tools\\xtensa-esp32s3-elf\\esp-2021r2-patch2-8.4.0\\xtensa-esp32s3-elf\\bin;C:\\Users\\snoonan\\.espressif\\tools\\riscv32-esp-elf\\esp-2021r2-patch2-8.4.0\\riscv32-esp-elf\\bin;C:\\Users\\snoonan\\.espressif\\tools\\esp32ulp-elf\\2.28.51-esp-20191205\\esp32ulp-elf-binutils\\bin;C:\\Users\\snoonan\\.espressif\\tools\\esp32s2ulp-elf\\2.28.51-esp-20191205\\esp32s2ulp-elf-binutils\\bin;C:\\Users\\snoonan\\.espressif\\tools\\cmake\\3.20.3\\bin;C:\\Users\\snoonan\\.espressif\\tools\\openocd-esp32\\v0.11.0-esp32-20211220\\openocd-esp32\\bin;C:\\Users\\snoonan\\.espressif\\tools\\ninja\\1.10.2;C:\\Users\\snoonan\\.espressif\\tools\\idf-exe\\1.0.3;C:\\Users\\snoonan\\.espressif\\tools\\ccache\\4.3\\ccache-4.3-windows-64;C:\\Users\\snoonan\\.espressif\\tools\\dfu-util\\0.9\\dfu-util-0.9-win64",
    "idf.customExtraVars": "{\"OPENOCD_SCRIPTS\":\"/opt/esp/tools/openocd-esp32/v0.11.0-esp32-20211220/openocd-esp32/share/openocd/scripts\"}",
    "idf.ninjaArgs": ["-j 8"]
}

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
Andrey-Morenkovcommented, May 19, 2022

Hi @brianignacio5 In stable version (from market) and in your shared vsix version (above) ActionBar->[ESP-IDF QEMU]->Start QEMU still doesn’t work. Got “Cannot read properties of undefined (reading ‘fsPath’)” error.

Doctor command and esp_idf_vsc_ext.log attached

esp_idf_vsc_ext.log doctor command.txt

(launch from command qemu-system-xtensa -nographic -machine esp32 -drive file=./build/merged_qemu.bin,if=mtd,format=raw is working fine)

1reaction
Maircommented, Jul 20, 2022

hi @brianignacio5 I tried the following…

  1. created a new project using the idf extension
  2. launched the new project in the dev container
  3. uninstalled the esp extension
  4. downloaded and installed the new one
  5. created a small project like so
#include <stdio.h>

void app_main(void)
{
    for (size_t i = 0; i < 100; i++)
    {
        printf("count %d\n", count++);
    }
}
  1. built the project using idf.py build.
  2. clicked on the [ESP-IDF QEMU] link at the bottom
  3. clicked on Start QEMU and got this
root@ea4e97f18984:/workspaces/test-qemu# qemu-system-xtensa -nographic -machine esp32 -drive file=build/merged_qemu.bin,if=mtd,format=raw -serial tcp::5555,server,nowait
QEMU 5.2.0 monitor - type 'help' for more information
(qemu) Adding SPI flash device

Question… How do I see the output?

  1. pressed F1 an selected Launch QENU debug session got this image my debug output as follows
Debug adapter -> Extension: DEBUG_ADAPTER_STARTED
Starting. Cmd: /root/.vscode-server/extensions/espressif.esp-idf-extension-1.4.0/esp_debug_adapter/debug_adapter_main.py -d 5 -e /workspaces/test-qemu/build/test-qemu.elf -l /workspaces/test-qemu/debug.log -p 43474 -dn esp32 -a 0x10000 -t xtensa-esp32-elf- -om without_oocd -x /workspaces/test-qemu/esp-idf-vscode-generated.gdb
Listening on port 43474
Debug adapter -> Extension: DEBUG_ADAPTER_READY2CONNECT
Got connection
Got json: {
    "arguments": {
        "adapterID": "espidf",
        "clientID": "vscode",
        "clientName": "Visual Studio Code",
        "columnsStartAt1": true,
        "linesStartAt1": true,
        "locale": "en-us",
        "pathFormat": "path",
        "supportsInvalidatedEvent": true,
        "supportsMemoryReferences": true,
        "supportsProgressReporting": true,
        "supportsRunInTerminalRequest": true,
        "supportsVariablePaging": true,
        "supportsVariableType": true
    },
    "command": "initialize",
    "seq": 1,
    "type": "request"
}
Created gdb object of type: GdbEsp32
Debug Adapter initialized
Processed command: initialize
Got json: {
    "arguments": {
        "__sessionId": "b494633f-b881-4d1e-9774-471a273828a7",
        "elfFilePath": "/workspaces/test-qemu/build/test-qemu.elf",
        "name": "GDB QEMU",
        "request": "launch",
        "sessionID": "qemu.debug.session",
        "type": "espidf"
    },
    "command": "launch",
    "seq": 2,
    "type": "request"
}
Failed to wait for completion of command "-interpreter-exec console "source /workspaces/test-qemu/esp-idf-vscode-generated.gdb"" / 5!
Failed to wait for completion of command "-interpreter-exec console "source /workspaces/test-qemu/esp-idf-vscode-generated.gdb"" / 5!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'fsPath' of undefined - Get Help
Hi! :slight_smile: I'm trying to deploy my company's site and I'm getting this error: TypeError: Cannot read property 'fsPath' of undefined ...
Read more >
Todo-Tree: Cannot read property 'fsPath' of undefined
This type of problem is related to updating VS Code. The Plugin needs to receive an update path. Report the bug to the...
Read more >
1878430 – [machines] Uncaught TypeError - Red Hat Bugzilla
Bug 1878430 - [machines] Uncaught TypeError: Cannot read property 'getAttribute' ... sometimes does not show any VMs and always generates a Java Oops...
Read more >
Reporting a bug - QEMU
Reports against the latest release or even the latest development tree are usually acted upon faster. Include the full command line used to...
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