ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
- const target_section_table *get_section_table () override;
+ const std::vector<target_section> *get_section_table () override;
private:
/* The BFD we're wrapping. */
/* The section table build from the ALLOC sections in BFD. Note
that we can't rely on extracting the BFD from a random section in
the table, since the table can be legitimately empty. */
- target_section_table m_table;
+ std::vector<target_section> m_table;
};
target_xfer_status
}
}
-const target_section_table *
+const std::vector<target_section> *
target_bfd::get_section_table ()
{
return &m_table;
shared library bfds. The core bfd sections are an implementation
detail of the core target, just like ptrace is for unix child
targets. */
- target_section_table m_core_section_table;
+ std::vector<target_section> m_core_section_table;
/* File-backed address space mappings: some core files include
information about memory mapped files. */
- target_section_table m_core_file_mappings;
+ std::vector<target_section> m_core_file_mappings;
/* Unavailable mappings. These correspond to pathnames which either
weren't found or could not be opened. Knowing these addresses can
build_file_mappings ();
}
-/* Construct the target_section_table for file-backed mappings if
- they exist.
+/* Construct the table for file-backed mappings if they exist.
For each unique path in the note, we'll open a BFD with a bfd
target of "binary". This is an unstructured bfd target upon which
gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
}
- target_section_table sections
- = build_section_table (current_program_space->exec_bfd ());
+ std::vector<target_section> sections
+ = build_section_table (current_program_space->exec_bfd ());
current_program_space->ebfd_mtime
= bfd_get_mtime (current_program_space->exec_bfd ());
/* Builds a section table, given args BFD, TABLE. */
-target_section_table
+std::vector<target_section>
build_section_table (struct bfd *some_bfd)
{
- target_section_table table;
+ std::vector<target_section> table;
for (asection *asect : gdb_bfd_sections (some_bfd))
{
void
program_space::add_target_sections (const void *owner,
- const target_section_table §ions)
+ const std::vector<target_section> §ions)
{
if (!sections.empty ())
{
static std::vector<mem_range>
section_table_available_memory (CORE_ADDR memaddr, ULONGEST len,
- const target_section_table §ions)
+ const std::vector<target_section> §ions)
{
std::vector<mem_range> memory;
section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset,
ULONGEST len, ULONGEST *xfered_len)
{
- const target_section_table *table
+ const std::vector<target_section> *table
= target_get_section_table (current_inferior ()->top_target ());
std::vector<mem_range> available_memory
= section_table_available_memory (offset, len, *table);
section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len,
- const target_section_table §ions,
+ const std::vector<target_section> §ions,
gdb::function_view<bool
(const struct target_section *)> match_cb)
{
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
- const target_section_table *table = target_get_section_table (this);
+ const std::vector<target_section> *table = target_get_section_table (this);
if (object == TARGET_OBJECT_MEMORY)
return section_table_xfer_memory_partial (readbuf, writebuf,
\f
void
-print_section_info (const target_section_table *t, bfd *abfd)
+print_section_info (const std::vector<target_section> *t, bfd *abfd)
{
struct gdbarch *gdbarch = gdbarch_from_bfd (abfd);
/* FIXME: 16 is not wide enough when gdbarch_addr_bit > 64. */
/* Builds a section table, given args BFD. */
-extern target_section_table build_section_table (struct bfd *);
+extern std::vector<target_section> build_section_table (struct bfd *);
/* VFORK_CHILD is a child vforked and its program space is shared with its
parent. This pushes the exec target on that inferior's target stack if
section_table_xfer_memory_partial (gdb_byte *,
const gdb_byte *,
ULONGEST, ULONGEST, ULONGEST *,
- const target_section_table &,
+ const std::vector<target_section> &,
gdb::function_view<bool
(const struct target_section *)> match_cb
= nullptr);
special cased --- it's filename is omitted; if it is the executable
file, its entry point is printed. */
-extern void print_section_info (const target_section_table *table,
+extern void print_section_info (const std::vector<target_section> *table,
bfd *abfd);
/* Helper function that attempts to open the symbol file at EXEC_FILE_HOST.
{
bfd *abfd = nullptr;
int digits = 0;
- const target_section_table *table
+ const std::vector<target_section> *table
= target_get_section_table (current_inferior ()->top_target ());
if (table == nullptr)
return;
/* Add the sections array defined by SECTIONS to the
current set of target sections. */
void add_target_sections (const void *owner,
- const target_section_table §ions);
+ const std::vector<target_section> §ions);
/* Add the sections of OBJFILE to the current set of target
sections. They are given OBJFILE as the "owner". */
}
/* Return a reference to the M_TARGET_SECTIONS table. */
- target_section_table &target_sections ()
+ std::vector<target_section> &target_sections ()
{
return m_target_sections;
}
private:
/* The set of target sections matching the sections mapped into
this program space. Managed by both exec_ops and solib.c. */
- target_section_table m_target_sections;
+ std::vector<target_section> m_target_sections;
};
/* An address space. It is used for comparing if
/* Record buf with core target. */
static detached_regcache *record_full_core_regbuf = NULL;
-static target_section_table record_full_core_sections;
+static std::vector<target_section> record_full_core_sections;
static struct record_full_core_buf_entry *record_full_core_buf_list = NULL;
/* The following variables are used for managing the linked list that
{
ULONGEST memend = memaddr + len;
- const target_section_table *table = target_get_section_table (this);
+ const std::vector<target_section> *table
+ = target_get_section_table (this);
for (const target_section &p : *table)
{
if (memaddr >= p.addr)
strcpy (so.so_name, bfd_get_filename (so.abfd));
if (so.sections == nullptr)
- so.sections = new target_section_table;
+ so.sections = new std::vector<target_section>;
*so.sections = build_section_table (so.abfd);
for (target_section &p : *so.sections)
the file cannot be found or after the command "nosharedlibrary". */
struct objfile *objfile = nullptr;
- target_section_table *sections = nullptr;
+ std::vector<target_section> *sections = nullptr;
/* Record the range of addresses belonging to this shared library.
There may not be just one (e.g. if two segments are relocated
an existing section table. */
section_addr_info
-build_section_addr_info_from_section_table (const target_section_table &table)
+build_section_addr_info_from_section_table (const std::vector<target_section> &table)
{
section_addr_info sap;
existing section table. */
extern section_addr_info
- build_section_addr_info_from_section_table (const target_section_table &table);
+ build_section_addr_info_from_section_table (const std::vector<target_section> &table);
/* Variables */
target_debug_do_print (host_address_to_string (X))
#define target_debug_print_ui_file_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_const_target_section_table_p(X) \
- target_debug_do_print (host_address_to_string (X))
+#define target_debug_print_const_std_vector_target_section_p(X) \
+ target_debug_do_print (host_address_to_string (X->data ()))
#define target_debug_print_void_p(X) \
target_debug_do_print (host_address_to_string (X))
#define target_debug_print_find_memory_region_ftype(X) \
void rcmd (const char *arg0, struct ui_file *arg1) override;
const char *pid_to_exec_file (int arg0) override;
void log_command (const char *arg0) override;
- const target_section_table *get_section_table () override;
+ const std::vector<target_section> *get_section_table () override;
thread_control_capabilities get_thread_control_capabilities () override;
bool attach_no_wait () override;
bool can_async_p () override;
void rcmd (const char *arg0, struct ui_file *arg1) override;
const char *pid_to_exec_file (int arg0) override;
void log_command (const char *arg0) override;
- const target_section_table *get_section_table () override;
+ const std::vector<target_section> *get_section_table () override;
thread_control_capabilities get_thread_control_capabilities () override;
bool attach_no_wait () override;
bool can_async_p () override;
gdb_puts (")\n", gdb_stdlog);
}
-const target_section_table *
+const std::vector<target_section> *
target_ops::get_section_table ()
{
return this->beneath ()->get_section_table ();
}
-const target_section_table *
+const std::vector<target_section> *
dummy_target::get_section_table ()
{
return default_get_section_table ();
}
-const target_section_table *
+const std::vector<target_section> *
debug_target::get_section_table ()
{
gdb_printf (gdb_stdlog, "-> %s->get_section_table (...)\n", this->beneath ()->shortname ());
- const target_section_table * result
+ const std::vector<target_section> * result
= this->beneath ()->get_section_table ();
gdb_printf (gdb_stdlog, "<- %s->get_section_table (", this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
- target_debug_print_const_target_section_table_p (result);
+ target_debug_print_const_std_vector_target_section_p (result);
gdb_puts ("\n", gdb_stdlog);
return result;
}
const void *owner;
};
-/* Holds an array of target sections. */
-
-using target_section_table = std::vector<target_section>;
-
#endif /* GDB_TARGET_SECTION_H */
};
-const target_section_table *
+const std::vector<target_section> *
target_get_section_table (struct target_ops *target)
{
return target->get_section_table ();
const struct target_section *
target_section_by_addr (struct target_ops *target, CORE_ADDR addr)
{
- const target_section_table *table = target_get_section_table (target);
+ const std::vector<target_section> *table = target_get_section_table (target);
if (table == NULL)
return NULL;
/* See target.h. */
-const target_section_table *
+const std::vector<target_section> *
default_get_section_table ()
{
return ¤t_program_space->target_sections ();
if (pc_in_unmapped_range (memaddr, section))
{
- const target_section_table *table = target_get_section_table (ops);
+ const std::vector<target_section> *table = target_get_section_table (ops);
const char *section_name = section->the_bfd_section->name;
memaddr = overlay_mapped_address (memaddr, section);
if (secp != NULL
&& (bfd_section_flags (secp->the_bfd_section) & SEC_READONLY))
{
- const target_section_table *table = target_get_section_table (ops);
+ const std::vector<target_section> *table = target_get_section_table (ops);
return section_table_xfer_memory_partial (readbuf, writebuf,
memaddr, len, xfered_len,
*table);
TARGET_DEFAULT_RETURN (NULL);
virtual void log_command (const char *)
TARGET_DEFAULT_IGNORE ();
- virtual const target_section_table *get_section_table ()
+ virtual const std::vector<target_section> *get_section_table ()
TARGET_DEFAULT_RETURN (default_get_section_table ());
/* Provide default values for all "must have" methods. */
/* Return the target section table this target (or the targets
beneath) currently manipulate. */
-extern const target_section_table *target_get_section_table
+extern const std::vector<target_section> *target_get_section_table
(struct target_ops *target);
/* Default implementation of get_section_table for dummy_target. */
-extern const target_section_table *default_get_section_table ();
+extern const std::vector<target_section> *default_get_section_table ();
/* From mem-break.c */