aboutsummaryrefslogtreecommitdiff
path: root/gdb/exec.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-10-29 15:04:33 -0600
committerTom Tromey <tom@tromey.com>2020-10-29 15:04:39 -0600
commit2a3f84af539b4dc5473c44b0a01c1bcdfc7a1300 (patch)
tree480cc0467b823b8acc2d398f44e1125bb0edc746 /gdb/exec.c
parent004eecfdc7d9b47e8364719667c64edb22d12d44 (diff)
downloadgdb-2a3f84af539b4dc5473c44b0a01c1bcdfc7a1300.zip
gdb-2a3f84af539b4dc5473c44b0a01c1bcdfc7a1300.tar.gz
gdb-2a3f84af539b4dc5473c44b0a01c1bcdfc7a1300.tar.bz2
Change remove_target_sections to method on program_space
This changes remove_target_sections to be a method on program_space. This makes sense because this function manipulates data that is attached to the program space. gdb/ChangeLog 2020-10-29 Tom Tromey <tom@tromey.com> * progspace.h (struct program_space) <remove_target_sections>: Declare. * exec.c (program_space::remove_target_sections): Now a method. * exec.h (remove_target_sections): Don't declare.
Diffstat (limited to 'gdb/exec.c')
-rw-r--r--gdb/exec.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/gdb/exec.c b/gdb/exec.c
index 684f4df..49a4196 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -653,34 +653,28 @@ add_target_sections_of_objfile (struct objfile *objfile)
OWNER must be the same value passed to add_target_sections. */
void
-remove_target_sections (void *owner)
+program_space::remove_target_sections (void *owner)
{
- target_section_table *table = &current_program_space->target_sections;
-
gdb_assert (owner != NULL);
- auto it = std::remove_if (table->begin (),
- table->end (),
+ auto it = std::remove_if (target_sections.begin (),
+ target_sections.end (),
[&] (target_section &sect)
{
return sect.owner == owner;
});
- table->erase (it, table->end ());
+ target_sections.erase (it, target_sections.end ());
/* If we don't have any more sections to read memory from,
remove the file_stratum target from the stack of each
inferior sharing the program space. */
- if (table->empty ())
+ if (target_sections.empty ())
{
scoped_restore_current_pspace_and_thread restore_pspace_thread;
- program_space *curr_pspace = current_program_space;
for (inferior *inf : all_inferiors ())
{
- if (inf->pspace != curr_pspace)
- continue;
-
- if (!inf->pspace->target_sections.empty ())
+ if (inf->pspace != this)
continue;
switch_to_inferior_no_thread (inf);