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:40 -0600
commit3769e2277d352243fa0121d68efe31ae5edc10d5 (patch)
tree5ba00620cd4f327f0dc9261142099fa34d1f2843 /gdb/exec.c
parent2a3f84af539b4dc5473c44b0a01c1bcdfc7a1300 (diff)
downloadgdb-3769e2277d352243fa0121d68efe31ae5edc10d5.zip
gdb-3769e2277d352243fa0121d68efe31ae5edc10d5.tar.gz
gdb-3769e2277d352243fa0121d68efe31ae5edc10d5.tar.bz2
Change add_target_sections to method on program_space
This changes add_target_sections to be a method on program_space. Like the earlier change to remove_target_sections, this makes sense because this function is manipulating data that is stored on the program space. gdb/ChangeLog 2020-10-29 Tom Tromey <tom@tromey.com> * solib.c (solib_map_sections): Update. * exec.c (program_space::add_target_sections): Now a method. (exec_file_attach): Update. * exec.h (add_target_sections): Don't declare. * progspace.h (struct program_space) <add_target_sections>: Declare.
Diffstat (limited to 'gdb/exec.c')
-rw-r--r--gdb/exec.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/gdb/exec.c b/gdb/exec.c
index 49a4196..a57399b 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -497,7 +497,8 @@ exec_file_attach (const char *filename, int from_tty)
/* Add the executable's sections to the current address spaces'
list of sections. This possibly pushes the exec_ops
target. */
- add_target_sections (&current_program_space->ebfd, sections);
+ current_program_space->add_target_sections (&current_program_space->ebfd,
+ sections);
/* Tell display code (if any) about the changed file name. */
if (deprecated_exec_file_display_hook)
@@ -594,28 +595,25 @@ build_section_table (struct bfd *some_bfd)
current set of target sections. */
void
-add_target_sections (void *owner,
- const target_section_table &sections)
+program_space::add_target_sections (void *owner,
+ const target_section_table &sections)
{
- target_section_table *table = &current_program_space->target_sections;
-
if (!sections.empty ())
{
for (const target_section &s : sections)
{
- table->push_back (s);
- table->back ().owner = owner;
+ target_sections.push_back (s);
+ target_sections.back ().owner = owner;
}
scoped_restore_current_pspace_and_thread restore_pspace_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. Must do this in all
inferiors sharing the program space. */
for (inferior *inf : all_inferiors ())
{
- if (inf->pspace != curr_pspace)
+ if (inf->pspace != this)
continue;
if (inf->target_is_pushed (&exec_ops))