summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-10-16 20:38:44 +0000
committerMartin Storsjo <martin@martin.st>2019-10-16 20:38:44 +0000
commita4f6b598462e39107aecad1f8d4fb1cfd7583580 (patch)
tree1f3b9b84ed4d1a6c4ee9f9f2061a5bbd2153c0e4 /llvm/lib/DebugInfo
parentac77947315c5cf9a79b1aa5b813baaa2d018cbe3 (diff)
downloadbcm5719-llvm-a4f6b598462e39107aecad1f8d4fb1cfd7583580.tar.gz
bcm5719-llvm-a4f6b598462e39107aecad1f8d4fb1cfd7583580.zip
[Symbolize] Use the local MSVC C++ demangler instead of relying on dbghelp. NFC.
This allows making a couple llvm-symbolizer tests run in all environments. Differential Revision: https://reviews.llvm.org/D68133 llvm-svn: 375041
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/Symbolize/Symbolize.cpp36
1 files changed, 11 insertions, 25 deletions
diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
index 7138f66271b..be79d9e637c 100644
--- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
@@ -35,19 +35,6 @@
#include <cassert>
#include <cstring>
-#if defined(_MSC_VER)
-#include <Windows.h>
-
-// This must be included after windows.h.
-#include <DbgHelp.h>
-#pragma comment(lib, "dbghelp.lib")
-
-// Windows.h conflicts with our COFF header definitions.
-#ifdef IMAGE_FILE_MACHINE_I386
-#undef IMAGE_FILE_MACHINE_I386
-#endif
-#endif
-
namespace llvm {
namespace symbolize {
@@ -534,21 +521,20 @@ LLVMSymbolizer::DemangleName(const std::string &Name,
return Result;
}
-#if defined(_MSC_VER)
if (!Name.empty() && Name.front() == '?') {
// Only do MSVC C++ demangling on symbols starting with '?'.
- char DemangledName[1024] = {0};
- DWORD result = ::UnDecorateSymbolName(
- Name.c_str(), DemangledName, 1023,
- UNDNAME_NO_ACCESS_SPECIFIERS | // Strip public, private, protected
- UNDNAME_NO_ALLOCATION_LANGUAGE | // Strip __thiscall, __stdcall, etc
- UNDNAME_NO_THROW_SIGNATURES | // Strip throw() specifications
- UNDNAME_NO_MEMBER_TYPE | // Strip virtual, static, etc specifiers
- UNDNAME_NO_MS_KEYWORDS | // Strip all MS extension keywords
- UNDNAME_NO_FUNCTION_RETURNS); // Strip function return types
- return (result == 0) ? Name : std::string(DemangledName);
+ int status = 0;
+ char *DemangledName = microsoftDemangle(
+ Name.c_str(), nullptr, nullptr, &status,
+ MSDemangleFlags(MSDF_NoAccessSpecifier | MSDF_NoCallingConvention |
+ MSDF_NoMemberType | MSDF_NoReturnType));
+ if (status != 0)
+ return Name;
+ std::string Result = DemangledName;
+ free(DemangledName);
+ return Result;
}
-#endif
+
if (DbiModuleDescriptor && DbiModuleDescriptor->isWin32Module())
return std::string(demanglePE32ExternCFunc(Name));
return Name;
OpenPOWER on IntegriCloud