I am using Vagrant to launch a VM of Ubuntu and compile my C++ code in Linux. The Linux version is 5.8.0-59-generic.
The makefile build command is exec: main.o other_lib.o ${CXX} ${CXX_FLAGS} -lc++abi bin/main.o bin/other_lib.o -o bin/exec -g -fstandalone-debug. After running make exec and ./bin/exec, the program can successfully run. However the debugging part is bugged. This is the launch.json config for LLDB:
{
"name": "debug exec lldb",
"type": "cppdbg",
"request": "launch",
"program": "/home/vagrant/bin/exec",
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"miDebuggerPath": "/usr/bin/lldb-mi",
"preLaunchTask": "debug exec",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"text": "settings set target.run-args ${input:lldb-debugger-args}"
}
]
}
The first time I ran this debugging config using F5, vscode prompted miDebuggerPath invalid. I found that there was no /usr/bin/lldb-mi executable file in the system, so I ran sudo apt-get install lldb. This is where things get weird:
I tried to run the debugging process via VSCode, and there is no
miDebuggerPath invaliderror. However, after hittingF5, the terminal will output[1] + Done(127) "/usr/bin/lldb-mi" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-ly4ql3cx.s1b" 1>"/tmp/Microsoft-MIEngine-Out-gfkz1mbe.fex"and print a new prompt that listens for the next command. The hovering debug toolbar of VSCode appeared, but there is a constantly running progress bar (see below). The whole debug process is stuck.
Using
lsin/usr/bin/, thelldb-mifile appears red. Usingls -l /usr/bin/lldb-miindicates that it is a broken link, pointing to another broken linklldb-mi-11:
/usr/bin/lldbis an existing executable. Howeverlldb-miseems to be a "machine interface" oflldb, and I'm not sure if usinglldbas themiDebuggercan work.
How can I fix this problem (finding a substitution of lldb-mi or somehow fixing the broken link problem of lldb-mi)?