microsoft / microsoft/vscode-cpptools

Linux LLDB cannot use integrated terminal

Open
#6,715 4 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debugger Feature Request
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

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 the Debug Console pane instead of the Terminal pane, and the Debug Console pane 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:

  1. Click the ‘Start Debugging’ or ‘Run Without Debugging’ menu items (I see no difference in their behaviour).
  2. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided main.c and launch.json using LLDB, comparing the integrated Terminal and Debug Console behavior. Start at the debugger configuration entry point for MIMode and externalConsole handling; done means LLDB debug output appears in the integrated terminal and the program accepts stdin there.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, vscode
Domain
desktop, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.