ubuntu GDB无法在附加的Visual Studio Docker上设置不允许的控制终端操作

o7jaxewo  于 8个月前  发布在  Docker
关注(0)|答案(1)|浏览(101)

我正试图用GDB调试器运行我的程序。当我运行它时,我得到一个警告:

GDB: Failed to set controlling terminal: Operation not permitted

字符串
我已经检查了一些stackoverflow questions,但是因为我运行的是visual studio,它连接到我的docker(远程容器),所以我无法应用一些建议。
当我在代码中尝试一个制动点时,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

nsc4cvqm

nsc4cvqm1#

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

相关问题