No such file or directory: 'riscv32-esp-elf-gdb'

Hi,

I just set up a new project using the ESP32-c3 and wanted to run the debugger.
The code gets (re-)build and the debugger start but dies without error.
Going to the debug console I can see:

undefinedFileNotFoundError: Traceback (most recent call last):
File “/home/nerdyscout/.platformio/penv/lib/python3.11/site-packages/platformio/main.py”, line 103, in main
cli() # pylint: disable=no-value-for-parameter
^^^^^
File “/home/nerdyscout/.platformio/penv/lib/python3.11/site-packages/click/core.py”, line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/nerdyscout/.platformio/penv/lib/python3.11/site-packages/click/core.py”, line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File “/home/nerdyscout/.platformio/penv/lib/python3.11/site-packages/platformio/cli.py”, line 85, in invoke
return super().invoke(ctx)
^^^^^^^^^^^^^^^^^^^
File “/home/nerdyscout/.platformio/penv/lib/python3.11/site-packages/click/core.py”, line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/nerdyscout/.platformio/penv/lib/python3.11/site-packages/click/core.py”, line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/nerdyscout/.platformio/penv/lib/python3.11/site-packages/click/core.py”, line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/nerdyscout/.platformio/penv/lib/python3.11/site-packages/click/decorators.py”, line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/nerdyscout/.platformio/penv/lib/python3.11/site-packages/platformio/debug/cli.py”, line 109, in cli
_run(project_dir, debug_config, client_extra_args)
File “/home/nerdyscout/.platformio/penv/lib/python3.11/site-packages/platformio/debug/cli.py”, line 175, in _run
loop.run_until_complete(coro)
File “/usr/lib/python3.11/asyncio/base_events.py”, line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File “/home/nerdyscout/.platformio/penv/lib/python3.11/site-packages/platformio/debug/process/gdb.py”, line 57, in run
await self.spawn(*args, cwd=self.project_dir, wait_until_exit=True)
File “/home/nerdyscout/.platformio/penv/lib/python3.11/site-packages/platformio/debug/process/base.py”, line 76, in spawn
await loop.subprocess_exec(
File “/usr/lib/python3.11/asyncio/base_events.py”, line 1694, in subprocess_exec
transport = await self._make_subprocess_transport(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/asyncio/unix_events.py”, line 207, in _make_subprocess_transport
transp = _UnixSubprocessTransport(self, protocol, args, shell,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/asyncio/base_subprocess.py”, line 36, in init
self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
File “/usr/lib/python3.11/asyncio/unix_events.py”, line 818, in _start
self._proc = subprocess.Popen(
^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/subprocess.py”, line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File “/usr/lib/python3.11/subprocess.py”, line 1950, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
> FileNotFoundError: [Errno 2] No such file or directory: ‘riscv32-esp-elf-gdb’

============================================================

An unexpected error occurred. Further steps:

============================================================

I suppose the missing riscv32-esp-elf-gdb is my issue, but should this not be installed according to the dependencies?

dependencies list:

Resolving ESP32-C3 dependencies…
Platform espressif32 @ 6.5.0 (required: espressif32)
├── framework-arduinoespressif32 @ 3.20014.231204 (required: platformio/framework-arduinoespressif32 @ ~3.20014.0)
├── tool-esptoolpy @ 1.40501.0 (required: platformio/tool-esptoolpy @ ~1.40501.0)
├── tool-mkfatfs @ 2.0.1 (required: platformio/tool-mkfatfs @ ~2.0.0)
├── tool-mklittlefs @ 1.203.210628 (required: platformio/tool-mklittlefs @ ~1.203.0)
├── tool-mkspiffs @ 2.230.0 (required: platformio/tool-mkspiffs @ ~2.230.0)
├── tool-openocd-esp32 @ 2.1100.20220706 (required: platformio/tool-openocd-esp32 @ ~2.1100.0)
└── toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 (required: espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch5)

This is explicitly disabled for Arduino because it’s supposed to be in toolchain-riscv32-esp:

Try adding

platform_packages =
   espressif/tool-riscv32-esp-elf-gdb

in the platformio.ini.

thanks for your support. I did add and listing dependencies this extra package is shown, but the debug console output did not change.

Furthermore I just noticed my toolchain-riscv32-esp is version 8.4.0+2021r2-patch5, but seems like 12.2.0+20230208 is the latest. pio pkg update does not give my any updates. Plaformio itself seems to be latest 6.1.13.
any idea why this wont update?

It’s correct for framework = arduino projects to be built with 8.4.0, the GCC12 toolchain is only used for framework = espidf.

In any case, Arduino projects should still be debuggable and the toolchain should have GDB in it. This is definitely a bug. Please file an issue in Issues · platformio/platform-espressif32 · GitHub along with the minimal possible platformio.ini that reproduces this error.