Currently, when GDB is debugging an attached inferior and the user does "quit", GDB is currently querying: (gdb) q The program is running. Quit anyway (and detach it)? (y or n) If you spawned a child instead of attaching, you get: (gdb) q The program is running. Quit anyway (and kill it)? (y or n) Now, if GDB is debugging multiple inferiors, say, inferior 1 was created by "target extended-remote", inferior 2 was created by a following "run", and inferior 3 was created by a further "attach", and you have inferior 3 currently selected, if you again do "quit", you still get the same: (gdb) q The program is running. Quit anyway (and detach it)? (y or n) But this time, if you answer "y", GDB will kill inferior 1, kill inferior 2, and, detach from inferior 3. There was no hint that GDB was going to kill two inferiors, which ends up being quite surprising. The attached patch changes GDB's output to something like: (gdb) q A debugging session is active. Inferior 1 [process 17555] will be killed. Do you still want to close the debugger? (y or n) Or: (gdb) q A debugging session is active. Inferior 1 [process 22005] will be detached. Do you still want to close the debugger? (y or n) Or in the multi-inferior case: (gdb) q A debugging session is active. Inferior 1 [process 22005] will be killed. Inferior 2 [process 22323] will be killed. Inferior 3 [process 22656] will be detached. Do you still want to close the debugger? (y or n) What do you think of something like that? Tested on x86-64-unknown-linux-gnu native and against gdbserver. -- Pedro Alves