[lldb-dev] hang bug in lldb-mi -var-update

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Fri Aug 25 14:59:51 PDT 2017


lldb-mi should never be checking the children. This is never a good idea due to performance. What happens when you have an array with a million entries? Long delay. Aggregate types should never say they changed. Only SBValue objects that have values should claim to change.

Greg


> On Aug 25, 2017, at 10:42 AM, Ted Woodward via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> I found a hang in lldb-mi's -var-update. It checks to see if a var changed,
> then it checks each of the children recursively. If a child is a pointer
> back to a parent, as in this case:
> 
> struct complex_type
> {
>    int i;
>    struct { long l; } inner;
>    struct complex_type *complex_ptr;
> };
> 
> void
> var_update_test(void)
> {
>    struct complex_type complx_array[2];
> 
>    complx_array[0].i = 4;
>    complx_array[0].inner.l = 4;
>    complx_array[0].complex_ptr = &complx_array[1];
>    complx_array[1].i = 5;
>    complx_array[1].inner.l = 5;
>    complx_array[1].complex_ptr = &complx_array[0];
> 
> 
> 
> the code in CMICmdCmdVarUpdate::ExamineSBValueForChange will get into an
> infinite loop.
> 
>  const MIuint nChildren = vrwValue.GetNumChildren();
>  for (MIuint i = 0; i < nChildren; ++i) {
>    lldb::SBValue member = vrwValue.GetChildAtIndex(i);
>    if (!member.IsValid())
>      continue;
> 
>    if (member.GetValueDidChange()) {
>      vrwbChanged = true;
>      return MIstatus::success;
>    } else if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged)
>      // Handle composite types (i.e. struct or arrays)
>      return MIstatus::success;
>  }
> 
> I've got a patch that disables checking a pointer's children. I'll put it up
> on phabricator today.
> 
> Ted
> 
> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
> Linux Foundation Collaborative Project
> 
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev



More information about the lldb-dev mailing list