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

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 10 16:59:39 PST 2022


clayborg added a comment.

In D116788#3232105 <https://reviews.llvm.org/D116788#3232105>, @kastiglione wrote:

> In D116788#3231612 <https://reviews.llvm.org/D116788#3231612>, @clayborg wrote:
>
>> I would vote that if any argument or option is specified, and results in something not being found, that an error be returned.
>
> Is this in response to my question about regexes? It seems to be. Specifically, you're of the opinion that any failing regex results in an error, even when other regexes do match? Your point about it not affecting the command line is a good point, thanks.

It is about anything that can't be properly displayed when asked. So lets pretend we have only two variables available "a" and "b". Any of these should return an error:

  (lldb) frame variable bad // No variable named bad, so return an error like "no variables found that match 'bad'"
  (lldb) frame variable a bad // No variable named bad, so return an error like "no variables found that match 'bad'" though we would display the value for "a" followed by the error message
  (lldb) frame variable a bad b // No variable named bad, so return an error like "no variables found that match 'bad'" though we would display the value for "a" followed by the error message and followed by "b"'s value
  (lldb) frame variable --regex b bad // regex "b" will match, but not regex "bad", so an error like "no matches found for regex 'bad'" should be returned
  (lldb) frame variable --regex bad worse // neither regex will match, so an error like "no matches found for regex 'bad' and 'worse'" should be returned

If the user really wants to find either "a" or "bad", they can modify their regex so that it succeeds when it can since it would match a or bad:

  (lldb) frame variable --regex "a|bad"

Or they can do separate invocations to ensure it succeeds or fails correctly.

So any argument that is specified that has no matches should produce an error. I am open to suggestions here, as these are just my initial thoughts.

> All your other points sound good to me too.
>
>> Any tests that are failing now when they didn't before can be modified.
>
> Yes there were a couple, D116901 <https://reviews.llvm.org/D116901> and D116863 <https://reviews.llvm.org/D116863>.

Nice, those should be easy to fix.

Let me know your thoughts as mine are just my initial thoughts after thinking about things a bit more.


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