1 //===-- LLVMSymbolize.cpp -------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Implementation for LLVM symbolization library.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/DebugInfo/Symbolize/Symbolize.h"
16 #include "llvm/ADT/STLExtras.h"
17 #include "llvm/Config/config.h"
18 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
19 #include "llvm/DebugInfo/PDB/PDB.h"
20 #include "llvm/DebugInfo/PDB/PDBContext.h"
21 #include "llvm/Object/ELFObjectFile.h"
22 #include "llvm/Object/MachO.h"
23 #include "llvm/Object/SymbolSize.h"
24 #include "llvm/Support/COFF.h"
25 #include "llvm/Support/Casting.h"
26 #include "llvm/Support/Compression.h"
27 #include "llvm/Support/DataExtractor.h"
28 #include "llvm/Support/Errc.h"
29 #include "llvm/Support/FileSystem.h"
30 #include "llvm/Support/MemoryBuffer.h"
31 #include "llvm/Support/Path.h"
38 #pragma comment(lib, "dbghelp.lib")
40 // Windows.h conflicts with our COFF header definitions.
41 #ifdef IMAGE_FILE_MACHINE_I386
42 #undef IMAGE_FILE_MACHINE_I386
49 // FIXME: Move this to llvm-symbolizer tool.
50 static bool error(std::error_code ec) {
53 errs() << "LLVMSymbolizer: error reading file: " << ec.message() << ".\n";
57 static DILineInfoSpecifier
58 getDILineInfoSpecifier(const LLVMSymbolizer::Options &Opts) {
59 return DILineInfoSpecifier(
60 DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
64 ModuleInfo::ModuleInfo(ObjectFile *Obj, std::unique_ptr<DIContext> DICtx)
65 : Module(Obj), DebugInfoContext(std::move(DICtx)) {
66 std::unique_ptr<DataExtractor> OpdExtractor;
67 uint64_t OpdAddress = 0;
68 // Find the .opd (function descriptor) section if any, for big-endian
70 if (Module->getArch() == Triple::ppc64) {
71 for (section_iterator Section : Module->sections()) {
73 if (!error(Section->getName(Name)) && Name == ".opd") {
75 if (!error(Section->getContents(Data))) {
76 OpdExtractor.reset(new DataExtractor(Data, Module->isLittleEndian(),
77 Module->getBytesInAddress()));
78 OpdAddress = Section->getAddress();
84 std::vector<std::pair<SymbolRef, uint64_t>> Symbols =
85 computeSymbolSizes(*Module);
86 for (auto &P : Symbols)
87 addSymbol(P.first, P.second, OpdExtractor.get(), OpdAddress);
89 // If this is a COFF object and we didn't find any symbols, try the export
91 if (Symbols.empty()) {
92 if (auto *CoffObj = dyn_cast<COFFObjectFile>(Obj))
93 addCoffExportSymbols(CoffObj);
98 struct OffsetNamePair {
101 bool operator<(const OffsetNamePair &R) const {
102 return Offset < R.Offset;
107 void ModuleInfo::addCoffExportSymbols(const COFFObjectFile *CoffObj) {
108 // Get all export names and offsets.
109 std::vector<OffsetNamePair> ExportSyms;
110 for (const ExportDirectoryEntryRef &Ref : CoffObj->export_directories()) {
113 if (error(Ref.getSymbolName(Name)) || error(Ref.getExportRVA(Offset)))
115 ExportSyms.push_back(OffsetNamePair{Offset, Name});
117 if (ExportSyms.empty())
120 // Sort by ascending offset.
121 array_pod_sort(ExportSyms.begin(), ExportSyms.end());
123 // Approximate the symbol sizes by assuming they run to the next symbol.
124 // FIXME: This assumes all exports are functions.
125 uint64_t ImageBase = CoffObj->getImageBase();
126 for (auto I = ExportSyms.begin(), E = ExportSyms.end(); I != E; ++I) {
127 OffsetNamePair &Export = *I;
128 // FIXME: The last export has a one byte size now.
129 uint32_t NextOffset = I != E ? I->Offset : Export.Offset + 1;
130 uint64_t SymbolStart = ImageBase + Export.Offset;
131 uint64_t SymbolSize = NextOffset - Export.Offset;
132 SymbolDesc SD = {SymbolStart, SymbolSize};
133 Functions.insert(std::make_pair(SD, Export.Name));
137 void ModuleInfo::addSymbol(const SymbolRef &Symbol, uint64_t SymbolSize,
138 DataExtractor *OpdExtractor, uint64_t OpdAddress) {
139 SymbolRef::Type SymbolType = Symbol.getType();
140 if (SymbolType != SymbolRef::ST_Function && SymbolType != SymbolRef::ST_Data)
142 ErrorOr<uint64_t> SymbolAddressOrErr = Symbol.getAddress();
143 if (error(SymbolAddressOrErr.getError()))
145 uint64_t SymbolAddress = *SymbolAddressOrErr;
147 // For big-endian PowerPC64 ELF, symbols in the .opd section refer to
148 // function descriptors. The first word of the descriptor is a pointer to
149 // the function's code.
150 // For the purposes of symbolization, pretend the symbol's address is that
151 // of the function's code, not the descriptor.
152 uint64_t OpdOffset = SymbolAddress - OpdAddress;
153 uint32_t OpdOffset32 = OpdOffset;
154 if (OpdOffset == OpdOffset32 &&
155 OpdExtractor->isValidOffsetForAddress(OpdOffset32))
156 SymbolAddress = OpdExtractor->getAddress(&OpdOffset32);
158 ErrorOr<StringRef> SymbolNameOrErr = Symbol.getName();
159 if (error(SymbolNameOrErr.getError()))
161 StringRef SymbolName = *SymbolNameOrErr;
162 // Mach-O symbol table names have leading underscore, skip it.
163 if (Module->isMachO() && SymbolName.size() > 0 && SymbolName[0] == '_')
164 SymbolName = SymbolName.drop_front();
165 // FIXME: If a function has alias, there are two entries in symbol table
166 // with same address size. Make sure we choose the correct one.
167 auto &M = SymbolType == SymbolRef::ST_Function ? Functions : Objects;
168 SymbolDesc SD = { SymbolAddress, SymbolSize };
169 M.insert(std::make_pair(SD, SymbolName));
172 // Return true if this is a 32-bit x86 PE COFF module.
173 bool ModuleInfo::isWin32Module() const {
174 auto *CoffObject = dyn_cast<COFFObjectFile>(Module);
175 return CoffObject && CoffObject->getMachine() == COFF::IMAGE_FILE_MACHINE_I386;
178 uint64_t ModuleInfo::getModulePreferredBase() const {
179 if (auto *CoffObject = dyn_cast<COFFObjectFile>(Module))
180 return CoffObject->getImageBase();
184 bool ModuleInfo::getNameFromSymbolTable(SymbolRef::Type Type, uint64_t Address,
185 std::string &Name, uint64_t &Addr,
186 uint64_t &Size) const {
187 const auto &SymbolMap = Type == SymbolRef::ST_Function ? Functions : Objects;
188 if (SymbolMap.empty())
190 SymbolDesc SD = { Address, Address };
191 auto SymbolIterator = SymbolMap.upper_bound(SD);
192 if (SymbolIterator == SymbolMap.begin())
195 if (SymbolIterator->first.Size != 0 &&
196 SymbolIterator->first.Addr + SymbolIterator->first.Size <= Address)
198 Name = SymbolIterator->second.str();
199 Addr = SymbolIterator->first.Addr;
200 Size = SymbolIterator->first.Size;
204 DILineInfo ModuleInfo::symbolizeCode(
205 uint64_t ModuleOffset, const LLVMSymbolizer::Options &Opts) const {
207 if (DebugInfoContext) {
208 LineInfo = DebugInfoContext->getLineInfoForAddress(
209 ModuleOffset, getDILineInfoSpecifier(Opts));
211 // Override function name from symbol table if necessary.
212 if (Opts.PrintFunctions == FunctionNameKind::LinkageName &&
213 Opts.UseSymbolTable) {
214 std::string FunctionName;
215 uint64_t Start, Size;
216 if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset,
217 FunctionName, Start, Size)) {
218 LineInfo.FunctionName = FunctionName;
224 DIInliningInfo ModuleInfo::symbolizeInlinedCode(
225 uint64_t ModuleOffset, const LLVMSymbolizer::Options &Opts) const {
226 DIInliningInfo InlinedContext;
228 if (DebugInfoContext) {
229 InlinedContext = DebugInfoContext->getInliningInfoForAddress(
230 ModuleOffset, getDILineInfoSpecifier(Opts));
232 // Make sure there is at least one frame in context.
233 if (InlinedContext.getNumberOfFrames() == 0) {
234 InlinedContext.addFrame(DILineInfo());
236 // Override the function name in lower frame with name from symbol table.
237 if (Opts.PrintFunctions == FunctionNameKind::LinkageName &&
238 Opts.UseSymbolTable) {
239 DIInliningInfo PatchedInlinedContext;
240 for (uint32_t i = 0, n = InlinedContext.getNumberOfFrames(); i < n; i++) {
241 DILineInfo LineInfo = InlinedContext.getFrame(i);
243 std::string FunctionName;
244 uint64_t Start, Size;
245 if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset,
246 FunctionName, Start, Size)) {
247 LineInfo.FunctionName = FunctionName;
250 PatchedInlinedContext.addFrame(LineInfo);
252 InlinedContext = PatchedInlinedContext;
254 return InlinedContext;
257 bool ModuleInfo::symbolizeData(uint64_t ModuleOffset, std::string &Name,
258 uint64_t &Start, uint64_t &Size) const {
259 return getNameFromSymbolTable(SymbolRef::ST_Data, ModuleOffset, Name, Start,
263 const char LLVMSymbolizer::kBadString[] = "??";
265 std::string LLVMSymbolizer::symbolizeCode(const std::string &ModuleName,
266 uint64_t ModuleOffset) {
267 ModuleInfo *Info = getOrCreateModuleInfo(ModuleName);
269 return printDILineInfo(DILineInfo(), Info);
271 // If the user is giving us relative addresses, add the preferred base of the
272 // object to the offset before we do the query. It's what DIContext expects.
273 if (Opts.RelativeAddresses)
274 ModuleOffset += Info->getModulePreferredBase();
276 if (Opts.PrintInlining) {
277 DIInliningInfo InlinedContext =
278 Info->symbolizeInlinedCode(ModuleOffset, Opts);
279 uint32_t FramesNum = InlinedContext.getNumberOfFrames();
280 assert(FramesNum > 0);
282 for (uint32_t i = 0; i < FramesNum; i++) {
283 DILineInfo LineInfo = InlinedContext.getFrame(i);
284 Result += printDILineInfo(LineInfo, Info);
288 DILineInfo LineInfo = Info->symbolizeCode(ModuleOffset, Opts);
289 return printDILineInfo(LineInfo, Info);
292 std::string LLVMSymbolizer::symbolizeData(const std::string &ModuleName,
293 uint64_t ModuleOffset) {
294 std::string Name = kBadString;
297 if (Opts.UseSymbolTable) {
298 if (ModuleInfo *Info = getOrCreateModuleInfo(ModuleName)) {
299 // If the user is giving us relative addresses, add the preferred base of the
300 // object to the offset before we do the query. It's what DIContext expects.
301 if (Opts.RelativeAddresses)
302 ModuleOffset += Info->getModulePreferredBase();
303 if (Info->symbolizeData(ModuleOffset, Name, Start, Size) && Opts.Demangle)
304 Name = DemangleName(Name, Info);
307 std::stringstream ss;
308 ss << Name << "\n" << Start << " " << Size << "\n";
312 void LLVMSymbolizer::flush() {
314 ObjectPairForPathArch.clear();
315 ObjectFileForArch.clear();
318 // For Path="/path/to/foo" and Basename="foo" assume that debug info is in
319 // /path/to/foo.dSYM/Contents/Resources/DWARF/foo.
320 // For Path="/path/to/bar.dSYM" and Basename="foo" assume that debug info is in
321 // /path/to/bar.dSYM/Contents/Resources/DWARF/foo.
323 std::string getDarwinDWARFResourceForPath(
324 const std::string &Path, const std::string &Basename) {
325 SmallString<16> ResourceName = StringRef(Path);
326 if (sys::path::extension(Path) != ".dSYM") {
327 ResourceName += ".dSYM";
329 sys::path::append(ResourceName, "Contents", "Resources", "DWARF");
330 sys::path::append(ResourceName, Basename);
331 return ResourceName.str();
334 static bool checkFileCRC(StringRef Path, uint32_t CRCHash) {
335 ErrorOr<std::unique_ptr<MemoryBuffer>> MB =
336 MemoryBuffer::getFileOrSTDIN(Path);
339 return !zlib::isAvailable() || CRCHash == zlib::crc32(MB.get()->getBuffer());
342 static bool findDebugBinary(const std::string &OrigPath,
343 const std::string &DebuglinkName, uint32_t CRCHash,
344 std::string &Result) {
345 std::string OrigRealPath = OrigPath;
346 #if defined(HAVE_REALPATH)
347 if (char *RP = realpath(OrigPath.c_str(), nullptr)) {
352 SmallString<16> OrigDir(OrigRealPath);
353 llvm::sys::path::remove_filename(OrigDir);
354 SmallString<16> DebugPath = OrigDir;
355 // Try /path/to/original_binary/debuglink_name
356 llvm::sys::path::append(DebugPath, DebuglinkName);
357 if (checkFileCRC(DebugPath, CRCHash)) {
358 Result = DebugPath.str();
361 // Try /path/to/original_binary/.debug/debuglink_name
362 DebugPath = OrigRealPath;
363 llvm::sys::path::append(DebugPath, ".debug", DebuglinkName);
364 if (checkFileCRC(DebugPath, CRCHash)) {
365 Result = DebugPath.str();
368 // Try /usr/lib/debug/path/to/original_binary/debuglink_name
369 DebugPath = "/usr/lib/debug";
370 llvm::sys::path::append(DebugPath, llvm::sys::path::relative_path(OrigDir),
372 if (checkFileCRC(DebugPath, CRCHash)) {
373 Result = DebugPath.str();
379 static bool getGNUDebuglinkContents(const ObjectFile *Obj, std::string &DebugName,
383 for (const SectionRef &Section : Obj->sections()) {
385 Section.getName(Name);
386 Name = Name.substr(Name.find_first_not_of("._"));
387 if (Name == "gnu_debuglink") {
389 Section.getContents(Data);
390 DataExtractor DE(Data, Obj->isLittleEndian(), 0);
392 if (const char *DebugNameStr = DE.getCStr(&Offset)) {
393 // 4-byte align the offset.
394 Offset = (Offset + 3) & ~0x3;
395 if (DE.isValidOffsetForDataOfSize(Offset, 4)) {
396 DebugName = DebugNameStr;
397 CRCHash = DE.getU32(&Offset);
408 bool darwinDsymMatchesBinary(const MachOObjectFile *DbgObj,
409 const MachOObjectFile *Obj) {
410 ArrayRef<uint8_t> dbg_uuid = DbgObj->getUuid();
411 ArrayRef<uint8_t> bin_uuid = Obj->getUuid();
412 if (dbg_uuid.empty() || bin_uuid.empty())
414 return !memcmp(dbg_uuid.data(), bin_uuid.data(), dbg_uuid.size());
417 ObjectFile *LLVMSymbolizer::lookUpDsymFile(const std::string &ExePath,
418 const MachOObjectFile *MachExeObj, const std::string &ArchName) {
419 // On Darwin we may find DWARF in separate object file in
420 // resource directory.
421 std::vector<std::string> DsymPaths;
422 StringRef Filename = sys::path::filename(ExePath);
423 DsymPaths.push_back(getDarwinDWARFResourceForPath(ExePath, Filename));
424 for (const auto &Path : Opts.DsymHints) {
425 DsymPaths.push_back(getDarwinDWARFResourceForPath(Path, Filename));
427 for (const auto &path : DsymPaths) {
428 ErrorOr<OwningBinary<Binary>> BinaryOrErr = createBinary(path);
429 std::error_code EC = BinaryOrErr.getError();
430 if (EC != errc::no_such_file_or_directory && !error(EC)) {
431 OwningBinary<Binary> B = std::move(BinaryOrErr.get());
433 getObjectFileFromBinary(B.getBinary(), ArchName);
434 const MachOObjectFile *MachDbgObj =
435 dyn_cast<const MachOObjectFile>(DbgObj);
436 if (!MachDbgObj) continue;
437 if (darwinDsymMatchesBinary(MachDbgObj, MachExeObj)) {
438 addOwningBinary(std::move(B));
446 LLVMSymbolizer::ObjectPair
447 LLVMSymbolizer::getOrCreateObjects(const std::string &Path,
448 const std::string &ArchName) {
449 const auto &I = ObjectPairForPathArch.find(std::make_pair(Path, ArchName));
450 if (I != ObjectPairForPathArch.end())
452 ObjectFile *Obj = nullptr;
453 ObjectFile *DbgObj = nullptr;
454 ErrorOr<OwningBinary<Binary>> BinaryOrErr = createBinary(Path);
455 if (!error(BinaryOrErr.getError())) {
456 OwningBinary<Binary> &B = BinaryOrErr.get();
457 Obj = getObjectFileFromBinary(B.getBinary(), ArchName);
459 ObjectPair Res = std::make_pair(nullptr, nullptr);
460 ObjectPairForPathArch[std::make_pair(Path, ArchName)] = Res;
463 addOwningBinary(std::move(B));
464 if (auto MachObj = dyn_cast<const MachOObjectFile>(Obj))
465 DbgObj = lookUpDsymFile(Path, MachObj, ArchName);
466 // Try to locate the debug binary using .gnu_debuglink section.
468 std::string DebuglinkName;
470 std::string DebugBinaryPath;
471 if (getGNUDebuglinkContents(Obj, DebuglinkName, CRCHash) &&
472 findDebugBinary(Path, DebuglinkName, CRCHash, DebugBinaryPath)) {
473 BinaryOrErr = createBinary(DebugBinaryPath);
474 if (!error(BinaryOrErr.getError())) {
475 OwningBinary<Binary> B = std::move(BinaryOrErr.get());
476 DbgObj = getObjectFileFromBinary(B.getBinary(), ArchName);
477 addOwningBinary(std::move(B));
484 ObjectPair Res = std::make_pair(Obj, DbgObj);
485 ObjectPairForPathArch[std::make_pair(Path, ArchName)] = Res;
490 LLVMSymbolizer::getObjectFileFromBinary(Binary *Bin,
491 const std::string &ArchName) {
494 ObjectFile *Res = nullptr;
495 if (MachOUniversalBinary *UB = dyn_cast<MachOUniversalBinary>(Bin)) {
496 const auto &I = ObjectFileForArch.find(
497 std::make_pair(UB, ArchName));
498 if (I != ObjectFileForArch.end())
500 ErrorOr<std::unique_ptr<ObjectFile>> ParsedObj =
501 UB->getObjectForArch(ArchName);
503 Res = ParsedObj.get().get();
504 ParsedBinariesAndObjects.push_back(std::move(ParsedObj.get()));
506 ObjectFileForArch[std::make_pair(UB, ArchName)] = Res;
507 } else if (Bin->isObject()) {
508 Res = cast<ObjectFile>(Bin);
514 LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName) {
515 const auto &I = Modules.find(ModuleName);
516 if (I != Modules.end())
517 return I->second.get();
518 std::string BinaryName = ModuleName;
519 std::string ArchName = Opts.DefaultArch;
520 size_t ColonPos = ModuleName.find_last_of(':');
521 // Verify that substring after colon form a valid arch name.
522 if (ColonPos != std::string::npos) {
523 std::string ArchStr = ModuleName.substr(ColonPos + 1);
524 if (Triple(ArchStr).getArch() != Triple::UnknownArch) {
525 BinaryName = ModuleName.substr(0, ColonPos);
529 ObjectPair Objects = getOrCreateObjects(BinaryName, ArchName);
531 if (!Objects.first) {
532 // Failed to find valid object file.
533 Modules.emplace(ModuleName, nullptr);
536 std::unique_ptr<DIContext> Context;
537 if (auto CoffObject = dyn_cast<COFFObjectFile>(Objects.first)) {
538 // If this is a COFF object, assume it contains PDB debug information. If
539 // we don't find any we will fall back to the DWARF case.
540 std::unique_ptr<IPDBSession> Session;
541 PDB_ErrorCode Error = loadDataForEXE(PDB_ReaderType::DIA,
542 Objects.first->getFileName(), Session);
543 if (Error == PDB_ErrorCode::Success) {
544 Context.reset(new PDBContext(*CoffObject, std::move(Session)));
548 Context.reset(new DWARFContextInMemory(*Objects.second));
550 auto Info = llvm::make_unique<ModuleInfo>(Objects.first, std::move(Context));
551 ModuleInfo *Res = Info.get();
552 Modules.emplace(ModuleName, std::move(Info));
556 std::string LLVMSymbolizer::printDILineInfo(DILineInfo LineInfo,
557 ModuleInfo *ModInfo) const {
558 // By default, DILineInfo contains "<invalid>" for function/filename it
559 // cannot fetch. We replace it to "??" to make our output closer to addr2line.
560 static const std::string kDILineInfoBadString = "<invalid>";
561 std::stringstream Result;
562 if (Opts.PrintFunctions != FunctionNameKind::None) {
563 std::string FunctionName = LineInfo.FunctionName;
564 if (FunctionName == kDILineInfoBadString)
565 FunctionName = kBadString;
566 else if (Opts.Demangle)
567 FunctionName = DemangleName(FunctionName, ModInfo);
568 Result << FunctionName << "\n";
570 std::string Filename = LineInfo.FileName;
571 if (Filename == kDILineInfoBadString)
572 Filename = kBadString;
573 Result << Filename << ":" << LineInfo.Line << ":" << LineInfo.Column << "\n";
577 // Undo these various manglings for Win32 extern "C" functions:
580 // fastcall - @foo@12
581 // vectorcall - foo@@12
582 // These are all different linkage names for 'foo'.
583 static StringRef demanglePE32ExternCFunc(StringRef SymbolName) {
584 // Remove any '_' or '@' prefix.
585 char Front = SymbolName.empty() ? '\0' : SymbolName[0];
586 if (Front == '_' || Front == '@')
587 SymbolName = SymbolName.drop_front();
589 // Remove any '@[0-9]+' suffix.
591 size_t AtPos = SymbolName.rfind('@');
592 if (AtPos != StringRef::npos &&
593 std::all_of(SymbolName.begin() + AtPos + 1, SymbolName.end(),
594 [](char C) { return C >= '0' && C <= '9'; })) {
595 SymbolName = SymbolName.substr(0, AtPos);
599 // Remove any ending '@' for vectorcall.
600 if (SymbolName.endswith("@"))
601 SymbolName = SymbolName.drop_back();
606 #if !defined(_MSC_VER)
607 // Assume that __cxa_demangle is provided by libcxxabi (except for Windows).
608 extern "C" char *__cxa_demangle(const char *mangled_name, char *output_buffer,
609 size_t *length, int *status);
612 std::string LLVMSymbolizer::DemangleName(const std::string &Name,
613 ModuleInfo *ModInfo) {
614 #if !defined(_MSC_VER)
615 // We can spoil names of symbols with C linkage, so use an heuristic
616 // approach to check if the name should be demangled.
617 if (Name.substr(0, 2) == "_Z") {
619 char *DemangledName = __cxa_demangle(Name.c_str(), nullptr, nullptr, &status);
622 std::string Result = DemangledName;
627 if (!Name.empty() && Name.front() == '?') {
628 // Only do MSVC C++ demangling on symbols starting with '?'.
629 char DemangledName[1024] = {0};
630 DWORD result = ::UnDecorateSymbolName(
631 Name.c_str(), DemangledName, 1023,
632 UNDNAME_NO_ACCESS_SPECIFIERS | // Strip public, private, protected
633 UNDNAME_NO_ALLOCATION_LANGUAGE | // Strip __thiscall, __stdcall, etc
634 UNDNAME_NO_THROW_SIGNATURES | // Strip throw() specifications
635 UNDNAME_NO_MEMBER_TYPE | // Strip virtual, static, etc specifiers
636 UNDNAME_NO_MS_KEYWORDS | // Strip all MS extension keywords
637 UNDNAME_NO_FUNCTION_RETURNS); // Strip function return types
638 return (result == 0) ? Name : std::string(DemangledName);
641 if (ModInfo->isWin32Module())
642 return std::string(demanglePE32ExternCFunc(Name));
646 } // namespace symbolize