vscode-cpptools
vscode-cpptools copied to clipboard
Linux LLDB cannot use integrated terminal
Type: Debugger
Description
- OS and Version:
system: "x86_64-linux", multi-user?: yes, version: nix-env (Nix) 2.3.9, channels(twey): "home-manager", channels(root): "nixos-21.03pre257780.e9158eca70a", nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos - VS Code Version: 1.51.1 (also reproduced on 1.52 on macOS)
- C/C++ Extension Version: 1.1.3
- Other extensions you installed (and if the issue persists after disabling them): none
- A clear and concise description of what the bug is: when using
lldb, all debug output appears in theDebug Consolepane instead of theTerminalpane, and theDebug Consolepane does not support entering user input (stdin).
Reproduction
main.c:
#include <stdio.h>
int main(int argc, char ** argv) {
printf("Hello, world!\n");
char s[128];
int n = scanf("%s", s);
printf("\"%s\"\n", s);
}
launch.json (as generated, except to remove the path to lldb-mi, which is incorrect on my system):
{
"version": "0.2.0",
"configurations": [
{
"name": "clang - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: clang build active file"
}
]
}
Steps to reproduce the behaviour:
- Click the ‘Start Debugging’ or ‘Run Without Debugging’ menu items (I see no difference in their behaviour).
- Observe the ‘Terminal’ and ‘Debug Console’ panes.
Expected behaviour
Output from the program appears in the integrated terminal window, and I can type into the integrated terminal window to provide input to the program on stdin.
(This is the behaviour with GDB, if I just change "MIMode": "lldb" to "MIMode": "gdb")
Observed behaviour
All program output appears on the Debug Console, where it is written as an NSString literal:
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=thread-selected,id="1"
Loaded '/nix/store/9l06v7fc38c1x3r2iydl15ksgz0ysb82-glibc-2.32/lib/ld-2.32.so'. Symbols loaded.
Loaded '[vdso]'. Cannot find or open the symbol file.
Loaded '/tmp/hello/main'. Symbols loaded.
Loaded '/nix/store/9l06v7fc38c1x3r2iydl15ksgz0ysb82-glibc-2.32/lib/libc.so.6'. Symbols loaded.
@"Hello, world!\r\n"
Any attempt to provide input as I would were I running lldb directly (using -exec or by typing directly into the Debug Console command line) is met with:
Unable to perform this action because the process is running.
and thus there is no way for the user to provide stdin input to the program.
Possibly related issues: https://github.com/microsoft/vscode-cpptools/issues/5079 https://github.com/microsoft/vscode-cpptools/issues/3968 https://github.com/microsoft/vscode-cpptools/issues/5491
@WardenGnaw ?
At the moment, we do not have support for integrated terminal with Linux LLDB.
https://github.com/microsoft/MIEngine/blob/f3fafeb3dd1e7f50390d81e1348d1b29b31150b2/src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs#L765
I checked this way. It works for macOS. Just add new LLDB launch config. Perhaps this method will be useful for your linux OS.