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

Unexpected Additional Terminal Output

Open winduplock opened this issue 1 year ago • 5 comments

Environment

  • OS and version: windows 10.0.19045
  • VS Code: 1.95.3
  • C/C++ extension: 1.22.11
  • GDB / LLDB version: 14.1

Bug Summary and Steps to Reproduce

Bug Summary: When executing a C++ program, in addition to the regular comments that are properly highlighted, the terminal occasionally outputs unexpected strings. These unexpected strings interfere with the program’s intended output, leading to confusion. Below is an example output:

PS D:\NL> & 'c:\Users\me\.vscode\extensions\ms-vscode.cpptools-1.22.11-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-4hl3yf0d.as3' '--stdout=Microsoft-MIEngine-Out-rlow4555.xsz' '--stderr=Microsoft-MIEngine-Error-pioraos3.gvm' '--pid=Microsoft-MIEngine-Pid-chbaoneb.3ex' '--dbgExe=D:\msys64\ucrt64\bin\gdb.exe' '--interpreter=mi'

crosoft-MIEngine-Error-pioraos3.gvm' '--pid=Microsoft-MIEngine-Pid-chbaoneb.3ex' '--dbgExe=D:\x5cmsys64\x5cucrt64\x5cbin\x5cgdb.exe' '--interpreter=mi' ;96e10436-01ec-49c4-a7fa-b871c6e5d569Hello World

Debugger Configurations

task.json:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "D:\\msys64\\ucrt64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

launch.json:

{
    "configurations": [
        {
            "name": "C/C++: g++.exe build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "D:\\msys64\\ucrt64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe build active file"
        }
    ],
    "version": "2.0.0"
}

Debugger Logs

=thread-group-added,id="i1"
GNU gdb (GDB) 14.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
[New Thread 12760.0x194]
[New Thread 12760.0x1484]
[New Thread 12760.0x614]

Thread 1 hit Breakpoint 1, main () at D:\NL\CS\cpp\whiteBoard\helloworld\test.cpp:8
8	  cout << "Hello World" << endl;
Loaded 'C:\Windows\SYSTEM32\ntdll.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\kernel32.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\KernelBase.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\ucrtbase.dll'. Symbols loaded.
Loaded 'D:\msys64\ucrt64\bin\libstdc++-6.dll'. Symbols loaded.
Loaded 'D:\msys64\ucrt64\bin\libgcc_s_seh-1.dll'. Symbols loaded.
Loaded 'D:\msys64\ucrt64\bin\libwinpthread-1.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\advapi32.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\msvcrt.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\sechost.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\rpcrt4.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\bcrypt.dll'. Symbols loaded.
Loaded 'C:\Windows\SYSTEM32\cryptbase.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\bcryptprimitives.dll'. Symbols loaded.
[Thread 12760.0x614 exited with code 0]
[Thread 12760.0x1484 exited with code 0]
[Thread 12760.0x194 exited with code 0]
[Inferior 1 (process 12760) exited normally]
The program 'D:\NL\CS\cpp\whiteBoard\helloworld\test.exe' has exited with code 0 (0x00000000).

Other Extensions

No response

Additional Information

The issue appears inconsistently:

  1. Sometimes, the terminal does not show this abnormal output at all, and old abnormal output in the terminal disappears entirely.

  2. Other times, this abnormal output appears after the normal program output (e.g., "Hello World"). In such cases, the program output seems to overwrite portions of the abnormal output, like so:


PS D:\NL> & 'c:\Users\me\.vscode\extensions\ms-vscode.cpptools-1.22.11-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-4hl3yf0d.as3' '--stdout=Microsoft-MIEngine-Out-rlow4555.xsz' '--stderr=Microsoft-MIEngine-Error-pioraos3.gvm' '--pid=Microsoft-MIEngine-Pid-chbaoneb.3ex' '--dbgExe=D:\msys64\ucrt64\bin\gdb.exe' '--interpreter=mi'

Hello Worldngine-Error-pioraos3.gvm' '--pid=Microsoft-MIEngine-Pid-chbaoneb.3ex' '--dbgExe=D:\x5cmsys64\x5cucrt64\x5cbin\x5cgdb.exe' '--interpreter=mi' ;96e10436-01ec-49c4-a7fa-b871c6e5d569

winduplock avatar Dec 01 '24 01:12 winduplock

Same issue

URoyal avatar Dec 05 '24 09:12 URoyal

+1

std::cout << "\033[2J\033[H";

clearing terminal before output can temporarily fix it

mirrorb avatar Jan 13 '25 07:01 mirrorb

Same issue, and it seems to be a display bug because when I resize the display window all unexpected output disappear, it's quite strange

Nozomi-Kitauji avatar May 04 '25 18:05 Nozomi-Kitauji

I solve it by setting these two options both true or both false: 1.Integrated: Windows Enable Conpty 2.Integrated: Windows Use Conpty Dll

Nozomi-Kitauji avatar May 05 '25 07:05 Nozomi-Kitauji

I solve it by setting these two options both true or both false: 1.Integrated: Windows Enable Conpty 2.Integrated: Windows Use Conpty Dll

Same issue. This fixed it. Thanks.

mortavous avatar Jun 07 '25 17:06 mortavous

I solve it by setting these two options both true or both false: 1.Integrated: Windows Enable Conpty 2.Integrated: Windows Use Conpty Dll

Thanks much,and how you find it,.It takes me long time to fix it until find your answer.

dyingcowboy avatar Jun 23 '25 06:06 dyingcowboy

I solve it by setting these two options both true or both false: 1.Integrated: Windows Enable Conpty 2.Integrated: Windows Use Conpty Dll

Thanks much,and how you find it,.It takes me long time to fix it until find your answer.

I found that when I resize the display window all unexpected outputs disappear. I thought it might be a terminal rendering bug, so I checked the conpty options.

Nozomi-Kitauji avatar Aug 14 '25 11:08 Nozomi-Kitauji