[Lldb-commits] [PATCH] D116788: [lldb] Set result error state in 'frame variable'

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 6 20:04:06 PST 2022


kastiglione added a subscriber: jingham.
kastiglione added inline comments.


================
Comment at: lldb/source/Commands/CommandObjectFrame.cpp:560-563
               } else if (num_matches == 0) {
-                result.GetErrorStream().Printf("error: no variables matched "
-                                               "the regular expression '%s'.\n",
-                                               entry.c_str());
+                result.AppendErrorWithFormat(
+                    "no variables matched the regular expression '%s'.",
+                    entry.c_str());
----------------
kastiglione wrote:
> this regex error is a weird edge case. For example, considering running:
> 
> ```
> frame var --regex matchesSomeVars doesntMatchAnyVars
> ```
> 
> if the `doesntMatchAnyVars` pattern has no matches, then the command prints an error, and the result would be marked as an error. But if the `matchesSomeVars` does have matches, then we have a partial success / partial failure. In such a case, should the result be marked success, or failure? I don't know, but I would lean to success since it does entirely fail. Maybe a user could expect some patterns to match and some to not match. For example: a user alias that prints any variables based on a set of patterns they're interested in.
I think this could be changed to a warning. @jingham what do you think?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116788



More information about the lldb-commits mailing list