vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

[cppdbg] Integrated Terminal not working

Open ssinzdaryl opened this issue 3 years ago • 5 comments

Environment

  • OS and version: M1 macOS 13.0
  • VS Code: 1.73.0
  • C/C++ extension: v1.12.4

Bug Summary

Can't show output in integrated terminal instead of debug console, even if I set "avoidWindowsConsoleRedirection": to false.

want to know how to show the output in the integrated terminal? thanks a lot.

Debugger Configurations

// my launch.json file

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "C/C++: clang++ build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/output/${fileBasenameNoExtension}",
            "args": [],
            "cwd": "${workspaceFolder}",
            "environment": [],
            "MIMode": "lldb",
            "preLaunchTask": "C/C++: clang++ build active file",

            "avoidWindowsConsoleRedirection": false,
        }
    ]
}

ssinzdaryl avatar Nov 04 '22 08:11 ssinzdaryl

You will need to add "externalConsole": false, to not use an external console for output.

WardenGnaw avatar Nov 04 '22 22:11 WardenGnaw

You will need to add "externalConsole": false, to not use an external console for output.

I have tried this before, but it still show the output in the debug console, not the integrated console.

The attribute description of "externalConsole" says "If true, a console is launched for the debuggee. If false, on Linux and Windows, it will appear in the Integrated Console." , so maybe it is not work on macOS?

// my launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "C/C++: clang++ build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/output/${fileBasenameNoExtension}",
            "args": [],
            "cwd": "${workspaceFolder}",
            "environment": [],
            "MIMode": "lldb",
            "preLaunchTask": "C/C++: clang++ build active file",

            "avoidWindowsConsoleRedirection": false,
            "externalConsole": false,
        }
    ]
}
image

ssinzdaryl avatar Nov 06 '22 04:11 ssinzdaryl

Hey guys I encountered the same issue on a MacBook Pro with M1 Pro chip. Is there any workarounds about this? By the way, the integrated terminal runs flawlessly on both Linux and Windows. Is it some macOS safety measures messing about?

Charles-IX avatar Feb 20 '24 14:02 Charles-IX

I also encountered this today. It is curious that the description does not mention what happens on macOS and why it is so different; I am debugging a program that receives stdin and the only way to type that in is through an external terminal, which is annoying.

corwin-of-amber avatar Feb 22 '24 16:02 corwin-of-amber

@Charles-IX @corwin-of-amber

Hi, I found a workaround,

  1. Install a extension named CodeLLDB, a native debugger powered by LLDB.
  2. Modify the "type" property in the "launch.json", change "cppdbg" to "lldb".
  3. You will find some property in launch.json not allowed, remove them.

Then the output can show in integrated terminal.

// launch.json

{
    "configurations": [
        {
            "name": "C/C++: clang++ build and debug active file",
            "type": "lldb",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "cwd": "${fileDirname}",
            "preLaunchTask": "C/C++: clang++ build active file",
        }
    ],
    "version": "2.0.0"
}

ssinzdaryl avatar May 06 '24 10:05 ssinzdaryl