diff options
author | Pavel Labath <pavel@labath.sk> | 2019-08-05 09:55:07 +0000 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2019-08-05 09:55:07 +0000 |
commit | bfb261baca3f486a4f70786794ff30baafc6deea (patch) | |
tree | f8232ad28328bc004ddf0eebfdfae0a9eef854d3 /lldb/source/Plugins/ObjectFile | |
parent | ab4a5d14b5822a43f1add78851bd34606f0e3f44 (diff) | |
download | bcm5719-llvm-bfb261baca3f486a4f70786794ff30baafc6deea.tar.gz bcm5719-llvm-bfb261baca3f486a4f70786794ff30baafc6deea.zip |
ObjectFile[ELF]: Refactor gnu_debuglink interface
Summary:
The contents of the gnu_debuglink section were passed through the
GetDebugSymbolFilePaths interface, which was more generic than needed.
As the only class implementing this function is ObjectFileELF, we can
modify the function to return just a single FileSpec (instead of a
list). Also, since the SymbolVendorELF already assumes ELF object files,
we don't have to make this method available on the generic ObjectFile
interface -- instead we can put it on ObjectFileELF directly.
This change also makes is so that if the Module has an explicit symbol
file spec set, we disregard the value the value of the debug link
(instead of doing a secondary lookup using that). I think it makes sense
to honor the users wishes if he had explicitly set the symbol file spec,
and this seems to be consistent with what SymbolVendorMacOSX is doing
(SymbolVendorMacOSX.cpp:125).
The main reason for making these changes is to make the treatment of
build-ids and debug links simpler in the follow-up patch.
Reviewers: clayborg, jankratochvil, mgorny, espindola
Subscribers: emaste, arichardson, MaskRay, lldb-commits
Differential Revision: https://reviews.llvm.org/D65560
llvm-svn: 367824
Diffstat (limited to 'lldb/source/Plugins/ObjectFile')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h | 2 | ||||
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h | 4 |
3 files changed, 7 insertions, 11 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h index 2ce6a343cf0..cb4bba01fb7 100644 --- a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h +++ b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h @@ -85,8 +85,6 @@ public: UUID GetUUID() override { return m_uuid; } - FileSpecList GetDebugSymbolFilePaths() override { return FileSpecList(); } - uint32_t GetDependentModules(FileSpecList &files) override { return 0; } Type CalculateType() override { return eTypeDebugInfo; } diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index b107afc1d81..50d6b8f864c 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -816,14 +816,10 @@ UUID ObjectFileELF::GetUUID() { return m_uuid; } -lldb_private::FileSpecList ObjectFileELF::GetDebugSymbolFilePaths() { - FileSpecList file_spec_list; - - if (!m_gnu_debuglink_file.empty()) { - FileSpec file_spec(m_gnu_debuglink_file); - file_spec_list.Append(file_spec); - } - return file_spec_list; +llvm::Optional<FileSpec> ObjectFileELF::GetDebugLink() { + if (m_gnu_debuglink_file.empty()) + return llvm::None; + return FileSpec(m_gnu_debuglink_file); } uint32_t ObjectFileELF::GetDependentModules(FileSpecList &files) { diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h index 2a213771aad..f58618fed79 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -122,7 +122,9 @@ public: lldb_private::UUID GetUUID() override; - lldb_private::FileSpecList GetDebugSymbolFilePaths() override; + /// Return the contents of the .gnu_debuglink section, if the object file + /// contains it. + llvm::Optional<lldb_private::FileSpec> GetDebugLink(); uint32_t GetDependentModules(lldb_private::FileSpecList &files) override; |