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



是否有办法从GDB Connnection退出而不停止/退出运行程序?我需要在GDB连接关闭后继续运行程序。

是否有一种方法可以从GDB连接中退出而不停止/退出运行程序?

(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.

由于被接受的(仅其他)答案没有专门解决如何在不停止测试的程序的情况下关闭GDB,我将帽子扔进了戒指。

选项1

通过持有Ctrl+c的终端杀死服务器。

选项2

从其他终端会话中杀死GDB服务器和/或客户端。

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

这些选项适用于Linux环境。类似的方法(杀死过程)也可能在Windows中起作用。

最新更新