GDB无法在附加的visual studio docker上设置不允许的控制终端操作



我正在尝试使用GDB调试器运行我的程序。当我运行它时,我会收到一个警告:

GDB: Failed to set controlling terminal: Operation not permitted

这个警告在我的终端中出现和消失得很快。我已经检查了一些stackerflow问题,但由于我正在运行连接到我的docker(远程容器(的visual studio,我无法应用一些建议。

当我在代码中尝试制动点时,GDB不起作用,程序执行时忽略GDB。

我的lauch.json配置:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/words",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

我运行程序的dockerfile配置:

FROM ubuntu:18.04
SHELL ["/bin/bash", "-c"]
RUN apt-get -y update
RUN apt-get install -y Linux-headers-generic build-essential gdb
COPY . /ejercicio

检查您的代码实际上是通过调试构建的。根据经验(在Linux中(,如果您没有任何符号,GDB可能会在VS代码会话期间导致此错误。即向所有编译和链接语句添加-g命令行选项。

最新更新