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

Aaron Smith via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 27 12:46:27 PDT 2018


asmith created this revision.
asmith added reviewers: aleksandr.urakov, zturner, lldb-commits.
Herald added a subscriber: erik.pilkington.

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.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D52626

Files:
  include/lldb/Core/RichManglingContext.h
  unittests/Core/RichManglingContextTest.cpp


Index: unittests/Core/RichManglingContextTest.cpp
===================================================================
--- unittests/Core/RichManglingContextTest.cpp
+++ unittests/Core/RichManglingContextTest.cpp
@@ -57,6 +57,29 @@
   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) {
Index: include/lldb/Core/RichManglingContext.h
===================================================================
--- include/lldb/Core/RichManglingContext.h
+++ include/lldb/Core/RichManglingContext.h
@@ -64,7 +64,6 @@
   /// 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;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52626.167378.patch
Type: text/x-patch
Size: 1608 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180927/4b6b2c08/attachment.bin>


More information about the lldb-commits mailing list