Type: Debugger
Describe the bug
To Reproduce
Steps to reproduce the behavior:
Additional context
ps aux after closing VSCode:
mts 13588 0.0 0.0 113172 1484 ? S 11:16 0:00 bash /home/mts/.vscode/extensions/ms-vscode.cpptools-0.20.1/debugAdapters/OpenDebugAD7
mts 13598 0.3 0.6 784172 34832 ? Sl 11:16 0:00 /home/mts/.vscode/extensions/ms-vscode.cpptools-0.20.1/debugAdapters/mono.linux-x86_64 --config /home/mts/.vscode/extensions/ms-vscode.cpptools-0.
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "MyApp Launch",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "x64",
"program": "${workspaceRoot}/Debug/bin/MyApp",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb",
"setupCommands": [
{ "text": "-enable-pretty-printing", "description": "enable pretty printing", "ignoreFailures": true }
]
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{ "text": "-enable-pretty-printing", "description": "enable pretty printing", "ignoreFailures": true }
]
}
},
{
"name": "MyApp Attach",
"type": "cppdbg",
"request": "attach",
"program": "${workspaceRoot}/Debug/bin/MyApp ",
"processId": "${command:pickProcess}",
"linux": {
"MIMode": "gdb",
"setupCommands": [
{ "text": "-enable-pretty-printing", "description": "enable pretty printing", "ignoreFailures": true }
]
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb"
}
}
]
}
Do you see the same behavior as in #2787 ?
No really, because I don't get a reaction at all when starting the debugger.
Only reaction you see is the animated blue line moving.
@s-martin can you enable traceResponse and engineLogging and see what is sent to VS Code to start the connection and if gdb starts?
I'm having a similar issue.
To Reproduce
I'm attaching a zip with a small sample project: debug.zip
g++ -g main.cppAdditional context
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"logging": {
"traceResponse": true,
"engineLogging": true
},
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Debug Console with traceResponse and engineLogging enabled
--> E (output): {"event":"output","body":{"category":"console","output":"1: (203) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'\n"},"seq":2,"type":"event"}
1: (203) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (217) LaunchOptions ExePath='a.out'\n"},"seq":4,"type":"event"}
1: (217) LaunchOptions ExePath='a.out'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (217) LaunchOptions WorkingDirectory='/home/arman/temp/debug'\n"},"seq":6,"type":"event"}
1: (217) LaunchOptions WorkingDirectory='/home/arman/temp/debug'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (218) LaunchOptions ExeArguments=''\n"},"seq":8,"type":"event"}
1: (218) LaunchOptions ExeArguments=''
--> E (output): {"event":"output","body":{"category":"console","output":"1: (219) LaunchOptions MIMode='gdb'\n"},"seq":10,"type":"event"}
1: (219) LaunchOptions MIMode='gdb'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (220) LaunchOptions MIDebuggerPath=''\n"},"seq":12,"type":"event"}
1: (220) LaunchOptions MIDebuggerPath=''
--> E (output): {"event":"output","body":{"category":"console","output":"1: (220) LaunchOptions WaitDynamicLibLoad='false'\n"},"seq":14,"type":"event"}
1: (220) LaunchOptions WaitDynamicLibLoad='false'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (221) LaunchOptions ExternalConsole='true'\n"},"seq":16,"type":"event"}
1: (221) LaunchOptions ExternalConsole='true'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (221) LaunchOptions>\n"},"seq":18,"type":"event"}
1: (221) LaunchOptions>
--> E (output): {"event":"output","body":{"category":"console","output":"1: (221) LaunchOptions <SetupCommands>\n"},"seq":20,"type":"event"}
1: (221) LaunchOptions <SetupCommands>
--> E (output): {"event":"output","body":{"category":"console","output":"1: (222) LaunchOptions <Command IgnoreFailures='true' Description='Enable pretty-printing for gdb'>-enable-pretty-printing</Command>\n"},"seq":22,"type":"event"}
1: (222) LaunchOptions <Command IgnoreFailures='true' Description='Enable pretty-printing for gdb'>-enable-pretty-printing</Command>
--> E (output): {"event":"output","body":{"category":"console","output":"1: (222) LaunchOptions </SetupCommands>\n"},"seq":24,"type":"event"}
1: (222) LaunchOptions </SetupCommands>
--> E (output): {"event":"output","body":{"category":"console","output":"1: (223) LaunchOptions</LocalLaunchOptions>\n"},"seq":26,"type":"event"}
1: (223) LaunchOptions</LocalLaunchOptions>
--> E (output): {"event":"output","body":{"category":"console","output":"1: (423) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-1hghcoqj.8j0 ; cd /home/arman ; DbgTerm=`tty` ; set -o monitor ; trap 'rm /tmp/Microsoft-MIEngine-In-m2ew1sej.w5t /tmp/Microsoft-MIEngine-Out-4oxua2j5.2m8 /tmp/Microsoft-MIEngine-Pid-1hghcoqj.8j0 /tmp/Microsoft-MIEngine-Cmd-o7oubq09.0x0' EXIT ; /usr/bin/gdb --interpreter=mi --tty=$DbgTerm < /tmp/Microsoft-MIEngine-In-m2ew1sej.w5t > /tmp/Microsoft-MIEngine-Out-4oxua2j5.2m8 & clear; pid=$! ; echo $pid > /tmp/Microsoft-MIEngine-Pid-1hghcoqj.8j0 ; wait $pid; \n"},"seq":28,"type":"event"}
1: (423) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-1hghcoqj.8j0 ; cd /home/arman ; DbgTerm=`tty` ; set -o monitor ; trap 'rm /tmp/Microsoft-MIEngine-In-m2ew1sej.w5t /tmp/Microsoft-MIEngine-Out-4oxua2j5.2m8 /tmp/Microsoft-MIEngine-Pid-1hghcoqj.8j0 /tmp/Microsoft-MIEngine-Cmd-o7oubq09.0x0' EXIT ; /usr/bin/gdb --interpreter=mi --tty=$DbgTerm < /tmp/Microsoft-MIEngine-In-m2ew1sej.w5t > /tmp/Microsoft-MIEngine-Out-4oxua2j5.2m8 & clear; pid=$! ; echo $pid > /tmp/Microsoft-MIEngine-Pid-1hghcoqj.8j0 ; wait $pid;
--> C (runInTerminal-30): {"command":"runInTerminal","arguments":{"kind":"external","title":"cppdbg: a.out","cwd":"","args":["sh","/tmp/Microsoft-MIEngine-Cmd-o7oubq09.0x0"],"env":{}},"seq":30,"type":"request"}
--> E (output): {"event":"output","body":{"category":"console","output":"1: (443) Wait for connection completion.\n"},"seq":32,"type":"event"}
1: (443) Wait for connection completion.
Sorry for the weekend delay, but here's also my debug console.
as @yesenarman said, I also don't see any gdb processes, just the cpptools debug adapter.
--> E (output): {"event":"output","body":{"category":"console","output":"1: (398) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'\n"},"seq":2,"type":"event"}
1: (398) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (424) LaunchOptions ExePath='/home/myuser/myproj/Debug/bin/MyApp'\n"},"seq":4,"type":"event"}
1: (424) LaunchOptions ExePath='/home/myuser/myproj/Debug/bin/MyApp'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (425) LaunchOptions WorkingDirectory='/home/myuser/myproj'\n"},"seq":6,"type":"event"}
1: (425) LaunchOptions WorkingDirectory='/home/myuser/myproj'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (425) LaunchOptions TargetArchitecture='x64'\n"},"seq":8,"type":"event"}
1: (425) LaunchOptions TargetArchitecture='x64'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (425) LaunchOptions ExeArguments=''\n"},"seq":10,"type":"event"}
1: (425) LaunchOptions ExeArguments=''
--> E (output): {"event":"output","body":{"category":"console","output":"1: (426) LaunchOptions MIMode='gdb'\n"},"seq":12,"type":"event"}
1: (426) LaunchOptions MIMode='gdb'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (426) LaunchOptions MIDebuggerPath=''\n"},"seq":14,"type":"event"}
1: (426) LaunchOptions MIDebuggerPath=''
--> E (output): {"event":"output","body":{"category":"console","output":"1: (426) LaunchOptions WaitDynamicLibLoad='false'\n"},"seq":16,"type":"event"}
1: (426) LaunchOptions WaitDynamicLibLoad='false'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (426) LaunchOptions ExternalConsole='true'\n"},"seq":18,"type":"event"}
1: (426) LaunchOptions ExternalConsole='true'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (427) LaunchOptions>\n"},"seq":20,"type":"event"}
1: (427) LaunchOptions>
--> E (output): {"event":"output","body":{"category":"console","output":"1: (427) LaunchOptions <SetupCommands>\n"},"seq":22,"type":"event"}
1: (427) LaunchOptions <SetupCommands>
--> E (output): {"event":"output","body":{"category":"console","output":"1: (427) LaunchOptions <Command IgnoreFailures='true' Description='enable pretty printing'>-enable-pretty-printing</Command>\n"},"seq":24,"type":"event"}
1: (427) LaunchOptions <Command IgnoreFailures='true' Description='enable pretty printing'>-enable-pretty-printing</Command>
--> E (output): {"event":"output","body":{"category":"console","output":"1: (427) LaunchOptions </SetupCommands>\n"},"seq":26,"type":"event"}
1: (427) LaunchOptions </SetupCommands>
--> E (output): {"event":"output","body":{"category":"console","output":"1: (428) LaunchOptions</LocalLaunchOptions>\n"},"seq":28,"type":"event"}
1: (428) LaunchOptions</LocalLaunchOptions>
--> E (output): {"event":"output","body":{"category":"console","output":"1: (677) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-dgz9wks9.3xc ; cd /home/myuser/myproj/Debug/bin ; DbgTerm=`tty` ; set -o monitor ; trap 'rm /tmp/Microsoft-MIEngine-In-ak4e18mf.n1g /tmp/Microsoft-MIEngine-Out-4v5yxzvh.mji /tmp/Microsoft-MIEngine-Pid-dgz9wks9.3xc /tmp/Microsoft-MIEngine-Cmd-8javqqlo.qom' EXIT ; /opt/rh/devtoolset-7/root/usr/bin/gdb --interpreter=mi --tty=$DbgTerm < /tmp/Microsoft-MIEngine-In-ak4e18mf.n1g > /tmp/Microsoft-MIEngine-Out-4v5yxzvh.mji & clear; pid=$! ; echo $pid > /tmp/Microsoft-MIEngine-Pid-dgz9wks9.3xc ; wait $pid; \n"},"seq":30,"type":"event"}
1: (677) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-dgz9wks9.3xc ; cd /home/myuser/myproj/Debug/bin ; DbgTerm=`tty` ; set -o monitor ; trap 'rm /tmp/Microsoft-MIEngine-In-ak4e18mf.n1g /tmp/Microsoft-MIEngine-Out-4v5yxzvh.mji /tmp/Microsoft-MIEngine-Pid-dgz9wks9.3xc /tmp/Microsoft-MIEngine-Cmd-8javqqlo.qom' EXIT ; /opt/rh/devtoolset-7/root/usr/bin/gdb --interpreter=mi --tty=$DbgTerm < /tmp/Microsoft-MIEngine-In-ak4e18mf.n1g > /tmp/Microsoft-MIEngine-Out-4v5yxzvh.mji & clear; pid=$! ; echo $pid > /tmp/Microsoft-MIEngine-Pid-dgz9wks9.3xc ; wait $pid;
--> C (runInTerminal-32): {"command":"runInTerminal","arguments":{"kind":"external","title":"cppdbg: MyApp","cwd":"","args":["sh","/tmp/Microsoft-MIEngine-Cmd-8javqqlo.qom"],"env":{}},"seq":32,"type":"request"}
--> E (output): {"event":"output","body":{"category":"console","output":"1: (703) Wait for connection completion.\n"},"seq":34,"type":"event"}
1: (703) Wait for connection completion.
BTW: how can I go back to 0.19 for the moment?
@s-martin download the v0.19 VSIX and then use Extension: Install from VSIX command. Also make sure to disable extensions auto update in the settings.
@yesenarman: Thanks
OK, with 0.19.0 it works.
I tried 0.19.1-insiders3 also, which didn't worked with same behavior as in 0.20
With 0.19.0 I see the following lines:
mts 32218 0.0 0.0 113172 1480 ? S 14:03 0:00 bash /home/mts/.vscode/extensions/ms-vscode.cpptools-0.19.0/debugAdapters/OpenDebugAD7
mts 32228 9.8 0.8 850736 47936 ? Sl 14:03 0:01 /home/mts/.vscode/extensions/ms-vscode.cpptools-0.19.0/debugAdapters/mono.linux-x86_64 --config /home/mts/.vscode/extensions/ms-vscode.cpptools-0.
mts 32257 0.0 0.0 113176 1504 pts/2 Ss+ 14:04 0:00 bash -c echo $$ > /tmp/Microsoft-MIEngine-fifo-cboxg85b.lv6; cd /home/myuser/myproj/Debug/bin;
mts 32261 20.9 2.9 367848 165004 pts/2 S+ 14:04 0:02 /opt/rh/devtoolset-7/root/usr/bin/gdb --interpreter=mi --tty=/dev/pts/2
With 0.20 I see only the first 2 lines.
With our change, we write the debug command to a temp file, something similar to:
echo $$ > /tmp/Microsoft-MIEngine-Pid-dgz9wks9.3xc ; cd /home/myuser/myproj/Debug/bin ; DbgTerm=`tty` ; set -o monitor ; trap 'rm /tmp/Microsoft-MIEngine-In-ak4e18mf.n1g /tmp/Microsoft-MIEngine-Out-4v5yxzvh.mji /tmp/Microsoft-MIEngine-Pid-dgz9wks9.3xc /tmp/Microsoft-MIEngine-Cmd-8javqqlo.qom' EXIT ; /opt/rh/devtoolset-7/root/usr/bin/gdb --interpreter=mi --tty=$DbgTerm < /tmp/Microsoft-MIEngine-In-ak4e18mf.n1g > /tmp/Microsoft-MIEngine-Out-4v5yxzvh.mji & clear; pid=$! ; echo $pid > /tmp/Microsoft-MIEngine-Pid-dgz9wks9.3xc ; wait $pid;
then we send a command to VS Code through the protocol to run the command:
C (runInTerminal-32): {"command":"runInTerminal","arguments":{"kind":"external","title":"cppdbg: MyApp","cwd":"","args":["sh","/tmp/Microsoft-MIEngine-Cmd-8javqqlo.qom"],"env":{}},"seq":32,"type":"request"}
and then we wait for the fifos to be written to so we can start debugging.
In this instance, for some reason VS Code isn't able to launch debugging and I think that's what we need to figure out.
@pieandcakes If you need any additional info, please let me know
@s-martin Thanks. I just need time to setup a CentOS machine and figure out whats wrong with the command.
I am experiencing the same problem with C/C++ Extension Version: 0.20.1. My Linux system is my company's internal build of Kubuntu 16.04. I'm getting by on version 0.19.0 of the plugin for now.
Is there some planning available, when this could be fixed?
I use Arch Linux with Gnome. The same thing happened to me when I updated the extension, but debugger works fine as before using the integrated console.
Then I checked VSCode's setting and set the default terminal
"terminal.external.linuxExec": "xterm",
to
"terminal.external.linuxExec": "gnome-terminal",
and then debugger works well in both console.
Same problem here with antergos mate. Changing the terminal to mate-terminal did not work, and installing xterm did not work either.
@x0r13 can you let me know if you enable engineLogging if you get information and if so can you share it? Also, you say you are switching to mate-terminal do you see it start up in your process list?
@s-martin Can you see if changing the VS Code external terminal setting works for you?
@pieandcakes:
I just updated to 0.21 and the terminal was already set to "terminal.external.linuxExec": "gnome-terminal" and now it works again.
Thanks!
@pieandcakes engineLoggin is set to true. Output (line breaks added for better readability):
(229) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-y2a475s2.ped ; cd /home/x0r13/git/test ;
DbgTerm=`tty` ; set -o monitor ; trap 'rm /tmp/Microsoft-MIEngine-In-uqww6em7.pev /tmp/Microsoft-MIEngine-Out-ijwkjud2.uze /tmp/Microsoft-MIEngine-Pid-y2a475s2.ped /tmp/Microsoft-MIEngine-Cmd-u2al5244.l4i' EXIT ;
/usr/bin/gdb --interpreter=mi --tty=$DbgTerm < /tmp/Microsoft-MIEngine-In-uqww6em7.pev > /tmp/Microsoft-MIEngine-Out-ijwkjud2.uze & clear; pid=$! ;
echo $pid > /tmp/Microsoft-MIEngine-Pid-y2a475s2.ped ; wait $pid;
(250) Wait for connection completion.
mate-terminal process does not start when setting it via terminal.external.linuxExec
But since 0.21 it works when using xterm, which is good for now :)
@x0r13 Thats an unfortunate side effect of the terminal support. I'm wondering if what @therealkenc said in a different thread is true and that mate-terminal is just erroring out and VS Code isn't giving us good information. I'm going to consider this closed.
Thanks Everyone
Most helpful comment
No really, because I don't get a reaction at all when starting the debugger.
Only reaction you see is the animated blue line moving.