在VSCode中将gdb(C ++调试器)附加到远程python进程

时间:2019-07-26 01:41:52

标签: gdb vscode-debugger vscode-remote

我需要调试远程服务器上VSCode中Python模块调用的C ++库函数。

我正在使用VSCode Remote Development扩展,并且在远程服务器上的vscode中使用gdb调试C ++代码可以很好地工作,

我尝试了从终端启动附加到已暂停(等待输入)的python进程,以及使用vscode中使用python(远程)调试器启动的断点附加到python进程。

在两种情况下,我都使用以下launch.json配置附加到进程ID:

{
            "name": "GDB Attach proc 0",
            "type": "cppdbg",
            "request": "attach",
            "program": "/home/nfs/mharris/anaconda3/envs/cudf_dev/bin/python",
            "processId": "${command:pickProcess}",
            "linux": {
                "MIMode": "gdb",
                "setupCommands": [
                    {
                        "text": "-enable-pretty-printing",
                        "description": "enable pretty printing",
                        "ignoreFailures": true
                    },
                    {
                        "text": "handle SIGPIPE nostop noprint pass",
                        "description": "ignore SIGPIPE",
                        "ignoreFailures": true
                    }
                ]
            },
        },

它将在gdb终端窗口中显示以下内容:

==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/bin/gdb' as the super user
Authenticating as: aseadmin,,, (aseadmin)
Password: [1] + Stopped (tty output)       /usr/bin/pkexec /usr/bin/gdb --interpreter=mi --tty=${DbgTerm} 0</tmp/Microsoft-MIEngine-In-bydexniu.cf5 1>/tmp/Microsoft-MIEngine-Out-mo618uzc.30l
You have stopped jobs.

我相信aseadmin是服务器上的管理员用户。我不知道为什么它试图以超级用户身份运行gdb。我已使用VSCode远程服务器连接到远程服务器-使用ssh密钥身份验证的SSH(我的用户名不是aseadmin,所以我不确定为什么要使用它)。

我正在Ubuntu 16.04 LTS上运行带有远程开发扩展(0.15.0)的vscode-insider(版本:1.37.0-insider)。

0 个答案:

没有答案
相关问题