aboutsummaryrefslogtreecommitdiff
path: root/gdb/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/exec.c')
-rw-r--r--gdb/exec.c51
1 files changed, 41 insertions, 10 deletions
diff --git a/gdb/exec.c b/gdb/exec.c
index 906ae61..468f9f5 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -547,10 +547,23 @@ add_target_sections (void *owner,
table->sections[space + i].owner = owner;
}
+ scoped_restore_current_thread restore_thread;
+ program_space *curr_pspace = current_program_space;
+
/* If these are the first file sections we can provide memory
- from, push the file_stratum target. */
- if (!target_is_pushed (&exec_ops))
- push_target (&exec_ops);
+ from, push the file_stratum target. Must do this in all
+ inferiors sharing the program space. */
+ for (inferior *inf : all_inferiors ())
+ {
+ if (inf->pspace != curr_pspace)
+ continue;
+
+ if (inf->target_is_pushed (&exec_ops))
+ continue;
+
+ switch_to_inferior_no_thread (inf);
+ push_target (&exec_ops);
+ }
}
}
@@ -628,21 +641,39 @@ remove_target_sections (void *owner)
old_count = resize_section_table (table, dest - src);
/* If we don't have any more sections to read memory from,
- remove the file_stratum target from the stack. */
+ remove the file_stratum target from the stack of each
+ inferior sharing the program space. */
if (old_count + (dest - src) == 0)
{
- struct program_space *pspace;
+ scoped_restore_current_thread restore_thread;
+ program_space *curr_pspace = current_program_space;
+
+ for (inferior *inf : all_inferiors ())
+ {
+ if (inf->pspace != curr_pspace)
+ continue;
- ALL_PSPACES (pspace)
- if (pspace->target_sections.sections
- != pspace->target_sections.sections_end)
- return;
+ if (inf->pspace->target_sections.sections
+ != inf->pspace->target_sections.sections_end)
+ continue;
- unpush_target (&exec_ops);
+ switch_to_inferior_no_thread (inf);
+ unpush_target (&exec_ops);
+ }
}
}
}
+/* See exec.h. */
+
+void
+exec_on_vfork ()
+{
+ if (current_program_space->target_sections.sections
+ != current_program_space->target_sections.sections_end)
+ push_target (&exec_ops);
+}
+
enum target_xfer_status