vadimcn / codelldb

A native debugger extension for VSCode based on LLDB
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
MIT License
2.51k stars 244 forks source link

launch.json "inputs" are not resolved in cargo invocation parameters #1041

Open fspoettel opened 9 months ago

fspoettel commented 9 months ago

OS: macOS 14.1.1 (23B81) VSCode version: 1.81.0 CodeLLDB version: v1.10.0 Compiler: rustc 1.74.0 (79e9716c9 2023-11-13) Debuggee: rust binary

Reproduction case: https://github.com/fspoettel/code-lldb-launch-inputs-repro

Description

I am trying to configure a launch.json to accept input variables for debugger invocations.

{
  "inputs": [
    {
      "id": "bin",
      "type": "promptString",
      "default": "example",
      "description": "Enter the bin name",
    }
  ],
  "configurations": [
    {
      "type": "lldb",
      "request": "launch",
      "name": "[Cargo] inputs do not work",
      "cargo": {
        "args": [
          "build",
          "--bin=${input:bin}"
        ]
      },
    },
  ]
}

This results in the debugger throwing an error and hanging:

Variable 'bin' must be defined in an 'input' section of the debug or task configuration.

Substituting the variable in the args value of a non-cargo program launch works without issues:

{
  "inputs": [
    {
      "id": "bin",
      "type": "promptString",
      "default": "example",
      "description": "Enter the bin name",
    }
  ],
  "configurations": [
    {
      "type": "lldb",
      "request": "launch",
      "name": "[standard] inputs do work",
      "program": "cargo",
      "args": [
        "run",
        "--bin=${input:bin}"
      ]
    }
  ]
}

this shows a prompt for the binary when run.

AlexanderProd commented 5 months ago

Same here on v1.10.0 of Codelldb.

VSCode: Version: 1.88.1 Commit: e170252f762678dec6ca2cc69aba1570769a5d39 Date: 2024-04-10T17:34:12.840Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Linux x64 6.5.0-27-generic

AlexanderProd commented 5 months ago

When I start it using

"program": "cargo",
"args": [
    "run",
    "--bin=${input:bin}"
]

It crashes shortly after startup, with a @_start file opening up. image