diff options
| author | Enrico Granata <egranata@apple.com> | 2012-09-14 22:41:44 +0000 |
|---|---|---|
| committer | Enrico Granata <egranata@apple.com> | 2012-09-14 22:41:44 +0000 |
| commit | 01fd9804cb8b67d37c094797818b319800812b15 (patch) | |
| tree | 66c38488faf98320bae9167972832f80dfc2c735 | |
| parent | 8d26bc38f54eeb877942cefd865cc2000479be2b (diff) | |
| download | bcm5719-llvm-01fd9804cb8b67d37c094797818b319800812b15.tar.gz bcm5719-llvm-01fd9804cb8b67d37c094797818b319800812b15.zip | |
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
llvm-svn: 163946
| -rw-r--r-- | lldb/source/Core/ValueObjectSyntheticFilter.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp index b5c29bc5e50..dc85fddbf0d 100644 --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -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 @@ ValueObjectSynthetic::ValueObjectSynthetic (ValueObject &parent, lldb::Synthetic #else SetName(parent.GetName()); #endif + if (!m_synth_filter_ap.get()) + m_synth_filter_ap.reset(new DummySyntheticFrontEnd(parent)); } ValueObjectSynthetic::~ValueObjectSynthetic() |

