Get rid of "quit anyway" prompt using GDB: Just kill the process and quit

Solution 1:

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

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

Solution 2:

set confirm off

See gdb doc for details

Solution 3:

Another option is to define a new command that quits without asking for confirmation:

define qquit
  set confirm off
  quit
end
document qquit
Quit without asking for confirmation.
end

Now you can use qquit or just qq to exit quickly, without changing the default behaviour of quit

Solution 4:

In conclusion this will run the program directly and don't ask for quit confirmation:

gdb -ex="set confirm off" -ex=r --args ...