[Lldb-commits] [PATCH] D92643: [lldb] Lookup static const members in FindGlobalVariables

Andy Yankovsky via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Mar 13 05:26:32 PST 2021

werat marked 4 inline comments as done.
werat added inline comments.

Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:2162
 void SymbolFileDWARF::FindGlobalVariables(const RegularExpression &regex,
                                           uint32_t max_matches,
jankratochvil wrote:
> jankratochvil wrote:
> > ConstString here is needlessly expensive to construct and it is then used only once. Use plain `const char *` or `std::string` is also much cheaper.
> This function also needs to be patched (with a testcase) as this command works:
> ```
> (lldb) target variable Vars::inline_static
> (double) Vars::inline_static = 1.5
> ```
> But this one does not (and it should work):
> ```
> (lldb) target variable -r Vars::inline_static
> error: can't find global variable 'Vars::inline_static'
> ```
With the current approach implementing a search by regexp would mean enumerating ALL types and looking at ALL their static members for a potential match. This sounds way to expensive (and a significant degradation compared to the current logic). On the other hand I agree that's very confusing that `target variable` works, but `target variable -r` doesn't. What do you think?

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list