ObjectFile[ELF]: Refactor gnu_debuglink interface
authorPavel Labath <pavel@labath.sk>
Mon, 5 Aug 2019 09:55:07 +0000 (09:55 +0000)
committerPavel Labath <pavel@labath.sk>
Mon, 5 Aug 2019 09:55:07 +0000 (09:55 +0000)
commitbfb261baca3f486a4f70786794ff30baafc6deea
treef8232ad28328bc004ddf0eebfdfae0a9eef854d3
parentab4a5d14b5822a43f1add78851bd34606f0e3f44
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
lldb/include/lldb/Symbol/ObjectFile.h
lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp