[Lldb-commits] [lldb] [lldb] Resolve ObjC property backing storage in dwim-print (PR #225204)

Augusto Noronha via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 25 16:11:24 PDT 2026


https://github.com/augusto2112 commented:

First review pass. 

I think that we will unfortunately have to open an additional debug info change before continuing this work. We need to restrict the emission of the backing storage to accessor stubs only. Otherwise, if the getter is handwritten, and does more than literally returning the variable, `p variable` will print the wrong thing. Here's an example of how things can go wrong:

```
  @interface Lazy : NSObject
  @property(nonatomic) int computed;
  @end
  @implementation Lazy                
  - (int)computed { return _computed * 100; }
  @end


  With the PR:
  (lldb) p lazy.computed
  note: ran `frame variable lazy._computed`
  (int) 3

  Baseline:
  (lldb) p lazy.computed
  note: ran `expression -- lazy.computed`
  (int) 300
```


Can you open a new patch in the objc compiler restricting the emission of the new attribute to synthesized accessor stubs?

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


More information about the lldb-commits mailing list