diff options
author | Tom Tromey <tom@tromey.com> | 2021-11-29 17:56:56 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-04-12 09:31:16 -0600 |
commit | c600d77cb77d6eafc15ff6b1bb34c765e3b21bcc (patch) | |
tree | 1b6a03160095e7925223a5bf237b449444f7cffd /gdb/dwarf2/file-and-dir.h | |
parent | 85098eeb4c47debd67c793477bd04d33ab1a5645 (diff) | |
download | gdb-c600d77cb77d6eafc15ff6b1bb34c765e3b21bcc.zip gdb-c600d77cb77d6eafc15ff6b1bb34c765e3b21bcc.tar.gz gdb-c600d77cb77d6eafc15ff6b1bb34c765e3b21bcc.tar.bz2 |
Add "fullname" handling to file_and_directory
This changes the file_and_directory object to be able to compute and
cache the "fullname" in the same way that is done by other code, like
the psymtab reader.
Diffstat (limited to 'gdb/dwarf2/file-and-dir.h')
-rw-r--r-- | gdb/dwarf2/file-and-dir.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/dwarf2/file-and-dir.h b/gdb/dwarf2/file-and-dir.h index a392636..1113fe0 100644 --- a/gdb/dwarf2/file-and-dir.h +++ b/gdb/dwarf2/file-and-dir.h @@ -28,6 +28,7 @@ #define GDB_DWARF2_FILE_AND_DIR_H #include "objfiles.h" +#include "source.h" #include <string> /* The return type of find_file_and_directory. Note, the enclosed @@ -90,6 +91,20 @@ struct file_and_directory m_name = m_name_storage.get (); } + /* Return the full name, computing it if necessary. */ + const char *get_fullname () + { + if (m_fullname == nullptr) + m_fullname = find_source_or_rewrite (get_name (), get_comp_dir ()); + return m_fullname.get (); + } + + /* Forget the full name. */ + void forget_fullname () + { + m_fullname.reset (); + } + private: /* The filename. */ @@ -106,6 +121,9 @@ private: /* The compilation directory, if it needed to be allocated. */ std::string m_comp_dir_storage; + + /* The full name. */ + gdb::unique_xmalloc_ptr<char> m_fullname; }; #endif /* GDB_DWARF2_FILE_AND_DIR_H */ |