[Lldb-commits] [lldb] [lldb] Make ValueObject::Dereference less aggressive (PR #137311)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 28 08:23:01 PDT 2025


labath wrote:

> So the difference is that if `value->Dereference` fails, the user should try to manually dereference a synthetic value?

If that's what they want, yes.

> Are there no other users of this function other than the ones you addressed in this patch? What about some Python code somewhere?

Inside lldb - no. It's of course possible there's python code out there which depends on this bug, but I'm saying that's what it is -- a bug. For other operations, you have to choose whether you want to access the synthetic or non-synthetic view of the value. For example, this is what you get with a vector variable:
```
(lldb) script lldb.frame.FindVariable("v").GetChildMemberWithName("_M_impl")
No value
(lldb) script lldb.frame.FindVariable("v").GetNonSyntheticValue().GetChildMemberWithName("_M_impl")
(std::_Vector_base<int, std::allocator<int> >::_Vector_impl) _M_impl = {
  std::_Vector_base<int, std::allocator<int> >::_Vector_impl_data = {
    _M_start = 0x000055555556b2b0
    _M_finish = 0x000055555556b2c4
    _M_end_of_storage = 0x000055555556b2c4
  }
}
(lldb) script lldb.frame.FindVariable("v").GetNonSyntheticValue().GetChildMemberWithName("[0]")
No value
(lldb) script lldb.frame.FindVariable("v").GetChildMemberWithName("[0]")
(int) [0] = 1
```

This makes `Dereference()` behave the same way (or at least, brings it closer to that).

https://github.com/llvm/llvm-project/pull/137311


More information about the lldb-commits mailing list