Skip to content

DebugMCP incorrectly infers .exe target on WSL instead of using existing launch.json program #70

@OfekiAlm

Description

@OfekiAlm

Environment

  • VS Code: 1.119.0
  • Platform: Linux (WSL / Dev Container)
  • Architecture: x64
  • DebugMCP server running successfully
  • C/C++ extension installed (ms-vscode.cpptools)
  • Debug adapter: cppdbg
  • Debugger: gdb

Problem

DebugMCP fails to start an existing C/C++ debug configuration on WSL/Linux.

Manual debugging with F5 works correctly using the existing launch.json.

However, when DebugMCP attempts to start the debug session, it appears to ignore or override the configured "program" field and instead derives a Windows-style executable name from the source file.

It attempts to launch:

/workspaces/ubuntu-c3c/nanopb/build-tests/legacy_cmake_simple/simple.exe

which does not exist.

The real executable is:

/workspaces/ubuntu-c3c/nanopb/build-tests/legacy_cmake_simple/build/simple

Existing launch.json

{
  "name": "Debug nanopb simple",
  "type": "cppdbg",
  "request": "launch",
  "program": "/workspaces/ubuntu-c3c/nanopb/build-tests/legacy_cmake_simple/build/simple",
  "cwd": "/workspaces/ubuntu-c3c/nanopb/build-tests/legacy_cmake_simple/build",
  "MIMode": "gdb",
  "miDebuggerPath": "/usr/bin/gdb"
}

Observed behavior

DebugMCP agent output references:

{
  "fileFullPath": "/workspaces/ubuntu-c3c/nanopb/build-tests/legacy_cmake_simple/simple.c",
  "workingDirectory": "/workspaces/ubuntu-c3c/nanopb/build-tests/legacy_cmake_simple",
  "configurationName": "Debug nanopb simple"
}

and then attempts to launch:

simple.exe

instead of using the configured "program" value from launch.json.

Expected behavior

DebugMCP should:

  1. Use the existing VS Code debug configuration exactly as defined
  2. Respect the "program" field from launch.json
  3. Avoid generating .exe targets on Linux/WSL environments
  4. Avoid inferring executables from source filenames when a valid launch configuration already exists

Additional notes

  • Starting the debug session manually with F5 works perfectly
  • Breakpoints work correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions