+2004-01-05 Andrew Cagney <cagney@redhat.com>
+
+ * target.c (unpush_target): Only close a target that is in the
+ target stack.
+
2004-01-05 Mark Kettenis <kettenis@gnu.org>
* sparc-tdep.c (sparc_extract_struct_value_address): Get the
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. */
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);
(*cur) = (*cur)->beneath;