diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2022-04-08 11:04:24 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2022-04-12 14:13:10 -0400 |
commit | ebd4e6d017f972cbba5d889310a09506bec4dbf4 (patch) | |
tree | 2e47ecb053ed664d330bc2b6a970436fbcdf284a /gdb/buildsym.h | |
parent | 71bc95ed2032567e2a7aebc3efe1c55a77abb7b2 (diff) | |
download | gdb-ebd4e6d017f972cbba5d889310a09506bec4dbf4.zip gdb-ebd4e6d017f972cbba5d889310a09506bec4dbf4.tar.gz gdb-ebd4e6d017f972cbba5d889310a09506bec4dbf4.tar.bz2 |
gdb: change subfile::name and buildsym_compunit::m_comp_dir to strings
Change subfile::name to be a string, for easier memory management.
Change buildsym_compunit::m_comp_dir as well, since we move one in to
the other at some point in patch_subfile_names, so it's easier to do
both at the same time. There are various NULL checks for both fields
currently, replace them with empty checks, I think it ends up
equivalent.
I can't test the change in xcoffread.c, it's best-effort.
Change-Id: I62b5fb08b2089e096768a090627ac7617e90a016
Diffstat (limited to 'gdb/buildsym.h')
-rw-r--r-- | gdb/buildsym.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 50ecd33..6284aaf 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -52,9 +52,7 @@ struct subfile DISABLE_COPY_AND_ASSIGN (subfile); struct subfile *next = nullptr; - - /* Space for this is malloc'd. */ - char *name = nullptr; + std::string name; /* Space for this is malloc'd. */ struct linetable *line_vector = nullptr; @@ -154,7 +152,7 @@ struct buildsym_compunit CORE_ADDR last_addr, struct compunit_symtab *cust) : m_objfile (objfile_), m_last_source_file (name == nullptr ? nullptr : xstrdup (name)), - m_comp_dir (comp_dir_ == nullptr ? nullptr : xstrdup (comp_dir_)), + m_comp_dir (comp_dir_ == nullptr ? "" : comp_dir_), m_compunit_symtab (cust), m_language (language_), m_last_source_start_addr (last_addr) @@ -342,7 +340,7 @@ private: gdb::unique_xmalloc_ptr<char> m_last_source_file; /* E.g., DW_AT_comp_dir if DWARF. Space for this is malloc'd. */ - gdb::unique_xmalloc_ptr<char> m_comp_dir; + std::string m_comp_dir; /* Space for this is not malloc'd, and is assumed to have at least the same lifetime as objfile. */ |