diff options
Diffstat (limited to 'gdb/exec.c')
-rw-r--r-- | gdb/exec.c | 63 |
1 files changed, 29 insertions, 34 deletions
@@ -75,7 +75,7 @@ struct exec_target final : public target_ops const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) override; - struct target_section_table *get_section_table () override; + target_section_table *get_section_table () override; void files_info () override; bool has_memory () override; @@ -183,7 +183,7 @@ exec_target::close () for (struct program_space *ss : program_spaces) { set_current_program_space (ss); - current_target_sections->sections.clear (); + current_target_sections->clear (); exec_close (); } } @@ -598,8 +598,8 @@ build_section_table (struct bfd *some_bfd) if (!(aflag & SEC_ALLOC)) continue; - table.sections.emplace_back (); - target_section § = table.sections.back (); + table.emplace_back (); + target_section § = table.back (); sect.owner = NULL; sect.the_bfd_section = asect; sect.addr = bfd_section_vma (asect); @@ -616,14 +616,14 @@ void add_target_sections (void *owner, const target_section_table §ions) { - struct target_section_table *table = current_target_sections; + target_section_table *table = current_target_sections; - if (!sections.sections.empty ()) + if (!sections.empty ()) { - for (const target_section &s : sections.sections) + for (const target_section &s : sections) { - table->sections.push_back (s); - table->sections.back ().owner = owner; + table->push_back (s); + table->back ().owner = owner; } scoped_restore_current_pspace_and_thread restore_pspace_thread; @@ -651,7 +651,7 @@ add_target_sections (void *owner, void add_target_sections_of_objfile (struct objfile *objfile) { - struct target_section_table *table = current_target_sections; + target_section_table *table = current_target_sections; struct obj_section *osect; gdb_assert (objfile != nullptr); @@ -662,8 +662,8 @@ add_target_sections_of_objfile (struct objfile *objfile) if (bfd_section_size (osect->the_bfd_section) == 0) continue; - table->sections.emplace_back (); - target_section &ts = table->sections.back (); + table->emplace_back (); + target_section &ts = table->back (); ts.addr = obj_section_addr (osect); ts.endaddr = obj_section_endaddr (osect); ts.the_bfd_section = osect->the_bfd_section; @@ -677,22 +677,22 @@ add_target_sections_of_objfile (struct objfile *objfile) void remove_target_sections (void *owner) { - struct target_section_table *table = current_target_sections; + target_section_table *table = current_target_sections; gdb_assert (owner != NULL); - auto it = std::remove_if (table->sections.begin (), - table->sections.end (), + auto it = std::remove_if (table->begin (), + table->end (), [&] (target_section §) { return sect.owner == owner; }); - table->sections.erase (it, table->sections.end ()); + table->erase (it, table->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->sections.empty ()) + if (table->empty ()) { scoped_restore_current_pspace_and_thread restore_pspace_thread; program_space *curr_pspace = current_program_space; @@ -702,7 +702,7 @@ remove_target_sections (void *owner) if (inf->pspace != curr_pspace) continue; - if (!inf->pspace->target_sections.sections.empty ()) + if (!inf->pspace->target_sections.empty ()) continue; switch_to_inferior_no_thread (inf); @@ -716,7 +716,7 @@ remove_target_sections (void *owner) void exec_on_vfork () { - if (!current_program_space->target_sections.sections.empty ()) + if (!current_program_space->target_sections.empty ()) push_target (&exec_ops); } @@ -779,7 +779,7 @@ section_table_available_memory (CORE_ADDR memaddr, ULONGEST len, { std::vector<mem_range> memory; - for (const target_section &p : sections.sections) + for (const target_section &p : sections) { if ((bfd_section_flags (p.the_bfd_section) & SEC_READONLY) == 0) continue; @@ -858,7 +858,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf, gdb_assert (len != 0); - for (const target_section &p : sections.sections) + for (const target_section &p : sections) { struct bfd_section *asect = p.the_bfd_section; bfd *abfd = asect->owner; @@ -918,7 +918,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf, return TARGET_XFER_EOF; /* We can't help. */ } -struct target_section_table * +target_section_table * exec_target::get_section_table () { return current_target_sections; @@ -930,7 +930,7 @@ exec_target::xfer_partial (enum target_object object, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) { - struct target_section_table *table = get_section_table (); + target_section_table *table = get_section_table (); if (object == TARGET_OBJECT_MEMORY) return section_table_xfer_memory_partial (readbuf, writebuf, @@ -942,7 +942,7 @@ exec_target::xfer_partial (enum target_object object, void -print_section_info (struct target_section_table *t, bfd *abfd) +print_section_info (target_section_table *t, bfd *abfd) { struct gdbarch *gdbarch = gdbarch_from_bfd (abfd); /* FIXME: 16 is not wide enough when gdbarch_addr_bit > 64. */ @@ -961,7 +961,7 @@ print_section_info (struct target_section_table *t, bfd *abfd) bfd_vma entry_point; bool found = false; - for (const target_section &p : t->sections) + for (const target_section &p : *t) { struct bfd_section *psect = p.the_bfd_section; @@ -989,7 +989,7 @@ print_section_info (struct target_section_table *t, bfd *abfd) printf_filtered (_("\tEntry point: %s\n"), paddress (gdbarch, entry_point)); } - for (const target_section &p : t->sections) + for (const target_section &p : *t) { struct bfd_section *psect = p.the_bfd_section; bfd *pbfd = psect->owner; @@ -1032,7 +1032,6 @@ set_section_command (const char *args, int from_tty) unsigned long secaddr; char secprint[100]; long offset; - struct target_section_table *table; if (args == 0) error (_("Must specify section name and its virtual address")); @@ -1044,8 +1043,7 @@ set_section_command (const char *args, int from_tty) /* Parse out new virtual address. */ secaddr = parse_and_eval_address (args); - table = current_target_sections; - for (target_section &p : table->sections) + for (target_section &p : *current_target_sections) { if (!strncmp (secname, bfd_section_name (p.the_bfd_section), seclen) && bfd_section_name (p.the_bfd_section)[seclen] == '\0') @@ -1071,10 +1069,7 @@ set_section_command (const char *args, int from_tty) void exec_set_section_address (const char *filename, int index, CORE_ADDR address) { - struct target_section_table *table; - - table = current_target_sections; - for (target_section &p : table->sections) + for (target_section &p : *current_target_sections) { if (filename_cmp (filename, bfd_get_filename (p.the_bfd_section->owner)) == 0 @@ -1091,7 +1086,7 @@ exec_target::has_memory () { /* We can provide memory if we have any file/target sections to read from. */ - return !current_target_sections->sections.empty (); + return !current_target_sections->empty (); } char * |