[Lldb-commits] [PATCH] D155334: [lldb] Make frame var --regex always search globals
Felipe de Azevedo Piovezan via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Jul 14 13:07:43 PDT 2023
fdeazeve created this revision.
Herald added a project: All.
fdeazeve requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Currently frame var --regex sometimes searches globals, sometimes it doesn't.
This happens because `StackFrame::GetVariableList` always returns the biggest
list it has, regardless of whether only globals were requested or not. In other
words, if a previous call to `GetVariableList` requested globals, all subsequent
calls will see them.
The implication here is that users of `StackFrame::GetVariableList` are expected
to filter the results of this function. This is what we do for a vanilla
`frame var` command. But it is not what we do when `--regex` is used. This
commit solves the issue by:
1. Making `--regex` imply `--globals`. This matches the behavior of `frame var
<some_name>`, which will also search the global scope.
2. Making the `--regex` search respect the command object options.
See the added test for an example of the oddities this patch addresses. Without
the patch, the test fails. However it could be made to pass by calling a plain
`frame var` before calling `frame var --regex A::`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155334
Files:
lldb/include/lldb/Symbol/VariableList.h
lldb/source/Commands/CommandObjectFrame.cpp
lldb/test/API/commands/frame/var/TestFrameVar.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155334.540546.patch
Type: text/x-patch
Size: 7384 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230714/971dae4a/attachment-0001.bin>
More information about the lldb-commits
mailing list