This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch/rfc] Only unpush open targets
- From: Andrew Cagney <cagney at gnu dot org>
- To: gdb-patches at sources dot redhat dot com
- Date: Sat, 06 Dec 2003 23:52:35 -0500
- Subject: [patch/rfc] Only unpush open targets
Hello,
This patch modifies unpush_target() so that it will only close a target
that is "open". Closing a target multiple times, as kevin discovered,
can be a disaster. Testsuite shows no regressions.
baring comments, I'll commit in a few days,
Andrew
2003-12-06 Andrew Cagney <cagney@redhat.com>
* target.c (unpush_target): Only close a target that is in the
target stack.
Index: target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.67
diff -u -r1.67 target.c
--- target.c 23 Nov 2003 20:41:17 -0000 1.67
+++ target.c 7 Dec 2003 03:15:50 -0000
@@ -709,8 +709,6 @@
struct target_ops **cur;
struct target_ops *tmp;
- target_close (t, 0);
-
/* Look for the specified target. Note that we assume that a target
can only occur once in the target stack. */
@@ -722,6 +720,14 @@
if ((*cur) == NULL)
return 0; /* Didn't find target_ops, quit now */
+
+ /* NOTE: cagney/2003-12-06: In '94 the close call was made
+ unconditional by moving it to before the above check that the
+ target was in the target stack (something about "Change the way
+ pushing and popping of targets work to support target overlays
+ and inheritance"). This doesn't make much sense - only open
+ targets should be closed. */
+ target_close (t, 0);
/* Unchain the target */
tmp = (*cur);