[Lldb-commits] [lldb] [lldb] Limit DIL globals to only current file (PR #192592)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 17 09:20:55 PDT 2026
jimingham wrote:
> > DIL has supported unlimited global lookup, which is in contrast with long standing `frame variable` behavior, which supports only globals in the current file.
>
> One of the main reasons DIL came to be is that it will eventually be used in data formatters, which often need access to global variables.
>
> > For `dwim-print`, the bug manifests as when a global shadows a computed property of the instance variable (`self`). As an example, if a global named `text` exists, and a property named `text` exists (ie `self.text`), then running `dwim-print text` will unexpectedly print the global, not `self.text`.
>
> I guess there are some differences looking up properties in Swift compared to scopes in C++? I think we should try fixing DIL to correctly handle this situation instead of banning looking up global variables, I think it's too useful to just remove.
This needs to be configurable.
For `target var` a lookup in all globals is appropriate. Ditto when you are using DIL for formatters. But for `frame var` - which is supposed to show you what is visible from the current frame - looking up all globals in that use is not appropriate.
https://github.com/llvm/llvm-project/pull/192592
More information about the lldb-commits
mailing list