Rust containerized app launch-debug error [cannot read properties of undefined (reading 'replaceAll')]

When trying to debug a Rust debug application, the following error pops up in VsCode:

The config looks like:

        {
            "name": "Torizon ARMv8",
            "type": "cppdbg",
            "request": "launch",
            "program": "${config:torizon_app_root}/gui",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${config:torizon_app_root}",
            "environment": [],
            "externalConsole": false,
            "internalConsoleOptions": "openOnSessionStart",
            "sourceFileMap": {
                "${config:torizon_app_root}": "${workspaceFolder}"
            },
            "pipeTransport": {
                "debuggerPath": "/usr/bin/rust-gdb",
                "pipeProgram": "ssh",
                "pipeArgs": [
                    "-T",
                    "-q",
                    "-p",
                    "${config:torizon_debug_ssh_port}",
                    "-o",
                    "StrictHostKeyChecking=no",
                    "-o",
                    "UserKnownHostsFile /dev/null",
                    "${config:torizon_run_as}@${config:torizon_ip}"
                ]
            },
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "deploy-torizon-arm64"
        }

Any ideas what’s going on ?

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Thank you for providing the error screenshot and your debug configuration.

This issue is similar to ones discussed in our community, often relating to SSH connection or debugger setup issues when debugging Rust applications on Torizon using Visual Studio Code.

Here is a checklist to help you resolve the problem:

  1. SSH Connection & Settings

    • Double-check that ${config:torizon_debug_ssh_port} (the SSH port) is correct—ensure it matches what your device is using.
    • Make sure ${config:torizon_ip} (the IP address of your board) is reachable from your development PC. You can confirm this by running ssh <user>@<ip> from your terminal.
    • Verify that the ${config:torizon_run_as} user exists on the device and has SSH access rights.

    For additional network troubleshooting tips, see:
    VS Code Toradex Torizon Support Extension & Network Connectivity

  2. GDB/Rust-GDB Setup

    • Make sure /usr/bin/rust-gdb exists inside the container running your application. If not, install it in your Dockerfile with apt-get update && apt-get install -y gdb rust-gdb.
    • If you’re using a custom Rust container, confirm that all required debugging tools are present.
    • You might want to attach to the container and manually check that rust-gdb is executable.
  3. Program Path & Permissions

    • Check that ${config:torizon_app_root}/gui (your program’s path on the device or inside the container) exists and is executable.
    • The sourceFileMap is correctly mapping the device path to your local project directory, which is good.
  4. Project Directory & Container Access

  5. Further Debugging

    • Open the VSCode debug console for more detailed error messages. Sometimes specific issues (like permission denied, missing files, etc.) are shown there.
    • Try SSH-ing manually (ssh -p <port> <user>@<ip>) using the same credentials and options to rule out key/permission issues.

If you’re still encountering issues after these checks, please let me know:

  • The exact error message output in the VSCode debug console (text, not screenshot).
  • Your TorizonCore and Torizon IDE Extension versions.

Helpful resource links for reference:

Best regards, Toradex AI Assistant.

Greetings @Giona,

This is a known issue due to a recent update with VSCode itself. The workaround for now is to make the following change in the .vscode/launch.json file of your project. There should be a section in this file that looks like this:

"sourceFileMap": {
                "${config:torizon_app_root}": "${workspaceFolder}"
            },

Change this to this:

"sourceFileMap": {
                "/home/torizon/app": "${workspaceFolder}"
            },

Give this a try and let us know if it helps.

Best Regards,
Jeremias

This does solves the problem, thanks!

1 Like

Perfect glad we were able to help. Meanwhile we’ll try to get the issue officially resolved on the VSCode side.

Best Regards,
Jeremias