Repository navigation
Open
Labels
Description
Hello,
Firstly I would like to say thank you for this awesome text editor and the C/C++ extension :)
I tried debugging C/C++ program in Windows Subsystem for Linux. The debugging session works fine but the only problem is that VS Code won't open an external terminal so I could not get stdout and stdin from a terminal during the debugging session.
So I have two questions:
- How can I open an external terminal for WSL debugging?
- Even there is not external terminal, how to get output from
stdoutand input tostdinduring the debugging session?
Here is my launch.json, as you can see I set "externalConsole": true but an external terminal won't appear:
{
"name": "maze_solver",
"type": "cppdbg",
"request": "launch",
"program": "maze_solver",
"args": [],
"stopAtEntry": false,
"cwd": "./",
"environment": [],
"externalConsole": true,
"pipeTransport": {
"debuggerPath": "/usr/bin/gdb",
"pipeProgram": "C:\\Windows\\sysnative\\bash.exe",
"pipeArgs": ["-c"],
"pipeCwd": "${workspaceFolder}/simulation/maze_solver"
},
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"sourceFileMap": {
"/mnt/d": "d:\\"
},
"logging": { "engineLogging": true }
}Thank you very much!
Reacted by Tiago Correia, Mohammad Omidvar, David Burian, Matthew Tobolov, Bumsik Kim, Farhan Tahir, Nathan Mc Grath, cm-arai, Giacomo Bellini, Andrei Damian-Fekete and 8 more
Activity
pieandcakes commentedon Apr 5, 2018
Because it is a
pipecommunication, there isn't a way to do it currently.You can try and use an input file and an output file, but I don't think we have a solution for this yet.
kbumsik commentedon Apr 5, 2018
Thank you for the answer. So do you think there is no way to debug ELF-compiled program with an external terminal currently, I mean on Windows?
Spongman commentedon May 16, 2018
Is there a way to add this?
I'm trying to debug a program that uses console input, scrolling, cursor movement.
it's pretty much useless for this as it is.
ThePiyushGupta commentedon Aug 26, 2018
same problem here
youngspe commentedon Sep 13, 2018
As a workaround I was able to have the
ttyconfiguration in GDB point to the result ofttyin a separate bash terminal, have the terminalsleep infinity, and then start debugging. To make it a little quicker I set up a script to find the tty for a new terminal, create a symlink to it. In launch.json I set GDB'sttyconfiguration to that symlink and made the script my prelaunch task so as to not have to potentially change launch.json every time. But it feels like a hack, so it'd be nice to have a built-in way to do this.Alternately, start the process separately and attach the debugger to it, but I'm not sure if there's a way to have it break at the beginning of execution that way.
yalshekerchi commentedon Nov 11, 2018
Spencer Young (@youngspe) I'm interested in trying out your workaround, do u mind providing some more detailed information on how to set it up?
youngspe commentedon Nov 11, 2018
Yasir Al Shekerchi (@yalshekerchi)
It's a bit of a hack, I haven't touched it in a while, but here's my setup: https://github.com/youngspe/vscode-wsl-debug
giuliofoletto commentedon Feb 23, 2019
Same issue here. Seems to be kind of a basic feature. Hope to see it fixed in the near future.
buliuzi commentedon Mar 30, 2019
Same issue here.
ezineo commentedon Apr 19, 2019
Have it be solved?
vitorlana commentedon Oct 4, 2019
Same issue here
scratchmex commentedon Feb 11, 2020
Same here. When
"externalConsole": truethe debugger gets stuck.EDIT:
For those who want to activate the external console to be able to stream a file to stdin like
< in.txtand debug it, I've managed to do so including a piece of code.AnsonH commentedon Mar 30, 2020
Same issue here. Even when I tried to make g++ output an .exe file in tasks.json, the debugger still get stuck.
DrDinosaur commentedon Jul 5, 2020
I would like to see this added as well, running into this issue
andres-pcg commentedon Jul 22, 2020
I'm having same issue. I hope someone can pay attention to this some day. It's been two years and no answers so far
mikucukyilmaz commentedon Jan 31, 2021
Same issue here when debugging remote target from WSL.
lamarch commentedon Feb 25, 2021
Same issue here.
Lambda1107 commentedon Oct 31, 2021
Same issue here.
jaredtconnor commentedon Feb 23, 2022
+1 on this issue please.
trace1729 commentedon Oct 11, 2022
Same issue here
totszwai commentedon Feb 8, 2023
Please make this as high priority. Thank you!
sryio commentedon Apr 3, 2023
Same issue here
rindev0901 commentedon Jun 22, 2023
same issue here
datah4zard commentedon Aug 14, 2023
+1
jiangshuai1995 commentedon Dec 21, 2023
mac remote login to linux server to start debugging also has this problem