debugging 如何在不停止运行程序情况下关闭gdb连接

aij0ehis  于 2023-01-02  发布在  其他
关注(0)|答案(2)|浏览(117)

有没有方法可以在不停止/退出正在运行的程序的情况下退出gdb连接?我需要在gdb连接关闭后继续运行程序。

qyuhtwio

qyuhtwio1#

有没有办法在不停止/退出正在运行的程序的情况下退出gdb connection?

(gdb) help detach
Detach a process or file previously attached.
If a process, it is no longer traced, and it continues its execution.  If
you were debugging a file, the file is closed and gdb no longer accesses it.

List of detach subcommands:

detach checkpoint -- Detach from a checkpoint (experimental)
detach inferiors -- Detach from inferior ID (or list of IDS)

Type "help detach" followed by detach subcommand name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
7cjasjjr

7cjasjjr2#

我想在这里冒险一试,也许这不是最好的答案,但是因为公认的(唯一的)答案没有明确说明如何在不停止测试程序的情况下关闭gdb,下面是我能够完成它的方法。
这是针对Linux环境的。类似的方法(杀死进程)可能也适用于Windows。

$ ps -u username | grep gdb
 667511 pts/6    00:00:00 gdbserver
 667587 pts/7    00:00:00 gdbclient
$ kill 667587
$ kill 667511

相关问题