LLVM  9.0.0svn
Symbolize.cpp
Go to the documentation of this file.
1 //===-- LLVMSymbolize.cpp -------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Implementation for LLVM symbolization library.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 
15 #include "SymbolizableObjectFile.h"
16 
17 #include "llvm/ADT/STLExtras.h"
18 #include "llvm/BinaryFormat/COFF.h"
20 #include "llvm/DebugInfo/PDB/PDB.h"
22 #include "llvm/Demangle/Demangle.h"
23 #include "llvm/Object/COFF.h"
24 #include "llvm/Object/MachO.h"
26 #include "llvm/Support/CRC.h"
27 #include "llvm/Support/Casting.h"
30 #include "llvm/Support/Errc.h"
33 #include "llvm/Support/Path.h"
34 #include <algorithm>
35 #include <cassert>
36 #include <cstring>
37 
38 #if defined(_MSC_VER)
39 #include <Windows.h>
40 
41 // This must be included after windows.h.
42 #include <DbgHelp.h>
43 #pragma comment(lib, "dbghelp.lib")
44 
45 // Windows.h conflicts with our COFF header definitions.
46 #ifdef IMAGE_FILE_MACHINE_I386
47 #undef IMAGE_FILE_MACHINE_I386
48 #endif
49 #endif
50 
51 namespace llvm {
52 namespace symbolize {
53 
54 Expected<DILineInfo>
55 LLVMSymbolizer::symbolizeCode(const std::string &ModuleName,
56  object::SectionedAddress ModuleOffset,
57  StringRef DWPName) {
59  if (auto InfoOrErr = getOrCreateModuleInfo(ModuleName, DWPName))
60  Info = InfoOrErr.get();
61  else
62  return InfoOrErr.takeError();
63 
64  // A null module means an error has already been reported. Return an empty
65  // result.
66  if (!Info)
67  return DILineInfo();
68 
69  // If the user is giving us relative addresses, add the preferred base of the
70  // object to the offset before we do the query. It's what DIContext expects.
71  if (Opts.RelativeAddresses)
72  ModuleOffset.Address += Info->getModulePreferredBase();
73 
74  DILineInfo LineInfo = Info->symbolizeCode(ModuleOffset, Opts.PrintFunctions,
75  Opts.UseSymbolTable);
76  if (Opts.Demangle)
77  LineInfo.FunctionName = DemangleName(LineInfo.FunctionName, Info);
78  return LineInfo;
79 }
80 
82 LLVMSymbolizer::symbolizeInlinedCode(const std::string &ModuleName,
83  object::SectionedAddress ModuleOffset,
84  StringRef DWPName) {
86  if (auto InfoOrErr = getOrCreateModuleInfo(ModuleName, DWPName))
87  Info = InfoOrErr.get();
88  else
89  return InfoOrErr.takeError();
90 
91  // A null module means an error has already been reported. Return an empty
92  // result.
93  if (!Info)
94  return DIInliningInfo();
95 
96  // If the user is giving us relative addresses, add the preferred base of the
97  // object to the offset before we do the query. It's what DIContext expects.
98  if (Opts.RelativeAddresses)
99  ModuleOffset.Address += Info->getModulePreferredBase();
100 
101  DIInliningInfo InlinedContext = Info->symbolizeInlinedCode(
102  ModuleOffset, Opts.PrintFunctions, Opts.UseSymbolTable);
103  if (Opts.Demangle) {
104  for (int i = 0, n = InlinedContext.getNumberOfFrames(); i < n; i++) {
105  auto *Frame = InlinedContext.getMutableFrame(i);
106  Frame->FunctionName = DemangleName(Frame->FunctionName, Info);
107  }
108  }
109  return InlinedContext;
110 }
111 
113 LLVMSymbolizer::symbolizeData(const std::string &ModuleName,
114  object::SectionedAddress ModuleOffset) {
116  if (auto InfoOrErr = getOrCreateModuleInfo(ModuleName))
117  Info = InfoOrErr.get();
118  else
119  return InfoOrErr.takeError();
120 
121  // A null module means an error has already been reported. Return an empty
122  // result.
123  if (!Info)
124  return DIGlobal();
125 
126  // If the user is giving us relative addresses, add the preferred base of
127  // the object to the offset before we do the query. It's what DIContext
128  // expects.
129  if (Opts.RelativeAddresses)
130  ModuleOffset.Address += Info->getModulePreferredBase();
131 
132  DIGlobal Global = Info->symbolizeData(ModuleOffset);
133  if (Opts.Demangle)
134  Global.Name = DemangleName(Global.Name, Info);
135  return Global;
136 }
137 
139  ObjectForUBPathAndArch.clear();
140  BinaryForPath.clear();
141  ObjectPairForPathArch.clear();
142  Modules.clear();
143 }
144 
145 namespace {
146 
147 // For Path="/path/to/foo" and Basename="foo" assume that debug info is in
148 // /path/to/foo.dSYM/Contents/Resources/DWARF/foo.
149 // For Path="/path/to/bar.dSYM" and Basename="foo" assume that debug info is in
150 // /path/to/bar.dSYM/Contents/Resources/DWARF/foo.
151 std::string getDarwinDWARFResourceForPath(
152  const std::string &Path, const std::string &Basename) {
153  SmallString<16> ResourceName = StringRef(Path);
154  if (sys::path::extension(Path) != ".dSYM") {
155  ResourceName += ".dSYM";
156  }
157  sys::path::append(ResourceName, "Contents", "Resources", "DWARF");
158  sys::path::append(ResourceName, Basename);
159  return ResourceName.str();
160 }
161 
162 bool checkFileCRC(StringRef Path, uint32_t CRCHash) {
165  if (!MB)
166  return false;
167  return CRCHash == llvm::crc32(0, MB.get()->getBuffer());
168 }
169 
170 bool findDebugBinary(const std::string &OrigPath,
171  const std::string &DebuglinkName, uint32_t CRCHash,
172  const std::string &FallbackDebugPath,
173  std::string &Result) {
174  SmallString<16> OrigDir(OrigPath);
176  SmallString<16> DebugPath = OrigDir;
177  // Try relative/path/to/original_binary/debuglink_name
178  llvm::sys::path::append(DebugPath, DebuglinkName);
179  if (checkFileCRC(DebugPath, CRCHash)) {
180  Result = DebugPath.str();
181  return true;
182  }
183  // Try relative/path/to/original_binary/.debug/debuglink_name
184  DebugPath = OrigDir;
185  llvm::sys::path::append(DebugPath, ".debug", DebuglinkName);
186  if (checkFileCRC(DebugPath, CRCHash)) {
187  Result = DebugPath.str();
188  return true;
189  }
190  // Make the path absolute so that lookups will go to
191  // "/usr/lib/debug/full/path/to/debug", not
192  // "/usr/lib/debug/to/debug"
194  if (!FallbackDebugPath.empty()) {
195  // Try <FallbackDebugPath>/absolute/path/to/original_binary/debuglink_name
196  DebugPath = FallbackDebugPath;
197  } else {
198 #if defined(__NetBSD__)
199  // Try /usr/libdata/debug/absolute/path/to/original_binary/debuglink_name
200  DebugPath = "/usr/libdata/debug";
201 #else
202  // Try /usr/lib/debug/absolute/path/to/original_binary/debuglink_name
203  DebugPath = "/usr/lib/debug";
204 #endif
205  }
207  DebuglinkName);
208  if (checkFileCRC(DebugPath, CRCHash)) {
209  Result = DebugPath.str();
210  return true;
211  }
212  return false;
213 }
214 
215 bool getGNUDebuglinkContents(const ObjectFile *Obj, std::string &DebugName,
216  uint32_t &CRCHash) {
217  if (!Obj)
218  return false;
219  for (const SectionRef &Section : Obj->sections()) {
220  StringRef Name;
221  Section.getName(Name);
222  Name = Name.substr(Name.find_first_not_of("._"));
223  if (Name == "gnu_debuglink") {
224  StringRef Data;
225  Section.getContents(Data);
226  DataExtractor DE(Data, Obj->isLittleEndian(), 0);
227  uint32_t Offset = 0;
228  if (const char *DebugNameStr = DE.getCStr(&Offset)) {
229  // 4-byte align the offset.
230  Offset = (Offset + 3) & ~0x3;
231  if (DE.isValidOffsetForDataOfSize(Offset, 4)) {
232  DebugName = DebugNameStr;
233  CRCHash = DE.getU32(&Offset);
234  return true;
235  }
236  }
237  break;
238  }
239  }
240  return false;
241 }
242 
243 bool darwinDsymMatchesBinary(const MachOObjectFile *DbgObj,
244  const MachOObjectFile *Obj) {
245  ArrayRef<uint8_t> dbg_uuid = DbgObj->getUuid();
246  ArrayRef<uint8_t> bin_uuid = Obj->getUuid();
247  if (dbg_uuid.empty() || bin_uuid.empty())
248  return false;
249  return !memcmp(dbg_uuid.data(), bin_uuid.data(), dbg_uuid.size());
250 }
251 
252 } // end anonymous namespace
253 
254 ObjectFile *LLVMSymbolizer::lookUpDsymFile(const std::string &ExePath,
255  const MachOObjectFile *MachExeObj, const std::string &ArchName) {
256  // On Darwin we may find DWARF in separate object file in
257  // resource directory.
258  std::vector<std::string> DsymPaths;
259  StringRef Filename = sys::path::filename(ExePath);
260  DsymPaths.push_back(getDarwinDWARFResourceForPath(ExePath, Filename));
261  for (const auto &Path : Opts.DsymHints) {
262  DsymPaths.push_back(getDarwinDWARFResourceForPath(Path, Filename));
263  }
264  for (const auto &Path : DsymPaths) {
265  auto DbgObjOrErr = getOrCreateObject(Path, ArchName);
266  if (!DbgObjOrErr) {
267  // Ignore errors, the file might not exist.
268  consumeError(DbgObjOrErr.takeError());
269  continue;
270  }
271  ObjectFile *DbgObj = DbgObjOrErr.get();
272  if (!DbgObj)
273  continue;
274  const MachOObjectFile *MachDbgObj = dyn_cast<const MachOObjectFile>(DbgObj);
275  if (!MachDbgObj)
276  continue;
277  if (darwinDsymMatchesBinary(MachDbgObj, MachExeObj))
278  return DbgObj;
279  }
280  return nullptr;
281 }
282 
283 ObjectFile *LLVMSymbolizer::lookUpDebuglinkObject(const std::string &Path,
284  const ObjectFile *Obj,
285  const std::string &ArchName) {
286  std::string DebuglinkName;
287  uint32_t CRCHash;
288  std::string DebugBinaryPath;
289  if (!getGNUDebuglinkContents(Obj, DebuglinkName, CRCHash))
290  return nullptr;
291  if (!findDebugBinary(Path, DebuglinkName, CRCHash, Opts.FallbackDebugPath,
292  DebugBinaryPath))
293  return nullptr;
294  auto DbgObjOrErr = getOrCreateObject(DebugBinaryPath, ArchName);
295  if (!DbgObjOrErr) {
296  // Ignore errors, the file might not exist.
297  consumeError(DbgObjOrErr.takeError());
298  return nullptr;
299  }
300  return DbgObjOrErr.get();
301 }
302 
304 LLVMSymbolizer::getOrCreateObjectPair(const std::string &Path,
305  const std::string &ArchName) {
306  const auto &I = ObjectPairForPathArch.find(std::make_pair(Path, ArchName));
307  if (I != ObjectPairForPathArch.end()) {
308  return I->second;
309  }
310 
311  auto ObjOrErr = getOrCreateObject(Path, ArchName);
312  if (!ObjOrErr) {
313  ObjectPairForPathArch.insert(std::make_pair(std::make_pair(Path, ArchName),
314  ObjectPair(nullptr, nullptr)));
315  return ObjOrErr.takeError();
316  }
317 
318  ObjectFile *Obj = ObjOrErr.get();
319  assert(Obj != nullptr);
320  ObjectFile *DbgObj = nullptr;
321 
322  if (auto MachObj = dyn_cast<const MachOObjectFile>(Obj))
323  DbgObj = lookUpDsymFile(Path, MachObj, ArchName);
324  if (!DbgObj)
325  DbgObj = lookUpDebuglinkObject(Path, Obj, ArchName);
326  if (!DbgObj)
327  DbgObj = Obj;
328  ObjectPair Res = std::make_pair(Obj, DbgObj);
329  ObjectPairForPathArch.insert(
330  std::make_pair(std::make_pair(Path, ArchName), Res));
331  return Res;
332 }
333 
335 LLVMSymbolizer::getOrCreateObject(const std::string &Path,
336  const std::string &ArchName) {
337  const auto &I = BinaryForPath.find(Path);
338  Binary *Bin = nullptr;
339  if (I == BinaryForPath.end()) {
341  if (!BinOrErr) {
342  BinaryForPath.insert(std::make_pair(Path, OwningBinary<Binary>()));
343  return BinOrErr.takeError();
344  }
345  Bin = BinOrErr->getBinary();
346  BinaryForPath.insert(std::make_pair(Path, std::move(BinOrErr.get())));
347  } else {
348  Bin = I->second.getBinary();
349  }
350 
351  if (!Bin)
352  return static_cast<ObjectFile *>(nullptr);
353 
354  if (MachOUniversalBinary *UB = dyn_cast_or_null<MachOUniversalBinary>(Bin)) {
355  const auto &I = ObjectForUBPathAndArch.find(std::make_pair(Path, ArchName));
356  if (I != ObjectForUBPathAndArch.end()) {
357  return I->second.get();
358  }
360  UB->getObjectForArch(ArchName);
361  if (!ObjOrErr) {
362  ObjectForUBPathAndArch.insert(std::make_pair(
363  std::make_pair(Path, ArchName), std::unique_ptr<ObjectFile>()));
364  return ObjOrErr.takeError();
365  }
366  ObjectFile *Res = ObjOrErr->get();
367  ObjectForUBPathAndArch.insert(std::make_pair(std::make_pair(Path, ArchName),
368  std::move(ObjOrErr.get())));
369  return Res;
370  }
371  if (Bin->isObject()) {
372  return cast<ObjectFile>(Bin);
373  }
374  return errorCodeToError(object_error::arch_not_found);
375 }
376 
378 LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName,
379  StringRef DWPName) {
380  const auto &I = Modules.find(ModuleName);
381  if (I != Modules.end()) {
382  return I->second.get();
383  }
384  std::string BinaryName = ModuleName;
385  std::string ArchName = Opts.DefaultArch;
386  size_t ColonPos = ModuleName.find_last_of(':');
387  // Verify that substring after colon form a valid arch name.
388  if (ColonPos != std::string::npos) {
389  std::string ArchStr = ModuleName.substr(ColonPos + 1);
390  if (Triple(ArchStr).getArch() != Triple::UnknownArch) {
391  BinaryName = ModuleName.substr(0, ColonPos);
392  ArchName = ArchStr;
393  }
394  }
395  auto ObjectsOrErr = getOrCreateObjectPair(BinaryName, ArchName);
396  if (!ObjectsOrErr) {
397  // Failed to find valid object file.
398  Modules.insert(
399  std::make_pair(ModuleName, std::unique_ptr<SymbolizableModule>()));
400  return ObjectsOrErr.takeError();
401  }
402  ObjectPair Objects = ObjectsOrErr.get();
403 
404  std::unique_ptr<DIContext> Context;
405  // If this is a COFF object containing PDB info, use a PDBContext to
406  // symbolize. Otherwise, use DWARF.
407  if (auto CoffObject = dyn_cast<COFFObjectFile>(Objects.first)) {
408  const codeview::DebugInfo *DebugInfo;
409  StringRef PDBFileName;
410  auto EC = CoffObject->getDebugPDBInfo(DebugInfo, PDBFileName);
411  if (!EC && DebugInfo != nullptr && !PDBFileName.empty()) {
412  using namespace pdb;
413  std::unique_ptr<IPDBSession> Session;
414  if (auto Err = loadDataForEXE(PDB_ReaderType::DIA,
415  Objects.first->getFileName(), Session)) {
416  Modules.insert(
417  std::make_pair(ModuleName, std::unique_ptr<SymbolizableModule>()));
418  // Return along the PDB filename to provide more context
419  return createFileError(PDBFileName, std::move(Err));
420  }
421  Context.reset(new PDBContext(*CoffObject, std::move(Session)));
422  }
423  }
424  if (!Context)
425  Context = DWARFContext::create(*Objects.second, nullptr,
427  assert(Context);
428  auto InfoOrErr =
429  SymbolizableObjectFile::create(Objects.first, std::move(Context));
430  std::unique_ptr<SymbolizableModule> SymMod;
431  if (InfoOrErr)
432  SymMod = std::move(InfoOrErr.get());
433  auto InsertResult =
434  Modules.insert(std::make_pair(ModuleName, std::move(SymMod)));
435  assert(InsertResult.second);
436  if (auto EC = InfoOrErr.getError())
437  return errorCodeToError(EC);
438  return InsertResult.first->second.get();
439 }
440 
441 namespace {
442 
443 // Undo these various manglings for Win32 extern "C" functions:
444 // cdecl - _foo
445 // stdcall - _foo@12
446 // fastcall - @foo@12
447 // vectorcall - foo@@12
448 // These are all different linkage names for 'foo'.
449 StringRef demanglePE32ExternCFunc(StringRef SymbolName) {
450  // Remove any '_' or '@' prefix.
451  char Front = SymbolName.empty() ? '\0' : SymbolName[0];
452  if (Front == '_' || Front == '@')
453  SymbolName = SymbolName.drop_front();
454 
455  // Remove any '@[0-9]+' suffix.
456  if (Front != '?') {
457  size_t AtPos = SymbolName.rfind('@');
458  if (AtPos != StringRef::npos &&
459  std::all_of(SymbolName.begin() + AtPos + 1, SymbolName.end(),
460  [](char C) { return C >= '0' && C <= '9'; })) {
461  SymbolName = SymbolName.substr(0, AtPos);
462  }
463  }
464 
465  // Remove any ending '@' for vectorcall.
466  if (SymbolName.endswith("@"))
467  SymbolName = SymbolName.drop_back();
468 
469  return SymbolName;
470 }
471 
472 } // end anonymous namespace
473 
474 std::string
476  const SymbolizableModule *DbiModuleDescriptor) {
477  // We can spoil names of symbols with C linkage, so use an heuristic
478  // approach to check if the name should be demangled.
479  if (Name.substr(0, 2) == "_Z") {
480  int status = 0;
481  char *DemangledName = itaniumDemangle(Name.c_str(), nullptr, nullptr, &status);
482  if (status != 0)
483  return Name;
484  std::string Result = DemangledName;
485  free(DemangledName);
486  return Result;
487  }
488 
489 #if defined(_MSC_VER)
490  if (!Name.empty() && Name.front() == '?') {
491  // Only do MSVC C++ demangling on symbols starting with '?'.
492  char DemangledName[1024] = {0};
493  DWORD result = ::UnDecorateSymbolName(
494  Name.c_str(), DemangledName, 1023,
495  UNDNAME_NO_ACCESS_SPECIFIERS | // Strip public, private, protected
496  UNDNAME_NO_ALLOCATION_LANGUAGE | // Strip __thiscall, __stdcall, etc
497  UNDNAME_NO_THROW_SIGNATURES | // Strip throw() specifications
498  UNDNAME_NO_MEMBER_TYPE | // Strip virtual, static, etc specifiers
499  UNDNAME_NO_MS_KEYWORDS | // Strip all MS extension keywords
500  UNDNAME_NO_FUNCTION_RETURNS); // Strip function return types
501  return (result == 0) ? Name : std::string(DemangledName);
502  }
503 #endif
504  if (DbiModuleDescriptor && DbiModuleDescriptor->isWin32Module())
505  return std::string(demanglePE32ExternCFunc(Name));
506  return Name;
507 }
508 
509 } // namespace symbolize
510 } // namespace llvm
uint64_t CallInst * C
Represents either an error or a value T.
Definition: ErrorOr.h:56
void remove_filename(SmallVectorImpl< char > &path, Style style=Style::native)
Remove the last component from path unless it is the root dir.
Definition: Path.cpp:473
DILineInfo * getMutableFrame(unsigned Index)
Definition: DIContext.h:88
char * itaniumDemangle(const char *mangled_name, char *buf, size_t *n, int *status)
LLVMContext & Context
LLVM_NODISCARD bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
Definition: StringRef.h:267
This class represents lattice values for constants.
Definition: AllocatorList.h:23
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
LLVM_NODISCARD size_t rfind(char C, size_t From=npos) const
Search for the last character C in the string.
Definition: StringRef.h:345
This class is the base class for all object file types.
Definition: ObjectFile.h:225
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:1185
Error takeError()
Take ownership of the stored error.
Definition: Error.h:552
virtual bool isWin32Module() const =0
A format-neutral container for source line information.
Definition: DIContext.h:30
Expected< std::unique_ptr< Binary > > createBinary(MemoryBufferRef Source, LLVMContext *Context=nullptr)
Create a Binary from Source, autodetecting the file type.
Definition: Binary.cpp:45
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
Definition: Path.cpp:454
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
LLVM_NODISCARD StringRef drop_front(size_t N=1) const
Return a StringRef equal to &#39;this&#39; but with the first N elements dropped.
Definition: StringRef.h:620
void make_absolute(const Twine &current_directory, SmallVectorImpl< char > &path)
Make path an absolute path.
Definition: Path.cpp:852
Tagged union holding either a T or a Error.
Definition: CachePruning.h:22
Expected< DIGlobal > symbolizeData(const std::string &ModuleName, object::SectionedAddress ModuleOffset)
Definition: Symbolize.cpp:113
LLVM_NODISCARD StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Definition: StringRef.h:578
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:126
StringRef str() const
Explicit conversion to StringRef.
Definition: SmallString.h:266
Expected< DIInliningInfo > symbolizeInlinedCode(const std::string &ModuleName, object::SectionedAddress ModuleOffset, StringRef DWPName="")
Definition: Symbolize.cpp:82
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:25
section_iterator_range sections() const
Definition: ObjectFile.h:315
uint32_t getNumberOfFrames() const
Definition: DIContext.h:93
Analysis containing CSE Info
Definition: CSEInfo.cpp:20
Error loadDataForEXE(PDB_ReaderType Type, StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: PDB.cpp:43
std::error_code status(const Twine &path, file_status &result, bool follow=true)
Get file status as if by POSIX stat().
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:148
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
Definition: Error.cpp:87
A format-neutral container for inlined code description.
Definition: DIContext.h:77
LLVM_NODISCARD size_t find_first_not_of(char C, size_t From=0) const
Find the first character in the string that is not C or npos if not found.
Definition: StringRef.cpp:249
std::vector< std::string > DsymHints
Definition: Symbolize.h:43
static ErrorPolicy defaultErrorHandler(Error E)
Function used to handle default error reporting policy.
virtual DIInliningInfo symbolizeInlinedCode(object::SectionedAddress ModuleOffset, FunctionNameKind FNKind, bool UseSymbolTable) const =0
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:981
bool isLittleEndian() const
Definition: Binary.h:138
const T * data() const
Definition: ArrayRef.h:145
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
static std::unique_ptr< DWARFContext > create(const object::ObjectFile &Obj, const LoadedObjectInfo *L=nullptr, function_ref< ErrorPolicy(Error)> HandleError=defaultErrorHandler, std::string DWPName="")
uint32_t crc32(uint32_t CRC, StringRef S)
zlib independent CRC32 calculation.
Definition: CRC.cpp:65
static std::string DemangleName(const std::string &Name, const SymbolizableModule *DbiModuleDescriptor)
Definition: Symbolize.cpp:475
virtual DILineInfo symbolizeCode(object::SectionedAddress ModuleOffset, FunctionNameKind FNKind, bool UseSymbolTable) const =0
ArrayRef< uint8_t > getUuid() const
std::string Name
Definition: DIContext.h:109
std::string FunctionName
Definition: DIContext.h:32
reference get()
Returns a reference to the stored T value.
Definition: Error.h:532
bool isObject() const
Definition: Binary.h:98
iterator begin() const
Definition: StringRef.h:101
virtual uint64_t getModulePreferredBase() const =0
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN(const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true)
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
Merge contiguous icmps into a memcmp
Definition: MergeICmps.cpp:866
static const size_t npos
Definition: StringRef.h:50
StringRef filename(StringRef path, Style style=Style::native)
Get filename.
Definition: Path.cpp:564
#define I(x, y, z)
Definition: MD5.cpp:58
Expected< DILineInfo > symbolizeCode(const std::string &ModuleName, object::SectionedAddress ModuleOffset, StringRef DWPName="")
Definition: Symbolize.cpp:55
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Definition: Casting.h:332
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef relative_path(StringRef path, Style style=Style::native)
Get relative path.
Definition: Path.cpp:411
Error createFileError(const Twine &F, Error E)
Concatenate a source file path and/or name with an Error.
Definition: Error.h:1214
LLVM_NODISCARD StringRef drop_back(size_t N=1) const
Return a StringRef equal to &#39;this&#39; but with the last N elements dropped.
Definition: StringRef.h:628
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
static ErrorOr< std::unique_ptr< SymbolizableObjectFile > > create(object::ObjectFile *Obj, std::unique_ptr< DIContext > DICtx)
iterator end() const
Definition: StringRef.h:103
virtual DIGlobal symbolizeData(object::SectionedAddress ModuleOffset) const =0
reference get()
Definition: ErrorOr.h:156
Container for description of a global variable.
Definition: DIContext.h:108
bool empty() const
empty - Check if the array is empty.
Definition: ArrayRef.h:143
This is a value type class that represents a single section in the list of sections in the object fil...
Definition: ObjectFile.h:80
StringRef extension(StringRef path, Style style=Style::native)
Get extension.
Definition: Path.cpp:579