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:
- Making --regex imply --globals. This matches the behavior of `frame var
<some_name>`, which will also search the global scope.
- 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::.
This is easier to parse if you say "Finds all the variables in all_variables"...