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

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 7 10:50:17 PST 2022


JDevlieghere accepted this revision.
JDevlieghere added inline comments.
This revision is now accepted and ready to land.


================
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:
> 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?
Sounds reasonable to me


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