I’m a simply a DSA solving student. and since Clion hog lots of RAM. I shifted to VSCode and I’m more intrested in Clang instead of gcc or g++ due to its fast compilation and better diagonstic ability compared to other compiler.
But now the issue I’m facing is after doing everything Installing Clang, LLDB, all the dependencies using MSYS2. and having perfect working CPP_configuration, Task.json and Launch.json. My LLDB is not working as intended for debugging. It does run till the command line execution and then stay there and when I stop I get the warning “LLDB coudln’t establish connection”.
For side note, LLDB, Clang, GDB, GCC, G++, Clang++, Clang-cl everthing is being detected by terminal so there is no issue like file is not found or something like that. but if you wanna look at erro of debugger here it it
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (63) LaunchOptions{"name":"C++ Launch (LLDB)","type":"cppdbg","request":"launch","program":"D:\\Learning\\Language_Tools_and_learning\\C++\\Coding Website\\Code Studio\\C++/sample.exe","args":[],"stopAtEntry":false,"cwd":"D:\\Learning\\Language_Tools_and_learning\\C++\\Coding Website\\Code Studio\\C++","environment":[],"externalConsole":false,"MIMode":"lldb","miDebuggerPath":"C:/Ruby33-x64/msys64/mingw64/bin/lldb.exe","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true}],"preLaunchTask":"clang++ build active file","logging":{"engineLogging":true,"traceResponse":true},"__configurationTarget":6,"configSource":"workspaceFolder","__sessionId":"ea28864c-f3be-4905-bd92-3957f020a557"}rn"},"seq":2}
1: (63) LaunchOptions{"name":"C++ Launch (LLDB)","type":"cppdbg","request":"launch","program":"D:\Learning\Language_Tools_and_learning\C++\Coding Website\Code Studio\C++/sample.exe","args":[],"stopAtEntry":false,"cwd":"D:\Learning\Language_Tools_and_learning\C++\Coding Website\Code Studio\C++","environment":[],"externalConsole":false,"MIMode":"lldb","miDebuggerPath":"C:/Ruby33-x64/msys64/mingw64/bin/lldb.exe","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true}],"preLaunchTask":"clang++ build active file","logging":{"engineLogging":true,"traceResponse":true},"__configurationTarget":6,"configSource":"workspaceFolder","__sessionId":"ea28864c-f3be-4905-bd92-3957f020a557"}
--> C (runInTerminal-4): {"type":"request","command":"runInTerminal","arguments":{"kind":"integrated","title":"cppdbg: sample.exe","cwd":"","args":["c:\Users\XYZ\.vscode\extensions\ms-vscode.cpptools-1.20.5-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe","--stdin=Microsoft-MIEngine-In-g25soy0c.szr","--stdout=Microsoft-MIEngine-Out-odu0gr4u.utr","--stderr=Microsoft-MIEngine-Error-kbey2c4r.wog","--pid=Microsoft-MIEngine-Pid-sswey23k.x0j","--dbgExe=C:/Ruby33-x64/msys64/mingw64/bin/lldb.exe","--interpreter=mi"],"env":{}},"seq":4}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (110) Wait for connection completion.rn"},"seq":6}
1: (110) Wait for connection completion.
--> E (output): {"type":"event","event":"output","body":{"category":"stderr","output":"rnrn"},"seq":8}
still here is Json files for refrence
Task.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "clang++ build active file",
"command": "C:/Ruby33-x64/msys64/mingw64/bin/clang++.exe",
"args": [
"-std=c++17",
"-g",
"${file}", // Ensure this points to your source file
"-o",
"${fileDirname}/${fileBasenameNoExtension}.exe" // Ensure this points to your output executable
],
"options": {
"cwd": "${workspaceFolder}" // Ensure this is correct
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (LLDB)",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"miDebuggerPath": "C:/Ruby33-x64/msys64/mingw64/bin/lldb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "clang++ build active file",
"logging": {
"engineLogging": true,
"traceResponse": true
}
}
]
}
CPP_configuration.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:/Ruby33-x64/msys64/mingw64/include/c++/14.1.0",
"C:/Ruby33-x64/msys64/mingw64/include/c++/14.1.0/x86_64-w64-mingw32",
"C:/Ruby33-x64/msys64/mingw64/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:/Ruby33-x64/msys64/mingw64/bin/clang++.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
Simply My code should be debugging and working and breakpoint should be visible in Run and Debug Section of VScode
8