vadimcn / codelldb

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

Input command line args string not working as expected #1056

Open santiagocabrera96 opened 6 months ago

santiagocabrera96 commented 6 months ago

OS: macOS 14.0 VSCode version: 1.85.1 CodeLLDB version: 1.10.0 Compiler: zig 0.11.0

I want to debug a file that can handle two or three command line arguments.

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "Debug",
            "program": "${workspaceFolder}/zig-out/bin/${fileBasenameNoExtension}",
            "args": "${input:args}",
            "cwd": "${workspaceFolder}",
            "preLaunchTask": "build zig"
        }
    ],
    "inputs": [
        {
            "id": "args",
            "type": "promptString",
            "description": "args"
        }
    ]
}

When I'm prompted I write "1 2 3"

image

But, that resolves to a single parameter (argc is 2).

image

If I directly include the input in the config file it works as expected.

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "Debug",
            "program": "${workspaceFolder}/zig-out/bin/${fileBasenameNoExtension}",
            "args": "1 2 3",
            "cwd": "${workspaceFolder}",
            "preLaunchTask": "build zig"
        }
    ],
    "inputs": [
        {
            "id": "args",
            "type": "promptString",
            "description": "args"
        }
    ]
}
image

Now it says that argc is 4 as expected. And the first parameter is "1", not "1 2 3".

Verbose log case with issue
Initial debug configuration: {
  type: 'lldb',
  request: 'launch',
  name: 'Debug',
  program: '${workspaceFolder}/zig-out/bin/${fileBasenameNoExtension}',
  args: '${input:args}',
  cwd: '${workspaceFolder}',
  preLaunchTask: 'build zig',
  __configurationTarget: 6
}
Resolved debug configuration: {
  type: 'lldb',
  request: 'launch',
  name: 'Debug',
  program: '${workspaceFolder}/zig-out/bin/${fileBasenameNoExtension}',
  args: [ '${input:args}' ],
  cwd: '${workspaceFolder}',
  preLaunchTask: 'build zig',
  __configurationTarget: 6,
  relativePathBase: '/Users/santiago.cabrera/dev/zig/computer-enhance/part2',
  _adapterSettings: {
    displayFormat: 'auto',
    showDisassembly: 'auto',
    dereferencePointers: true,
    suppressMissingSourceFiles: true,
    evaluationTimeout: 5,
    consoleMode: 'commands',
    sourceLanguages: null,
    terminalPromptClear: null,
    evaluateForHovers: true,
    commandCompletions: true,
    reproducer: false
  }
}
Verbose log case without input request, but written in config
Initial debug configuration: {
  type: 'lldb',
  request: 'launch',
  name: 'Debug',
  program: '${workspaceFolder}/zig-out/bin/${fileBasenameNoExtension}',
  args: '1 2 3',
  cwd: '${workspaceFolder}',
  preLaunchTask: 'build zig',
  __configurationTarget: 6
}
Resolved debug configuration: {
  type: 'lldb',
  request: 'launch',
  name: 'Debug',
  program: '${workspaceFolder}/zig-out/bin/${fileBasenameNoExtension}',
  args: [ '1', '2', '3' ],
  cwd: '${workspaceFolder}',
  preLaunchTask: 'build zig',
  __configurationTarget: 6,
  relativePathBase: '/Users/santiago.cabrera/dev/zig/computer-enhance/part2',
  _adapterSettings: {
    displayFormat: 'auto',
    showDisassembly: 'auto',
    dereferencePointers: true,
    suppressMissingSourceFiles: true,
    evaluationTimeout: 5,
    consoleMode: 'commands',
    sourceLanguages: null,
    terminalPromptClear: null,
    evaluateForHovers: true,
    commandCompletions: true,
    reproducer: false
  }
}
Jordan-Haidee commented 5 months ago

Me, too. But my lang is Rust.🤡