【发布时间】:2020-05-03 01:06:13
【问题描述】:
我正在尝试使用 Visual Studio Code 作为我在 Linux 上的 IDE 逐步执行 Postgresql 代码。我正在使用附加到 launch.json 中的进程配置来实现相同的目的。以下是 launch.json 配置:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "attach",
"program": "/usr/local/pgsql/bin/postgres",
"processId": 4165,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true,
}
]
}
]
}
当我通过 GUI 启动调试时,它会附加到进程。但是每当我添加断点时,我都会在调试控制台上打印以下消息:
Program received signal SIGINT, Interrupt.
0x00007ff5d084e31b in epoll_wait () from /lib64/libc.so.6
并且无法添加断点。从 Postgres 开发人员文档 (link) 中可以清楚地看出,我们需要通过向 gdb 发出以下命令来绕过到达 gdb 的中断:
handle SIGUSR1 noprint pass
我认为gdb中的这个命令只能在附加进程进行调试之前执行。因此,当我通过 Visual Studio Code 上的调试控制台运行此命令时,出现以下错误:
Unable to perform this action because the process is running.
有没有办法指示 Visual Studio Code 调试,在通过 gdb 附加目标进程之前向 gdb 发出“handle SIGUSR1 noprint pass”?
【问题讨论】:
标签: postgresql debugging visual-studio-code gdb interrupt