Vscode-cpptools: Debugging stuck when using with vscode remote development

Created on 4 May 2019  路  10Comments  路  Source: microsoft/vscode-cpptools

Type: Debugger
Input information below

Please review existing issues and our documentation at https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation prior to filing an issue.

Describe the bug

  • OS and Version: Local: OSX 10.14.3, Remote: Ubuntu 16.04.6 LTS
  • VS Code Version: 1.34.0
  • C/C++ Extension Version: 0.22.1
  • Other extensions you installed (and if the issue persists after disabling them):
  • A clear and concise description of what the bug is.

In $workspace folder, I have an a.out file compiled by gcc -g test.c
My debug configuration is as the following:
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}

To Reproduce
Please include a code sample and launch.json configuration.
Steps to reproduce the behavior:

  1. Go to launch.json and configure the file as aforementioned
  2. Click on '....'
  3. VSCode stuck

Additional context
If applicable, please include logging by adding "logging": { "engineLogging": true, "trace": true, "traceResponse": true } in your launch.json
Add any other context about the problem here including log or error messages in your Debug Console or Output windows.

debugger duplicate external

Most helpful comment

@litanlitudan With remote I don't know if changing that locally changes that on remote. That's a question for VSCode Team. Can you try and change externalConsole in your launch.json to false and see if that works?

All 10 comments

What happens when you enable logging?

Thanks for the response.
I just tried to investigate the logging, but nothing debug process related info showed up.
I guess it might be the issue that debugger cannot setup communication with c/cpp remote module.
However, for the normal intellisense, the logs do show up in the logging window.

For logging, I followed this instruction:
https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/Enabling%20logging.md

These are the logs
textDocument/hover: 4
textDocument/documentHighlight: 5
cpptools/textEditorSelectionChange
textDocument/codeAction: 6
textDocument/hover: 7
textDocument/hover: 8
textDocument/hover: 9
cpptools/textEditorSelectionChange
textDocument/codeAction: 10
cpptools/textEditorSelectionChange
textDocument/codeAction: 11
textDocument/hover: 12
textDocument/documentHighlight: 13
cpptools/textEditorSelectionChange
textDocument/codeAction: 14
cpptools/textEditorSelectionChange
textDocument/codeAction: 15
cpptools/textEditorSelectionChange
textDocument/codeAction: 16

The logging steps are here.

Thanks for correct me the logging process.
Here is the log:
--> E (output): {"event":"output","body":{"category":"console","output":"1: (135) LaunchOptions 1: (135) LaunchOptions --> E (output): {"event":"output","body":{"category":"console","output":"1: (143) LaunchOptions ExePath='/home/tanli/745-Project/workflow/a.out'\n"},"seq":4,"type":"event"}
1: (143) LaunchOptions ExePath='/home/tanli/745-Project/workflow/a.out'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (144) LaunchOptions WorkingDirectory='/home/tanli/745-Project/workflow'\n"},"seq":6,"type":"event"}
1: (144) LaunchOptions WorkingDirectory='/home/tanli/745-Project/workflow'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (144) LaunchOptions ExeArguments=''\n"},"seq":8,"type":"event"}
1: (144) LaunchOptions ExeArguments=''
--> E (output): {"event":"output","body":{"category":"console","output":"1: (144) LaunchOptions MIMode='gdb'\n"},"seq":10,"type":"event"}
1: (144) LaunchOptions MIMode='gdb'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (145) LaunchOptions MIDebuggerPath=''\n"},"seq":12,"type":"event"}
1: (145) LaunchOptions MIDebuggerPath=''
--> E (output): {"event":"output","body":{"category":"console","output":"1: (145) LaunchOptions WaitDynamicLibLoad='false'\n"},"seq":14,"type":"event"}
1: (145) LaunchOptions WaitDynamicLibLoad='false'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (145) LaunchOptions ExternalConsole='true'\n"},"seq":16,"type":"event"}
1: (145) LaunchOptions ExternalConsole='true'
--> E (output): {"event":"output","body":{"category":"console","output":"1: (145) LaunchOptions>\n"},"seq":18,"type":"event"}
1: (145) LaunchOptions>
--> E (output): {"event":"output","body":{"category":"console","output":"1: (146) LaunchOptions \n"},"seq":20,"type":"event"}
1: (146) LaunchOptions
--> E (output): {"event":"output","body":{"category":"console","output":"1: (146) LaunchOptions -enable-pretty-printing\n"},"seq":22,"type":"event"}
1: (146) LaunchOptions -enable-pretty-printing
--> E (output): {"event":"output","body":{"category":"console","output":"1: (146) LaunchOptions
\n"},"seq":24,"type":"event"}
1: (146) LaunchOptions

--> E (output): {"event":"output","body":{"category":"console","output":"1: (146) LaunchOptions
\n"},"seq":26,"type":"event"}
1: (146) LaunchOptions

--> E (output): {"event":"output","body":{"category":"console","output":"1: (252) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-psxtvcq1.5mh ; cd /home/tanli/745-Project/workflow ; DbgTerm=tty ; set -o monitor ; trap 'rm /tmp/Microsoft-MIEngine-In-8k0xwyb7.bch /tmp/Microsoft-MIEngine-Out-mb38ui50.drs /tmp/Microsoft-MIEngine-Pid-psxtvcq1.5mh /tmp/Microsoft-MIEngine-Cmd-xcw12o71.k5m' EXIT ; /usr/bin/gdb --interpreter=mi --tty=$DbgTerm < /tmp/Microsoft-MIEngine-In-8k0xwyb7.bch > /tmp/Microsoft-MIEngine-Out-mb38ui50.drs & clear; pid=$! ; echo $pid > /tmp/Microsoft-MIEngine-Pid-psxtvcq1.5mh ; wait $pid; \n"},"seq":28,"type":"event"}
1: (252) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-psxtvcq1.5mh ; cd /home/tanli/745-Project/workflow ; DbgTerm=tty ; set -o monitor ; trap 'rm /tmp/Microsoft-MIEngine-In-8k0xwyb7.bch /tmp/Microsoft-MIEngine-Out-mb38ui50.drs /tmp/Microsoft-MIEngine-Pid-psxtvcq1.5mh /tmp/Microsoft-MIEngine-Cmd-xcw12o71.k5m' EXIT ; /usr/bin/gdb --interpreter=mi --tty=$DbgTerm < /tmp/Microsoft-MIEngine-In-8k0xwyb7.bch > /tmp/Microsoft-MIEngine-Out-mb38ui50.drs & clear; pid=$! ; echo $pid > /tmp/Microsoft-MIEngine-Pid-psxtvcq1.5mh ; wait $pid;
--> C (runInTerminal-30): {"command":"runInTerminal","arguments":{"kind":"external","title":"cppdbg: a.out","cwd":"","args":["sh","/tmp/Microsoft-MIEngine-Cmd-xcw12o71.k5m"],"env":{}},"seq":30,"type":"request"}
--> E (output): {"event":"output","body":{"category":"console","output":"1: (274) Wait for connection completion.\n"},"seq":32,"type":"event"}
1: (274) Wait for connection completion.

@litanlitudan Thank you. This seems to be an issue with your console application not existing, that can be set in VS Code. Please refer to this to help you resolve it.

The overarching issue is a VS Code issue that doesn't error when launching terminal applications : https://github.com/Microsoft/vscode/issues/67296

@pieandcakes Thanks for the info. But it still doesn't work. Here is what I tried, maybe I am missing some step:

  1. check the terminal for external use, in this case, it's xterm.
    Screenshot 2019-05-07 15 31 24
  1. I checked that xterm is install on the remote server, which is true. But the duegger generate the same log.

  2. I also tried different console, such as gnome-terminal, terminator... none of them work.

  3. I also try to set up such configuration in the config.json for Remote, but vscode complains that such configuration is only configurable in user.settings.

@litanlitudan With remote I don't know if changing that locally changes that on remote. That's a question for VSCode Team. Can you try and change externalConsole in your launch.json to false and see if that works?

@pieandcakes Yeah, debugger works after changing externalConsole to false. Yeah, I guess that should be the issue for the remote module, not the c/c++ module. Also, c/c++ module works perfectly well with external console locally. What is the difference between using integrated console or external console? Is there any performance difference? Thanks for your help anyway!

There is no difference between integrated console and external console when debugging on Linux except that one is a separate window. With the fact that you are mixing two OSes I don't know what the problem is in your case unfortunately.

I'm going to close this for now.

Was this page helpful?
0 / 5 - 0 ratings