aboutsummaryrefslogtreecommitdiff
path: root/gdb/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/exec.c')
-rw-r--r--gdb/exec.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/exec.c b/gdb/exec.c
index a2b2942..3091cda 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -113,10 +113,18 @@ exec_xclose_1 (struct target_ops *self)
{
struct program_space *ss;
struct cleanup *old_chain;
+ struct target_stack *tstack = target_stack_incref ();
+
+ old_chain = make_cleanup (target_stack_decref_cleanup, tstack);
+ save_current_program_space ();
- old_chain = save_current_program_space ();
ALL_PSPACES (ss)
{
+ /* Skip program spaces that are associated with some other
+ target. */
+ if (ss->target_stack != tstack)
+ continue;
+
set_current_program_space (ss);
clear_section_table (current_target_sections);
exec_close ();