This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Fix quitting from GDB with a core target
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 3 Mar 2009 13:38:41 +0000
- Subject: Fix quitting from GDB with a core target
Ooops, Daniel pointed me out about this regression when quitting from gdb
while debugging a core file:
>./gdb foo -c ./core
(...)
(gdb) q
Quitting: You can't do that without a process to debug.
(gdb would quit anyway, but the error message shouldn't be there.)
I introduced this a few months ago when adding base support for
multi-process, then I posted a patch that fixes it mixed with
some output changes:
http://sourceware.org/ml/gdb-patches/2008-11/msg00291.html
... but I haven't checked that one in yet, mainly because I want
to check how emacs behaves with that on (I don't debug through emacs),
how a few targets will react that that change, and possibly also
tweak the remote.c's target_pid_to_str implementation.
In the mean time, I checked in this small patch that reintroduces
a target_has_execution check, that fixes the regression. Tested
on x86_64-linux.
--
Pedro Alves
2009-03-03 Pedro Alves <pedro@codesourcery.com>
* top.c (quit_target): Check for target_has_execution before
killing or detaching from inferiors.
---
gdb/top.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: src/gdb/top.c
===================================================================
--- src.orig/gdb/top.c 2009-03-03 12:59:46.000000000 +0000
+++ src/gdb/top.c 2009-03-03 13:34:45.000000000 +0000
@@ -1246,7 +1246,8 @@ quit_target (void *arg)
struct qt_args *qt = (struct qt_args *)arg;
/* Kill or detach all inferiors. */
- iterate_over_inferiors (kill_or_detach, qt);
+ if (target_has_execution)
+ iterate_over_inferiors (kill_or_detach, qt);
/* Give all pushed targets a chance to do minimal cleanup, and pop
them all out. */