[lldb-dev] SBValues that are synthetic has API issues when trying to get the child by name:

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Tue Apr 7 18:09:06 PDT 2020


Definitely a bug.  ValueObjectSynthetic overrides both GetChildMemberWithName and GetIndexOfChildWithName so that if you have a synthetic value, it will look in the synthetic children to match the name, not in the underlying value's type.  Not sure why this isn’t working.

Jim



> On Apr 7, 2020, at 5:34 PM, Greg Clayton via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
>   3   	int main(int argc, const char **argv) {
>   4   	  std::atomic<int> ai;
>   5   	  ai = argc;
> -> 6   	  ai = argc + 1;
>   7   	  return 0;
>   8   	}
> 
> 
> (lldb) fr var ai
> (std::atomic<int>) ai = {
>  Value = 1
> }
> (lldb) frame var --raw ai
> (std::__1::atomic<int>) ai = {
>  std::__1::__atomic_base<int, true> = {
>    std::__1::__atomic_base<int, false> = {
>      __a_ = 1
>    }
>  }
> }
> 
> So we have a synthetic child provider. But if we do:
> 
> (lldb) script
>>>> v = lldb.frame.FindVariable('ai')
>>>> print(v.GetNumChildren())
> 1
>>>> print(v.GetChildAtIndex(0))
> (int) Value = 1
> 
> But if we ask for it by name it doesn't work:
> 
>>>> print(v.GetChildMemberWithName('Value'))
> No value
> 
> Bug? Intentional?
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev



More information about the lldb-dev mailing list