aboutsummaryrefslogtreecommitdiff
path: root/gdb/progspace.h
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-02-12 12:06:15 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-02-24 16:58:04 +0000
commit02f7d26b0bc929eba44372fa0955bb1c72f2deb8 (patch)
tree6c374fb50907499dd222422acddab180d42b0237 /gdb/progspace.h
parentb91919ac8b5550451093f232a596dfe52a71536c (diff)
downloadfsf-binutils-gdb-02f7d26b0bc929eba44372fa0955bb1c72f2deb8.zip
fsf-binutils-gdb-02f7d26b0bc929eba44372fa0955bb1c72f2deb8.tar.gz
fsf-binutils-gdb-02f7d26b0bc929eba44372fa0955bb1c72f2deb8.tar.bz2
gdb: make the target_sections table private within program_space
Following on from earlier commits which made access to the target_sections table more 'const', this commit makes the table private within the program_space class and provides member functions to access the table. Ideally I would have liked for the new target_sections member function (on program_space) to return a 'const' reference to the table within the program_space. Unfortunately, there are two places in solib-*.c, where code outside of the program_space class modifies the target_sections table, and so to support this we need to return a non-const reference. There should be no user visible changes after this commit. gdb/ChangeLog: * exec.c (exec_target::close): Call new clear_target_sections function. (program_space::add_target_sections): Update name of member variable. (program_space::foreach_target_section): New function. (program_space::add_target_sections): Update name of member variable. (program_space::remove_target_sections): Likewise. (exec_one_fork): Use new target_sections member function. (exec_target::get_section_table): Likewise. (exec_target::files_info): Likewise. (set_section_command): Use new foreach_target_section member function. (exec_set_section_address): Likewise. (exec_target::has_memory): Use new target_sections member function. * progspace.h (program_space::clear_target_sections): New member function. (program_space::target_sections): Rename member variable to m_target_sections, replace with a new member function. (program_space::foreach_target_section): Declare new member function. (program_space::m_target_sections): New member variable. * solib-dsbt.c (scan_dyntag): Use new member function. * solib-svr4.c (scan_dyntag): Likewise.
Diffstat (limited to 'gdb/progspace.h')
-rw-r--r--gdb/progspace.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/gdb/progspace.h b/gdb/progspace.h
index 6ac8932..7906847 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -309,6 +309,18 @@ struct program_space
sections. They are given OBJFILE as the "owner". */
void add_target_sections (struct objfile *objfile);
+ /* Clear all target sections from M_TARGET_SECTIONS table. */
+ void clear_target_sections ()
+ {
+ m_target_sections.clear ();
+ }
+
+ /* Return a reference to the M_TARGET_SECTIONS table. */
+ target_section_table &target_sections ()
+ {
+ return m_target_sections;
+ }
+
/* Unique ID number. */
int num = 0;
@@ -359,10 +371,6 @@ struct program_space
/* All known objfiles are kept in a linked list. */
std::list<std::shared_ptr<objfile>> objfiles_list;
- /* The set of target sections matching the sections mapped into
- this program space. Managed by both exec_ops and solib.c. */
- target_section_table target_sections;
-
/* List of shared objects mapped into this space. Managed by
solib.c. */
struct so_list *so_list = NULL;
@@ -380,6 +388,11 @@ struct program_space
/* Per pspace data-pointers required by other GDB modules. */
REGISTRY_FIELDS {};
+
+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;
};
/* An address space. It is used for comparing if