[Lldb-commits] [lldb] Bugfix: Not showing the synthetic children of values behind pointers (PR #117755)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 26 12:13:28 PST 2024


https://github.com/clayborg commented:

None of this should be needed. If we have a child value that is a pointer to a synthetic value, and we expand that value, we should be showing the synthetic children via the standard LLDB APIs. 

In LLDB way back in the beginning, when we would expand a pointer, we would show the first child as the dereferenced value and its name would be "*<ptr-name>". And then if you expanded that, then you would see the contents. So if we had this code:
```
struct Point { int x,y; };
int my_int = 12
Point pt = {1,2};
Point *pt_ptr = &pt;
int *my_int_ptr = &i;
```
Old LLDB would show this as:
```
pt_ptr
  \_ *pt_ptr
      |- x = 1
      \- y = 2
my_int_ptr
  \_ 12
```
Current LLDB, when you expand a pointer, will look at the type and see if the type has children, and if it does, it will auto dereference the type:
```
pt_ptr
   |- x = 1
   \- y = 2
my_int_ptr
  \_ 12
```
And if the dereferenced value has a synthetic child provider, it should be grabbing that synthetic value and asking it for its children.

So this isn't the right fix for this. It works for C++. We need to figure out why it isn't working for your language

<img width="779" alt="Screenshot 2024-11-26 at 12 12 44 PM" src="https://github.com/user-attachments/assets/7a548b5b-9b94-4dbe-9060-9fb0e0416730">


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


More information about the lldb-commits mailing list