摆脱“无论如何都要退出"使用 GDB 提示:只需终止进程并退出 [英] Get rid of "quit anyway" prompt using GDB: Just kill the process and quit

查看:15
本文介绍了摆脱“无论如何都要退出"使用 GDB 提示:只需终止进程并退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑:

(gdb) q
A debugging session is active.

        Inferior 1 [process 9018] will be killed.

Quit anyway? (y or n) y

什么是 .gdbinit 选项可以让 GDB 在退出请求时总是终止正在运行的进程?

What is a .gdbinit option to make GDB always kill the running process at a quit request?

我知道 GDB 可以附加到已经运行的进程,所以在退出时杀死它们会很糟糕.但是对于从它开始的流程,需要确认您的操作会在第二次退出时开始烦人.

I know that GDB can attach to already-running processes, so it would be bad to kill them at quit. But for a processes started from it, a need to confirm your actions starts to annoy at a second quit.

推荐答案

关闭确认提示会全局禁用许多其他有用的检查,例如在键入delete"时询问您是否真的要删除所有断点.

Turning confirmation prompts off globally disabled many other useful checks, such as the one to ask you if you really want to delete all breakpoints when you type "delete".

最好只为退出命令禁用提示.您可以通过将这个钩子添加到您的 ~/.gdbinit(对于当前用户)或/etc/gdb/gdbinit(对于所有用户)来做到这一点:

It would be better to disable the prompt only for the quit command. You can do that by adding this hook to your ~/.gdbinit (for current user) or /etc/gdb/gdbinit (for all users):

define hook-quit
    set confirm off
end

这篇关于摆脱“无论如何都要退出"使用 GDB 提示:只需终止进程并退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆