diff options
Diffstat (limited to 'contrib/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp')
-rw-r--r-- | contrib/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/contrib/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/contrib/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp index f694008..2a89faf 100644 --- a/contrib/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp +++ b/contrib/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp @@ -1,4 +1,4 @@ -//===-- SymbolizableObjectFile.cpp ----------------------------------------===// +//===- SymbolizableObjectFile.cpp -----------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -12,15 +12,29 @@ //===----------------------------------------------------------------------===// #include "SymbolizableObjectFile.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/Triple.h" +#include "llvm/BinaryFormat/COFF.h" +#include "llvm/DebugInfo/DWARF/DWARFContext.h" +#include "llvm/DebugInfo/Symbolize/SymbolizableModule.h" #include "llvm/Object/COFF.h" +#include "llvm/Object/ObjectFile.h" #include "llvm/Object/SymbolSize.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/DataExtractor.h" -#include "llvm/DebugInfo/DWARF/DWARFContext.h" - -namespace llvm { -namespace symbolize { +#include "llvm/Support/Error.h" +#include <algorithm> +#include <cstdint> +#include <memory> +#include <string> +#include <system_error> +#include <utility> +#include <vector> +using namespace llvm; using namespace object; +using namespace symbolize; static DILineInfoSpecifier getDILineInfoSpecifier(FunctionNameKind FNKind) { @@ -73,14 +87,17 @@ SymbolizableObjectFile::SymbolizableObjectFile(ObjectFile *Obj, : Module(Obj), DebugInfoContext(std::move(DICtx)) {} namespace { + struct OffsetNamePair { uint32_t Offset; StringRef Name; + bool operator<(const OffsetNamePair &R) const { return Offset < R.Offset; } }; -} + +} // end anonymous namespace std::error_code SymbolizableObjectFile::addCoffExportSymbols( const COFFObjectFile *CoffObj) { @@ -147,7 +164,7 @@ std::error_code SymbolizableObjectFile::addSymbol(const SymbolRef &Symbol, return errorToErrorCode(SymbolNameOrErr.takeError()); StringRef SymbolName = *SymbolNameOrErr; // Mach-O symbol table names have leading underscore, skip it. - if (Module->isMachO() && SymbolName.size() > 0 && SymbolName[0] == '_') + if (Module->isMachO() && !SymbolName.empty() && SymbolName[0] == '_') SymbolName = SymbolName.drop_front(); // FIXME: If a function has alias, there are two entries in symbol table // with same address size. Make sure we choose the correct one. @@ -252,7 +269,3 @@ DIGlobal SymbolizableObjectFile::symbolizeData(uint64_t ModuleOffset) const { Res.Size); return Res; } - -} // namespace symbolize -} // namespace llvm - |