aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-08-18 23:12:40 +0000
committerPedro Alves <palves@redhat.com>2008-08-18 23:12:40 +0000
commit87ab71f0a047c034c71d26d7c4ff4fa2b35b22cd (patch)
tree4c3483ad72a8489f300fe5037298600edca5ee1e /gdb/target.c
parent5231c1fd732d8cdb7ed92dd3e275ab4698a8052d (diff)
downloadgdb-87ab71f0a047c034c71d26d7c4ff4fa2b35b22cd.zip
gdb-87ab71f0a047c034c71d26d7c4ff4fa2b35b22cd.tar.gz
gdb-87ab71f0a047c034c71d26d7c4ff4fa2b35b22cd.tar.bz2
* corelow.c (core_open): Assume there was no upper layer left
behind from a previous inferior. * target.c (pop_all_targets): Rename to ... (pop_all_targets_above): ... this. Add a target stratum parameter. Use it instead of hardcoding the dummy_stratum. (pop_all_targets): New, defer to pop_all_targets_above. (target_preopen): Use pop_all_targets_above. * target.h (pop_all_targets_above): Declare.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 384fa20..681043e 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -822,9 +822,9 @@ pop_target (void)
}
void
-pop_all_targets (int quitting)
+pop_all_targets_above (enum strata above_stratum, int quitting)
{
- while ((int) (current_target.to_stratum) > (int) dummy_stratum)
+ while ((int) (current_target.to_stratum) > (int) above_stratum)
{
target_close (&current_target, quitting);
if (!unpush_target (target_stack))
@@ -839,6 +839,12 @@ pop_all_targets (int quitting)
}
}
+void
+pop_all_targets (int quitting)
+{
+ pop_all_targets_above (dummy_stratum, quitting);
+}
+
/* Using the objfile specified in OBJFILE, find the address for the
current thread's thread-local storage with offset OFFSET. */
CORE_ADDR
@@ -1778,9 +1784,9 @@ target_preopen (int from_tty)
/* Calling target_kill may remove the target from the stack. But if
it doesn't (which seems like a win for UDI), remove it now. */
-
- if (target_has_execution)
- pop_target ();
+ /* Leave the exec target, though. The user may be switching from a
+ live process to a core of the same program. */
+ pop_all_targets_above (file_stratum, 0);
target_pre_inferior (from_tty);
}