[lldb-dev] parent is NULL error

Greg Clayton gclayton at apple.com
Wed Nov 23 09:34:31 PST 2011


You can check if a value is a pointer using:

bool
SBValue::TypeIsPointerType ();

If you are using a more up to date LLDB that ha

value.GetType().IsPointerType();

Then you can check the pointer value to see if you really want to show the children. We will always return the number of children that a SBValue's type has even if the value is invalid because you might have expanded a pointer value before and the UI is remembering a user expansion state. The latest LLDB's also have a "get value as unsigned" convenience function:

    
    uint64_t
    SBValue::GetValueAsUnsigned(uint64_t fail_value=0);


so you could do something like:

if (value.TypeIsPointerType() && value.GetValueAsUnsigned() == 0)
{
    // NULL pointer....
}
else
{
}



On Nov 22, 2011, at 2:34 PM, Andrey Zaytsev wrote:

> Hi!
> I'm always getting this error when trying to expand children of NULL pointer. But SBValue::GetChildrenCount() doesn't return zero.
> It produces some trouble in our frontend: we are trying to be lazy and not discover value's children when it's not needed by user explicitly but we indicate that children are present since GetChildrenCount() != 0. Any workaround maybe?
> 
> Andrey Zaytsev
> Software Developer at  JetBrains, Inc 
> http://jetbrains.com
> Develop with pleasure!
> 
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev




More information about the lldb-dev mailing list