Vscode-cpptools: Use the VSCode debugConsole instead of externalConsole

Created on 29 Apr 2016  路  18Comments  路  Source: microsoft/vscode-cpptools

Thanks team for this pretty good extension.
It works on the latest Kubuntu 16.04; Vscode 1.1.0-insider

Will the xterm dependency be eliminated?

  • I'd rather pipe stdout/err to vscode's debug console, just like on gdb;
    (the Python extension does it)

Bug:

  • Redirecting a file as input source is currently not functional; e.g. by setting "args": [" < input.txt"], in launch.json
Feature Request debugger fixed (release pending)

Most helpful comment

Is there any progress on this? It would be very useful to have the option of using a file as the standard input.

All 18 comments

@makhtardiouf
Thanks for your input!

I believe that the VS code team is working on adding full terminal support to the editor. I've asked for an issue to direct you to, so that you can follow it.

Allright @delmyers , sounds good

@makhtardiouf fyi, the embedded terminal window is actively being worked on: https://github.com/Microsoft/vscode/issues/143

Is there any progress on this? It would be very useful to have the option of using a file as the standard input.

Hey just requesting an update since the last request was 10 months ago. Any progress on this?

Please don't ignore option "externalConsole": false

Any update on this issue?

I'd also like to know if there's any progress on this.

Workaround: Add this snippet to your launch.json and the internal terminal of VS Code will be used instead :joy:

"pipeTransport": {
    "pipeCwd": "/usr/bin",
    "pipeProgram": "/bin/sh",
    "debuggerPath": "/usr/bin/gdb",
    "pipeArgs": [
        "-c"
    ]
},

@Chemik , terminal won't appear if set "externalConsole": false, but stdout&stderr still won't redirect to integreted terminal in vsc.

Workaround: Add this snippet to your launch.json and the internal terminal of VS Code will be used instead

"pipeTransport": {
    "pipeCwd": "/usr/bin",
    "pipeProgram": "/bin/sh",
    "debuggerPath": "/usr/bin/gdb",
    "pipeArgs": [
        "-c"
    ]
},

@amtlib-dot-dll Coooool this works! Sadly it's not a perfect solution because you cannot use Ctrl+F to search something in DEBUG CONSOLE, can only in OUTPUT

To build off what @sean-mcmanus is saying, we added Integrated terminal Support for Linux and Windows in 0.19.1-insiders2 and would love to hear feedback about it. Unfortunately there is a limitation within lldb that prevents us from putting it on Mac at this time.

Just tested the 0.19.1-insiders2 vsix on Linux and it works, but I was hoping this would fix issue 1044 where the console disappears when the program ends - I guess this is expected behaviour but rather annoying when the stdout/stderr holds useful information. Any way to make it stick around?

I tested 0.19.1-insiders2 out on windows and noticed that when I restart the debugger 4 out of 5 times, the end of my debug output (some cout << lines) from the constructors that run at the very beginning of the program, printing some structure sizes, seems to get truncated sometimes. It smells like an output stream buffer isn't getting consistently flushed.

Expected output

C:\sbfs>cmd /C c:\Users\elhoffma\.vscode-insiders\extensions\ms-vscode.cpptools-0.19.1-insiders2\debugAdapters\bin\WindowsDebugLauncher.exe --stdin=Microsoft-MIEngine-In-cgiaazmu.0wl --stdout=Microsoft-MIEngine-Out-ptutj13n.j4a --stderr=Microsoft-MIEngine-Error-c3mb5k5f.wii --pid=Microsoft-MIEngine-Pid-4vckqvjk.o1w --dbgExe=C:\mingw64\bin\gdb.exe --interpreter=mi "
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
SBFS constructor, sizeof(imap): 4096
offsetof(sbfs::imap_, sectionInfo): 4
offsetof(sbfs::imap_, defectInfo): 68
offsetof(sbfs::imap_, id): 1108
offsetof(sbfs::imap_, statsInfo): 1120
offsetof(sbfs::imap_, map): 1212

Example truncated output, when I hit the problem

C:\sbfs>cmd /C c:\Users\elhoffma\.vscode-insiders\extensions\ms-vscode.cpptools-0.19.1-insiders2\debugAdapters\bin\WindowsDebugLauncher.exe --stdin=Microsoft-MIEngine-In-2bb5uipy.yaz --stdout=Microsoft-MIEngine-Out-im4zj1d2.opw --stderr=Microsoft-MIEngine-Error-jkegtt05.t2r --pid=Microsoft-MIEngine-Pid-v5pwzu0a.zl5 --dbgExe=C:\mingw64\bin\gdb.exe --interpreter=mi "
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
file_c::inode_: 4096
file_c::inode_::inodePayload_::extentArea_: 4028
file_c::inode_::inodePayload_::inlineDataBuf: 4028
offsetof(file_c::inode_, payload): 64
File constructor, sizeof(inode): 4096
f

@hoffmael The output is whatever is coming from the app. We have told it to redirect stdin and stdout of the app to the console, so what ever is showing comes from your app running on the framework it is running on.

@msemtd i'll see if I can remove the clear screen for the real release.. theres a lot of "goo" that we had to do to support the scenario that will show up, but I understand that keeping the text there is more important.

Workaround: Add this snippet to your launch.json and the internal terminal of VS Code will be used instead

"pipeTransport": {
    "pipeCwd": "/usr/bin",
    "pipeProgram": "/bin/sh",
    "debuggerPath": "/usr/bin/gdb",
    "pipeArgs": [
        "-c"
    ]
},

@amtlib-dot-dll Coooool this works! Sadly it's not a perfect solution because you cannot use Ctrl+F to search something in DEBUG CONSOLE, can only in OUTPUT

Hello,im wondering whats the meaning of "/usr/bin", "/bin/sh", "/usr/bin/gdb".would like to help me out? and i will really appreciate it.

Was this page helpful?
0 / 5 - 0 ratings