skip to Main Content

I recently switched to an ARM64 machine with the Snapdragon X Elite on Windows and I am trying to set up Visual Studio Code. Since MinGW-w64 with gcc and gdb isn’t available for ARM64, I’m using LLVM-Mingw (version 18.1.18).(I also tried MSVC but I just cannot get used to it).

The problem arises when I try to start lldb-mi from within VS Code. I encounter the following error (full output at the bottom of the question):

[Error] MI parsing error: CString not terminated: ""C:\Users\User_\Documents\Development\TestProject"
[Error] MI parsing error: Result expected: "path="C:\Users\User_\Documents\Development\TestProject"
[Error] MI parsing error: trailing chars: ""C:\Users\User_\Documents\Development\TestProject"

The Launch Configuration (launch.json):

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${command:cmake.launchTargetPath}",
            "showDisplayString": true,
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "logging": {
                "engineLogging": true
            },
            "externalConsole": true,
            "MIMode": "lldb"
        }
    ]
}

Debugging using only lldb directly via CLI works fine.
I also tried the vs code extension CodeLLDB but unfortunately that one is not available on ARM64 yet.

For anyone who would like to reproduce the problem.
The code is a simple Hello World program in C++ and CMake used:

cmake_minimum_required(VERSION 3.27)
project(TestProject)
set(CMAKE_BUILD_TYPE Debug)

add_executable(testProject ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)

target_link_libraries(  testProject)

Environment:

  • Visual Studio Code version: 1.91.0 (user setup)
  • Clang revision: 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff
  • LLVM revision: 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff

Any idea what I am missing?

Update based on Electro Organic’s suggestion:

I updated the launch.json with absolute path. I also move it into a path without an underscore, same issue persist. I also tried forward and double backwards slash, no change.
I checked with notepad++ for any hidden symbols but couldn’t find one either.

New launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "C:\Users\Public\TestProject\build\testProject.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "C:\Users\Public\TestProject",
            "logging": {
                "engineLogging": true
            },
            "externalConsole": false,
            "MIMode": "lldb",
            "miDebuggerPath": "C:\BuildTools\llvm-mingw-20240619-ucrt-aarch64\bin\lldb-mi.exe"
        }
    ]
}

Full Debug output:

1: (80) LaunchOptions{"name":"(lldb) Launch","type":"cppdbg","request":"launch","program":"C:\Users\User_\Documents\Development\TestProject\build\testProject.exe","showDisplayString":true,"args":[],"stopAtEntry":false,"cwd":"C:\Users\User_\Documents\Development\TestProject","logging":{"engineLogging":true},"externalConsole":true,"MIMode":"lldb","__configurationTarget":6,"__sessionId":"b05ff7d2-9d7c-4e88-96b2-79ee5c80f421","miDebuggerPath":null}
1: (131) Starting: "C:BuildToolsllvm-mingw-20240619-ucrt-aarch64binlldb-mi.exe" --interpreter=mi
1: (201) DebuggerPid=21952
1: (806) ->(gdb)
1: (816) <-1001-gdb-set auto-solib-add on
1: (816) ->1001^done
1: (817) ->(gdb)
1: (819) 1001: elapsed time 3
1: (820) <-1002-gdb-set solib-search-path "C:\Users\User_\Documents\Development\TestProject\build;"
1: (821) ->1002^done
1: (821) 1002: elapsed time 1
1: (821) <-1003-environment-cd C:\Users\User_\Documents\Development\TestProject
1: (821) ->(gdb)
1: (821) ->1003^done,path="C:\Users\User_\Documents\Development\TestProject
1: (821) ->"
1: (821) ->(gdb)
[Error] 1: (825) MI parsing error: CString not terminated: ""C:\Users\User_\Documents\Development\TestProject"
[Error] 1: (825) MI parsing error: Result expected: "path="C:\Users\User_\Documents\Development\TestProject"
[Error] 1: (825) MI parsing error: trailing chars: ""C:\Users\User_\Documents\Development\TestProject"
[Error] 1: (894) EXCEPTION:
[Error] 1: (895) EXCEPTION:    at MICore.MIResults.ParseResultList(Span listStr, ResultClass resultClass)
[Error] 1: (895) EXCEPTION:    at MICore.MIResults.ParseCommandOutput(String output)
[Error] 1: (895) EXCEPTION:    at MICore.Debugger.ProcessStdOutLine(String line)
[Error] 1: (895) EXCEPTION:    at Microsoft.MIDebugEngine.DebuggedProcess.<>c__DisplayClass96_0.<ScheduleStdOutProcessing>b__0()
[Error] 1: (895) EXCEPTION:    at Microsoft.MIDebugEngine.WorkerThread.ThreadFunc()
1: (897) Send Event AD7MessageEvent
[Error] 1: (898) MI parsing error: CString not terminated: """

2

Answers


  1. Chosen as BEST ANSWER

    I kind of solved the problem, while I was unable to find a solution to the original problem, I found out about lldb-dap (previously lldb-vscode) while researching. lldb-dap also allows to debug using vs code but via a different interface. That does the trick for me to be able to debug using vs code.

    I needed to install the lldb-dap extension and the following is my launch.json:

        {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "(lldb) Launch",
                "type": "lldb-dap",
                "request": "launch",
                "program": "${command:cmake.launchTargetPath}",
                "args": [],
                "cwd": "${workspaceFolder}",
    
            }
          ]
       }
    

    Thanks for everyone who tried to help.


  2. The issue you are encountering with LLDB-MI in VS Code appears to be related to how paths are being handled and parsed.

    Ensure that the paths and arguments are correctly specified in launch.json. Sometimes, escaping characters or improper path specifications can lead to parsing errors.

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "(lldb) Launch",
                "type": "cppdbg",
                "request": "launch",
                "program": "${command:cmake.launchTargetPath}",
                "args": [],
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}",
                "logging": {
                    "engineLogging": true
                },
                "externalConsole": false,
                "MIMode": "lldb",
                "miDebuggerPath": "C:\BuildTools\llvm-mingw-20240619-ucrt-aarch64\bin\lldb-mi.exe"
            }
        ]
    }
    

    If the issue persists, you can try setting the working directory (cwd) and other paths explicitly to avoid potential issues with escaping or formatting. Sometimes, relative paths can help in avoiding issues with backslashes in Windows paths.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search