diff options
author | Zachary Turner <zturner@google.com> | 2018-08-29 23:56:09 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2018-08-29 23:56:09 +0000 |
commit | 32a8a2028cb7597cda42eca33dd15860d661f357 (patch) | |
tree | ea1d48736f11b5d9516c7e56633fc459884cde8b /llvm/test/Demangle | |
parent | 3769639335ac3924b24f62c1b4fed6609e0fe988 (diff) | |
download | bcm5719-llvm-32a8a2028cb7597cda42eca33dd15860d661f357.tar.gz bcm5719-llvm-32a8a2028cb7597cda42eca33dd15860d661f357.zip |
[MS Demangler] Fix several crashes and demangling bugs.
These bugs were found by writing a Python script which spidered
the entire Chromium build directory tree demangling every symbol
in every object file. At the start, the tool printed:
Processed 27443 object files.
2926377/2936108 symbols successfully demangled (99.6686%)
9731 symbols could not be demangled (0.3314%)
14589 files crashed while demangling (53.1611%)
After this patch, it prints:
Processed 27443 object files.
41295518/41295617 symbols successfully demangled (99.9998%)
99 symbols could not be demangled (0.0002%)
0 files crashed while demangling (0.0000%)
The issues fixed in this patch are:
* Ignore empty parameter packs. Previously we would encounter
a mangling for an empty parameter pack and add a null node
to the AST. Since we don't print these anyway, we now just
don't add anything to the AST and ignore it entirely. This
fixes some of the crashes.
* Account for "incorrect" string literal demanglings. Apparently
an older version of clang would not truncate mangled string
literals to 32 bytes of encoded character data. The demangling
code however would allocate a 32 byte buffer thinking that it
would not encounter more than this, and overrun the buffer.
We now demangle up to 128 bytes of data, since the buggy
clang would encode up to 32 *characters* of data.
* Extended support for demangling init-fini stubs. If you had
something like
struct Foo {
static vector<string> S;
};
this would generate a dynamic atexit initializer *for the
variable*. We didn't handle this, but now we print something
nice. This is actually an improvement over undname, which will
fail to demangle this at all.
* Fixed one case of static this adjustment. We weren't handling
several thunk codes so we didn't recognize the mangling. These
are now handled.
* Fixed a back-referencing problem. Member pointer templates
should have their components considered for back-referencing
The remaining 99 symbols which can't be demangled are all symbols
which are compiler-generated and undname can't demangle either.
llvm-svn: 341000
Diffstat (limited to 'llvm/test/Demangle')
-rw-r--r-- | llvm/test/Demangle/ms-back-references.test | 3 | ||||
-rw-r--r-- | llvm/test/Demangle/ms-operators.test | 6 | ||||
-rw-r--r-- | llvm/test/Demangle/ms-string-literals.test | 11 |
3 files changed, 19 insertions, 1 deletions
diff --git a/llvm/test/Demangle/ms-back-references.test b/llvm/test/Demangle/ms-back-references.test index 53bc8b449ed..e04fd846721 100644 --- a/llvm/test/Demangle/ms-back-references.test +++ b/llvm/test/Demangle/ms-back-references.test @@ -169,3 +169,6 @@ ?AddEmitPasses@EmitAssemblyHelper@?A0x43583946@@AEAA_NAEAVPassManager@legacy@llvm@@W4BackendAction@clang@@AEAVraw_pwrite_stream@5@PEAV85@@Z ; CHECK: bool __cdecl `anonymous namespace'::EmitAssemblyHelper::AddEmitPasses(class llvm::legacy::PassManager &, enum clang::BackendAction, class llvm::raw_pwrite_stream &, class llvm::raw_pwrite_stream *) + +??$forward@P8?$DecoderStream@$01@media@@AEXXZ@std@@YA$$QAP8?$DecoderStream@$01@media@@AEXXZAAP812@AEXXZ@Z +; CHECK: void (__thiscall media::DecoderStream<2>::*&& __cdecl std::forward<void (__thiscall media::DecoderStream<2>::*)(void)>(void (__thiscall media::DecoderStream<2>::*&)(void)))(void)
\ No newline at end of file diff --git a/llvm/test/Demangle/ms-operators.test b/llvm/test/Demangle/ms-operators.test index d03d9da7eb0..ad3d87807b4 100644 --- a/llvm/test/Demangle/ms-operators.test +++ b/llvm/test/Demangle/ms-operators.test @@ -161,6 +161,9 @@ ??_EBase@@UEAAPEAXI@Z ; CHECK: virtual void * __cdecl Base::`vector deleting dtor'(unsigned int) +??_EBase@@G3AEPAXI@Z +; CHECK: [thunk]: void * __thiscall Base::`vector deleting dtor'`adjustor{4}'(unsigned int) + ??_F?$SomeTemplate@H@@QAEXXZ ; CHECK: void __thiscall SomeTemplate<int>::`default ctor closure'(void) @@ -224,6 +227,9 @@ ??__FFoo@@YAXXZ ; CHECK: void __cdecl `dynamic atexit destructor for 'Foo''(void) +??__F_decisionToDFA@XPathLexer@@0V?$vector@VDFA@dfa@antlr4@@V?$allocator@VDFA@dfa@antlr4@@@std@@@std@@A@YAXXZ +; CHECK: void __cdecl `dynamic atexit destructor for `static class std::vector<class antlr4::dfa::DFA, class std::allocator<class antlr4::dfa::DFA>> XPathLexer::_decisionToDFA''(void) + ??__K_deg@@YAHO@Z ; CHECK: int __cdecl operator ""_deg(long double) diff --git a/llvm/test/Demangle/ms-string-literals.test b/llvm/test/Demangle/ms-string-literals.test index 77a1882b49d..132637c267d 100644 --- a/llvm/test/Demangle/ms-string-literals.test +++ b/llvm/test/Demangle/ms-string-literals.test @@ -761,4 +761,13 @@ ; CHECK: const char16_t * {u"012345678901234"} ??_C@_0CA@KFPHPCC@0?$AA?$AA?$AA1?$AA?$AA?$AA2?$AA?$AA?$AA3?$AA?$AA?$AA4?$AA?$AA?$AA5?$AA?$AA?$AA6?$AA?$AA?$AA?$AA?$AA?$AA?$AA@ -; CHECK: const char32_t * {U"0123456"}
\ No newline at end of file +; CHECK: const char32_t * {U"0123456"} + +; There are too many bytes encoded in this string literal (it should encode a max of 32 bytes) +; but some buggy compilers will incorrectly generate this, so we need to be able to demangle +; both the correct and incorrect versions. +??_C@_0CG@HJGBPLNO@l?$AAo?$AAo?$AAk?$AAA?$AAh?$AAe?$AAa?$AAd?$AAH?$AAa?$AAr?$AAd?$AAB?$AAr?$AAe?$AAa?$AAk?$AA?$AA?$AA@ +; CHECK: const char16_t * {u"lookAheadHardBreak"} + +??_C@_0CG@HJGBPLNO@l?$AAo?$AAo?$AAk?$AAA?$AAh?$AAe?$AAa?$AAd?$AAH?$AAa?$AAr?$AAd?$AAB?$AAr?$AAe?$AA@ +; CHECK: const char16_t * {u"lookAheadHardBre"...}
\ No newline at end of file |