Vscode-cpptools: "&"warning: GDB: Failed to set controlling terminal " in ubuntu 16.04

Created on 28 Sep 2016  ·  4Comments  ·  Source: microsoft/vscode-cpptools

I use VScode to debug C code in Ubuntu on gnome-termial, that's mean I add

"terminal": "",

to my launch.json

The problem is when I debug on the terminal, there are some strange things display:

&"warning: GDB: Failed to set controlling terminal: \344\270\215\345\205\201\350\256\270\347\232\204\346\223\215\344\275\234\n"

but my code run normally.

there are my launch.json

{
"version": "0.2.0",
"configurations": [
{
              "name": "Debug",
              "type": "gdb",
              "request": "launch",
              "target": "${file}.o",
              "cwd": "${workspaceRoot}",
              "terminal": "",
              "preLaunchTask": "gcc"  // c的话则是gcc
}
]
}

and my task.json

{
"version": "0.1.0",
"command": "gcc", // gcc
"args": ["-g", "${file}", "-o", "${file}.o"],
"showOutput": "never",
"problemMatcher": {
"owner": "c",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(._):(\d+):(\d+):\s+(warning|error):\s+(._)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}

debugger

Most helpful comment

The message "warning: GDB: Failed to set controlling terminal" is actually a long standing bug in gdb when the debuggee's output is redirected to a tty and is harmless. When using the terminal support, we attempt to remove this message by resetting the terminal as early as possible. GDB also has a number of bugs around the display of Unicode characters which can appear as a list of numbers as you reported above.

It isn't clear to me what you mean by setting "terminal" : "" as this is not a valid option in our launch.json AFAIK. "externalConsole":true is the how we control if the external console is displayed or not (but on Linux, that option is ignored, again due to bugs in gdb.

It is strange that we aren't clearing the terminal in your scenario. Which version of Ubuntu are you running?

All 4 comments

The message "warning: GDB: Failed to set controlling terminal" is actually a long standing bug in gdb when the debuggee's output is redirected to a tty and is harmless. When using the terminal support, we attempt to remove this message by resetting the terminal as early as possible. GDB also has a number of bugs around the display of Unicode characters which can appear as a list of numbers as you reported above.

It isn't clear to me what you mean by setting "terminal" : "" as this is not a valid option in our launch.json AFAIK. "externalConsole":true is the how we control if the external console is displayed or not (but on Linux, that option is ignored, again due to bugs in gdb.

It is strange that we aren't clearing the terminal in your scenario. Which version of Ubuntu are you running?

@ctuu It also looks like your launch.json is not in the format we expect. Can you delete the launch.json and recreate it from the Debug Configuration selector?

Oh, I find the reason...
I had install a extension named Native Debug, then I use it to debug not instead of cpptool.
Now I have recreated the launch.json by choose "C++ Launch", and the strange word disappeared!

@jacdavis Well, the setting "terminal" : "" is a vaild option in Native Debug...Sorry I mixed them. Thanks.
@pieandcakes I do as you say. Thanks.

I have a similar issue debugging in RedHat el7.x86_64, and I see in the GNOME DebuggerTerminal the same message: &"warning: GDB: Failed to set controlling terminal: Operation not permitted\n". But it also creates a file with name "2" and content "-e c 1"

Was this page helpful?
0 / 5 - 0 ratings