[Lldb-commits] [lldb] r163946 - /lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp

Enrico Granata egranata at apple.com
Fri Sep 14 15:41:44 PDT 2012


Author: enrico
Date: Fri Sep 14 17:41:44 2012
New Revision: 163946

URL: http://llvm.org/viewvc/llvm-project?rev=163946&view=rev
Log:
Fixing a potential crasher where the new C++ synthetic children can return a NULL FrontEnd and cause LLDB to crash. This patch introduces a dummy front-end which the ValueObjectSynthetic can use lacking a real FrontEnd

Modified:
    lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp

Modified: lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp?rev=163946&r1=163945&r2=163946&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp Fri Sep 14 17:41:44 2012
@@ -19,6 +19,39 @@
 
 using namespace lldb_private;
 
+class DummySyntheticFrontEnd : public SyntheticChildrenFrontEnd
+{
+public:
+    DummySyntheticFrontEnd(ValueObject &backend) :
+    SyntheticChildrenFrontEnd(backend)
+    {}
+
+    uint32_t
+    CalculateNumChildren()
+    {
+        return 0;
+    }
+    
+    lldb::ValueObjectSP
+    GetChildAtIndex (uint32_t idx)
+    {
+        return lldb::ValueObjectSP();
+    }
+    
+    uint32_t
+    GetIndexOfChildWithName (const ConstString &name)
+    {
+        return UINT32_MAX;
+    }
+    
+    bool
+    Update()
+    {
+        return false;
+    }
+
+};
+
 ValueObjectSynthetic::ValueObjectSynthetic (ValueObject &parent, lldb::SyntheticChildrenSP filter) :
     ValueObject(parent),
     m_synth_sp(filter),
@@ -34,6 +67,8 @@
 #else
     SetName(parent.GetName());
 #endif
+    if (!m_synth_filter_ap.get())
+        m_synth_filter_ap.reset(new DummySyntheticFrontEnd(parent));
 }
 
 ValueObjectSynthetic::~ValueObjectSynthetic()





More information about the lldb-commits mailing list