diff options
| author | Aaron Smith <aaron.smith@microsoft.com> | 2018-09-28 02:33:51 +0000 |
|---|---|---|
| committer | Aaron Smith <aaron.smith@microsoft.com> | 2018-09-28 02:33:51 +0000 |
| commit | 2fc9c3b05f3f7888d0d263e9ff5f143a7611cd36 (patch) | |
| tree | bb5129b00539c81ef1ed7b143074b94809089a75 | |
| parent | 757274f9b298182b3da4971df5f5d9086a9b90d4 (diff) | |
| download | bcm5719-llvm-2fc9c3b05f3f7888d0d263e9ff5f143a7611cd36.tar.gz bcm5719-llvm-2fc9c3b05f3f7888d0d263e9ff5f143a7611cd36.zip | |
[lldb] Remove an assertion in RichManglingContext::GetBufferRef() hit when debugging a native x86 Windows process
Summary: A RichManglingContext constructed with an invalid demangled name or with a demangled function name without any context will have an empty context. This triggers an assertion in RichManglingContext::GetBufferRef() when debugging a native Windows process on x86 when it shouldn't. Remove the assertion.
Reviewers: aleksandr.urakov, zturner, lldb-commits
Reviewed By: zturner
Subscribers: erik.pilkington
Differential Revision: https://reviews.llvm.org/D52626
llvm-svn: 343292
| -rw-r--r-- | lldb/include/lldb/Core/RichManglingContext.h | 1 | ||||
| -rw-r--r-- | lldb/unittests/Core/RichManglingContextTest.cpp | 23 |
2 files changed, 23 insertions, 1 deletions
diff --git a/lldb/include/lldb/Core/RichManglingContext.h b/lldb/include/lldb/Core/RichManglingContext.h index 393305c3742..30841bfb266 100644 --- a/lldb/include/lldb/Core/RichManglingContext.h +++ b/lldb/include/lldb/Core/RichManglingContext.h @@ -64,7 +64,6 @@ public: /// most recent ParseXy() operation. The next ParseXy() call invalidates it. llvm::StringRef GetBufferRef() const { assert(m_provider != None && "Initialize a provider first"); - assert(m_buffer.data() != nullptr && "Parse first"); return m_buffer; } diff --git a/lldb/unittests/Core/RichManglingContextTest.cpp b/lldb/unittests/Core/RichManglingContextTest.cpp index 19329ac8208..3bb0aaecbed 100644 --- a/lldb/unittests/Core/RichManglingContextTest.cpp +++ b/lldb/unittests/Core/RichManglingContextTest.cpp @@ -57,6 +57,29 @@ TEST(RichManglingContextTest, FromCxxMethodName) { ItaniumRMC.ParseFullName(); CxxMethodRMC.ParseFullName(); EXPECT_TRUE(ItaniumRMC.GetBufferRef() == CxxMethodRMC.GetBufferRef()); + + // Construct with a random name. + { + RichManglingContext CxxMethodRMC; + EXPECT_TRUE(CxxMethodRMC.FromCxxMethodName(ConstString("X"))); + + // We expect it is not a function. + EXPECT_FALSE(CxxMethodRMC.IsFunction()); + } + + // Construct with a function without a context. + { + RichManglingContext CxxMethodRMC; + EXPECT_TRUE(CxxMethodRMC.FromCxxMethodName( + ConstString("void * operator new(unsigned __int64)"))); + + // We expect it is a function. + EXPECT_TRUE(CxxMethodRMC.IsFunction()); + + // We expect its context is empty. + CxxMethodRMC.ParseFunctionDeclContextName(); + EXPECT_TRUE(CxxMethodRMC.GetBufferRef().empty()); + } } TEST(RichManglingContextTest, SwitchProvider) { |

