diff options
author | Tom Tromey <tom@tromey.com> | 2020-10-12 15:53:16 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-10-12 20:18:47 -0600 |
commit | bb2a67773c5e06545c39a6373be720c7d3d9eeb5 (patch) | |
tree | 2745316e9eb79ec610ed9e9950d56323be0bbf7d /gdb/target.c | |
parent | 7b466b10241f3971ab628ace1e75cf1166209af5 (diff) | |
download | gdb-bb2a67773c5e06545c39a6373be720c7d3d9eeb5.zip gdb-bb2a67773c5e06545c39a6373be720c7d3d9eeb5.tar.gz gdb-bb2a67773c5e06545c39a6373be720c7d3d9eeb5.tar.bz2 |
Use a std::vector in target_section_table
This changes target_section_table to wrap a std::vector. This
simplifies some code, and also enables the simplifications coming in
the subsequent patches.
Note that for solib, I chose to have it use a pointer to a
target_section_table. This is more convoluted than would be ideal,
but I didn't want to convert solib to new/delete as a prerequisite for
this series.
gdb/ChangeLog
2020-10-12 Tom Tromey <tom@tromey.com>
* target.c (target_section_by_addr, memory_xfer_partial_1):
Update.
* target-section.h (struct target_section_table): Use
std::vector.
* symfile.h (build_section_addr_info_from_section_table): Take a
target_section_table.
* symfile.c (build_section_addr_info_from_section_table): Take a
target_section_table.
* solist.h (struct so_list) <sections>: Change type.
<sections_end>: Remove.
* solib.c (solib_map_sections, clear_so, solib_read_symbols)
(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_start, record_full_core_end):
Remove.
(record_full_core_sections): New global.
(record_full_core_open_1, record_full_core_target::xfer_partial):
Update.
* exec.h (build_section_table, section_table_xfer_memory_partial)
(add_target_sections): Take a target_section_table.
* exec.c (exec_file_attach, clear_section_table): Update.
(resize_section_table): Remove.
(build_section_table, add_target_sections): Take a
target_section_table.
(add_target_sections_of_objfile, remove_target_sections)
(exec_on_vfork): Update.
(section_table_available_memory): Take a target_section_table.
(section_table_read_available_memory): Update.
(section_table_xfer_memory_partial): Take a target_section_table.
(print_section_info, set_section_command)
(exec_set_section_address, exec_target::has_memory): Update.
* corelow.c (class core_target) <m_core_section_table,
m_core_file_mappings>: Remove braces.
<~core_target>: Remove.
(core_target::core_target): Update.
(core_target::~core_target): Remove.
(core_target::build_file_mappings)
(core_target::xfer_memory_via_mappings)
(core_target::xfer_partial, core_target::info_proc_mappings):
Update.
* bfd-target.c (target_bfd::xfer_partial): Update.
(target_bfd::target_bfd): Update.
(target_bfd::~target_bfd): Remove.
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/gdb/target.c b/gdb/target.c index 6fd60a1..0f3f745 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -824,15 +824,14 @@ struct target_section * target_section_by_addr (struct target_ops *target, CORE_ADDR addr) { struct target_section_table *table = target_get_section_table (target); - struct target_section *secp; if (table == NULL) return NULL; - for (secp = table->sections; secp < table->sections_end; secp++) + for (target_section &secp : table->sections) { - if (addr >= secp->addr && addr < secp->endaddr) - return secp; + if (addr >= secp.addr && addr < secp.endaddr) + return &secp; } return NULL; } @@ -979,9 +978,7 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object, return section_table_xfer_memory_partial (readbuf, writebuf, memaddr, len, xfered_len, - table->sections, - table->sections_end, - match_cb); + *table, match_cb); } } @@ -998,8 +995,7 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object, table = target_get_section_table (ops); return section_table_xfer_memory_partial (readbuf, writebuf, memaddr, len, xfered_len, - table->sections, - table->sections_end); + *table); } } |