[Lldb-commits] [PATCH] D155334: [lldb] Make frame var --regex always search globals

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 19 10:40:08 PDT 2023


jingham requested changes to this revision.
jingham added a comment.
This revision now requires changes to proceed.

LGTM, with a couple suggestions.

You did add a check for requested scope when applying the regex which was missing in the original implementation.  That's correct, but I don't think you added a direct test for this addition.  Maybe something like stop in main and do:

frame var --regex argc --no-args

that should return no matches with you change, as it should.



================
Comment at: lldb/source/Commands/CommandObjectFrame.cpp:502
 
+  /// Finds all variables in `all_variables` whose name matches `regex`,
+  /// inserting them into `matches`. Variables already contained in `matches`
----------------
This is easier to parse if you say "Finds all the variables in `all_variables`"...


================
Comment at: lldb/test/API/commands/frame/var/TestFrameVar.py:61
 
+        # Ensure --regex can find globals if it is the very first frame var command.
+        result = interp.HandleCommand("frame var --regex g_", command_result)
----------------
You can also do this with `self.expect`, in this case using substr in this case:

self.expect("frame var --regex g_", substr="g_var")


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155334/new/

https://reviews.llvm.org/D155334



More information about the lldb-commits mailing list