aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-10-12 15:53:16 -0600
committerTom Tromey <tom@tromey.com>2020-10-12 20:18:48 -0600
commitd7a78e5c41c77ad32de668b0b2fde74deeb8190d (patch)
tree35ed23038ee62fb12689eeae60b5d45ac682eebd /gdb/target.c
parenteda214cec17472e7383b8aaf17f6a065b0be4a1e (diff)
downloadbinutils-d7a78e5c41c77ad32de668b0b2fde74deeb8190d.zip
binutils-d7a78e5c41c77ad32de668b0b2fde74deeb8190d.tar.gz
binutils-d7a78e5c41c77ad32de668b0b2fde74deeb8190d.tar.bz2
Change target_section_table to std::vector alias
Because target_section_table only holds a vector, and because it is used in an "open" way, this patch makes it just be an alias for the std::vector specialization. This makes the code less wordy. If we do ever want to add more specialized behavior to this type, it's simple enough to convert it back to a struct with the few needed methods implied by this change. gdb/ChangeLog 2020-10-12 Tom Tromey <tom@tromey.com> * target.h (struct target_ops) <get_section_table>: Update. (target_get_section_table): Update. * target.c (target_get_section_table, target_section_by_addr) (memory_xfer_partial_1): Update. * target-section.h (target_section_table): Now an alias. * target-delegates.c: Rebuild. * target-debug.h (target_debug_print_target_section_table_p): Rename from target_debug_print_struct_target_section_table_p. * symfile.c (build_section_addr_info_from_section_table): Update. * solib.c (solib_map_sections, solib_contains_address_p): Update. * solib-svr4.c (scan_dyntag): Update. * solib-dsbt.c (scan_dyntag): Update. * remote.c (remote_target::remote_xfer_live_readonly_partial): Update. * record-full.c (record_full_core_target::xfer_partial): Update. * progspace.h (struct program_space) <target_sections>: Update. * exec.h (print_section_info): Update. * exec.c (exec_target::close, build_section_table) (add_target_sections, add_target_sections_of_objfile) (remove_target_sections, exec_on_vfork) (section_table_available_memory) (section_table_xfer_memory_partial) (exec_target::get_section_table, exec_target::xfer_partial) (print_section_info, set_section_command) (exec_set_section_address, exec_target::has_memory): Update. * corelow.c (core_target::build_file_mappings) (core_target::xfer_partial, core_target::info_proc_mappings) (core_target::info_proc_mappings): Update. * bfd-target.c (class target_bfd): Update
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 0f3f745..531858a 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -812,7 +812,7 @@ target_read_string (CORE_ADDR memaddr, int len, int *bytes_read)
return gdb::unique_xmalloc_ptr<char> ((char *) buffer.release ());
}
-struct target_section_table *
+target_section_table *
target_get_section_table (struct target_ops *target)
{
return target->get_section_table ();
@@ -823,12 +823,12 @@ target_get_section_table (struct target_ops *target)
struct target_section *
target_section_by_addr (struct target_ops *target, CORE_ADDR addr)
{
- struct target_section_table *table = target_get_section_table (target);
+ target_section_table *table = target_get_section_table (target);
if (table == NULL)
return NULL;
- for (target_section &secp : table->sections)
+ for (target_section &secp : *table)
{
if (addr >= secp.addr && addr < secp.endaddr)
return &secp;
@@ -965,8 +965,7 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
if (pc_in_unmapped_range (memaddr, section))
{
- struct target_section_table *table
- = target_get_section_table (ops);
+ target_section_table *table = target_get_section_table (ops);
const char *section_name = section->the_bfd_section->name;
memaddr = overlay_mapped_address (memaddr, section);
@@ -986,13 +985,12 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
if (readbuf != NULL && trust_readonly)
{
struct target_section *secp;
- struct target_section_table *table;
secp = target_section_by_addr (ops, memaddr);
if (secp != NULL
&& (bfd_section_flags (secp->the_bfd_section) & SEC_READONLY))
{
- table = target_get_section_table (ops);
+ target_section_table *table = target_get_section_table (ops);
return section_table_xfer_memory_partial (readbuf, writebuf,
memaddr, len, xfered_len,
*table);