X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fexec.c;h=468f9f57f76cceee2156f77887d58dcd0cb595fe;hb=5b6d1e4fa4fc6827c7b3f0e99ff120dfa14d65d2;hp=906ae616b0f79d0c2149a62960fe08be019f3904;hpb=75c6c844d9df37761e0e834df057b89e41816e55;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/exec.c b/gdb/exec.c index 906ae616b0..468f9f57f7 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