Fix tuple getter in std unique pointer pretty-printer

Summary: Check case when _M_t child member is not present.

Reviewers: labath, tberghammer

Reviewed By: labath, tberghammer

Differential Revision: https://reviews.llvm.org/D47932
Patch by Aleksandr Urakov <aleksandr.urakov@jetbrains.com>.

llvm-svn: 334411
This commit is contained in:
Pavel Labath 2018-06-11 14:52:52 +00:00
parent 4410e2c43f
commit cb512a3072
3 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,5 @@
import lldbsuite.test.lldbinline as lldbinline
from lldbsuite.test.decorators import *
lldbinline.MakeInlineTest(__file__, globals(), [no_debug_info_test])

View File

@ -0,0 +1,11 @@
// Test that we don't crash when trying to pretty-print structures that don't
// have the layout our data formatters expect.
namespace std {
template<typename T, typename Deleter = void>
class unique_ptr {};
}
int main() {
std::unique_ptr<int> U;
return 0; //% self.expect("frame variable U", substrs=["unique_ptr", "{}"])
}

View File

@ -67,6 +67,8 @@ ValueObjectSP LibStdcppUniquePtrSyntheticFrontEnd::GetTuple() {
ValueObjectSP obj_child_sp = ValueObjectSP obj_child_sp =
valobj_sp->GetChildMemberWithName(ConstString("_M_t"), true); valobj_sp->GetChildMemberWithName(ConstString("_M_t"), true);
if (!obj_child_sp)
return nullptr;
ValueObjectSP obj_subchild_sp = ValueObjectSP obj_subchild_sp =
obj_child_sp->GetChildMemberWithName(ConstString("_M_t"), true); obj_child_sp->GetChildMemberWithName(ConstString("_M_t"), true);