aboutsummaryrefslogtreecommitdiff
path: root/gdb/progspace.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2024-05-30 14:53:53 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2024-06-07 23:09:03 -0400
commit9ad8c5832d0092e1c02069b1189ec0ff59089957 (patch)
treefedbd77064a2a4522f6cb6d15e40d7399ba07875 /gdb/progspace.h
parent9102a6c15c756c55e77c0fa7deecfc58fa8a361e (diff)
downloadgdb-9ad8c5832d0092e1c02069b1189ec0ff59089957.zip
gdb-9ad8c5832d0092e1c02069b1189ec0ff59089957.tar.gz
gdb-9ad8c5832d0092e1c02069b1189ec0ff59089957.tar.bz2
gdb: make progspace::exec_filename private, add getter / setter
Just like the title says... I think this makes things a bit clearer, for instance where the exec filename is set. It also makes the read call sites a bit nicer, avoiding the `.get ()`. Change-Id: If8b58ae8f6270c8a34b868f6ca06128c6671ea3c Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/progspace.h')
-rw-r--r--gdb/progspace.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/gdb/progspace.h b/gdb/progspace.h
index bc24ef9..82c0a74 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -292,6 +292,15 @@ struct program_space
intrusive_list<solib> &solibs ()
{ return so_list; }
+ /* Similar to `bfd_get_filename (exec_bfd ())` but in original form given
+ by user, without symbolic links and pathname resolved. It is not nullptr
+ iff `exec_bfd ()` is not nullptr. */
+ const char *exec_filename () const
+ { return m_exec_filename.get (); }
+
+ void set_exec_filename (gdb::unique_xmalloc_ptr<char> filename)
+ { m_exec_filename = std::move (filename); }
+
/* Close and clear exec_bfd. If we end up with no target sections
to read memory from, this unpushes the exec_ops target. */
void exec_close ();
@@ -352,10 +361,6 @@ struct program_space
gdb_bfd_ref_ptr ebfd;
/* The last-modified time, from when the exec was brought in. */
long ebfd_mtime = 0;
- /* Similar to bfd_get_filename (exec_bfd) but in original form given
- by user, without symbolic links and pathname resolved. It is not
- NULL iff EBFD is not NULL. */
- gdb::unique_xmalloc_ptr<char> exec_filename;
/* Binary file diddling handle for the core file. */
gdb_bfd_ref_ptr cbfd;
@@ -414,6 +419,9 @@ private:
/* The set of target sections matching the sections mapped into
this program space. Managed by both exec_ops and solib.c. */
std::vector<target_section> m_target_sections;
+
+ /* See `exec_filename`. */
+ gdb::unique_xmalloc_ptr<char> m_exec_filename;
};
/* The list of all program spaces. There's always at least one. */