mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 01:58:44 +08:00
[lldb/Core] Fix crash in ValueObject::CreateChildAtIndex
The patch fixes a crash in ValueObject::CreateChildAtIndex caused by a null pointer dereferencing. This is a corner case that is happening when trying to dereference a variable with an incomplete type, and this same variable doesn't have a synthetic value to get the child ValueObject. If this happens, lldb will now return a null pointer that will results in an error message. rdar://65181171 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
@@ -687,10 +687,15 @@ ValueObject *ValueObject::CreateChildAtIndex(size_t idx,
|
||||
language_flags);
|
||||
}
|
||||
|
||||
if (!valobj && synthetic_array_member)
|
||||
valobj = GetSyntheticValue()
|
||||
->GetChildAtIndex(synthetic_index, synthetic_array_member)
|
||||
.get();
|
||||
// In case of an incomplete type, LLDB will try to use the ValueObject's
|
||||
// synthetic value to create the child ValueObject.
|
||||
if (!valobj && synthetic_array_member) {
|
||||
if (ValueObjectSP synth_valobj_sp = GetSyntheticValue()) {
|
||||
valobj = synth_valobj_sp
|
||||
->GetChildAtIndex(synthetic_index, synthetic_array_member)
|
||||
.get();
|
||||
}
|
||||
}
|
||||
|
||||
return valobj;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user