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

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Tue Apr 7 17:34:11 PDT 2020


   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?


More information about the lldb-dev mailing list