[Lldb-commits] [lldb] r343292 - [lldb] Remove an assertion in RichManglingContext::GetBufferRef() hit when debugging a native x86 Windows process

Aaron Smith via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 27 19:33:51 PDT 2018


Author: asmith
Date: Thu Sep 27 19:33:51 2018
New Revision: 343292

URL: http://llvm.org/viewvc/llvm-project?rev=343292&view=rev
Log:
[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

Modified:
    lldb/trunk/include/lldb/Core/RichManglingContext.h
    lldb/trunk/unittests/Core/RichManglingContextTest.cpp

Modified: lldb/trunk/include/lldb/Core/RichManglingContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RichManglingContext.h?rev=343292&r1=343291&r2=343292&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/RichManglingContext.h (original)
+++ lldb/trunk/include/lldb/Core/RichManglingContext.h Thu Sep 27 19:33:51 2018
@@ -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;
   }
 

Modified: lldb/trunk/unittests/Core/RichManglingContextTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/RichManglingContextTest.cpp?rev=343292&r1=343291&r2=343292&view=diff
==============================================================================
--- lldb/trunk/unittests/Core/RichManglingContextTest.cpp (original)
+++ lldb/trunk/unittests/Core/RichManglingContextTest.cpp Thu Sep 27 19:33:51 2018
@@ -57,6 +57,29 @@ TEST(RichManglingContextTest, FromCxxMet
   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) {




More information about the lldb-commits mailing list