binutils-gdb/gdb/target-section.h
Tom Tromey d7a78e5c41 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
2020-10-12 20:18:48 -06:00

50 lines
1.6 KiB
C++

/* Target sections.
Copyright (C) 2020 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef GDB_TARGET_SECTION_H
#define GDB_TARGET_SECTION_H
/* Struct target_section maps address ranges to file sections. It is
mostly used with BFD files, but can be used without (e.g. for handling
raw disks, or files not in formats handled by BFD). */
struct target_section
{
/* Lowest address in section. */
CORE_ADDR addr;
/* Highest address in section, plus 1. */
CORE_ADDR endaddr;
/* The BFD section. */
struct bfd_section *the_bfd_section;
/* The "owner" of the section.
It can be any unique value. It is set by add_target_sections
and used by remove_target_sections.
For example, for executables it is a pointer to exec_bfd and
for shlibs it is the so_list pointer. */
void *owner;
};
/* Holds an array of target sections. */
using target_section_table = std::vector<target_section>;
#endif /* GDB_TARGET_SECTION_H */