[Lldb-commits] [PATCH] D71310: RFC: Remove "Validators"

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 10 16:08:23 PST 2019


jingham added a comment.

Adrian and I talked about this some more.  Apparently the idea was that you have some type Foo and you want to look for some error state in instances of that type (Foo::a + Foo::b < 10).  So you add a Type Validator for Foo that does this check, and every time lldb prints a variable of type Foo, it will run the Validator on it, and if it fails validation, then the printer will print an ! at the beginning of the printing, and also there's an SB API to get whether the Value passed the validator.

So then you could just debug along, and either look for the ! in the printing, or add a stop hook that checks the Validator result on all locals, and if you ever saw the error state, you would know to investigate further.  That's actually a pretty neat idea.

The current state of the code is that there is actually no way to add a Type Validator.  To be really useful, there would need to be a way to create a scripted validator, so the Python bindings and some command/SB API to register the validator.

The implementation is a little cut-and-paste too.  It shares all the same options with the Synthetic child provider & Summaries (skips pointers, cascade, etc.) but I don't think you would ever want a type validator that would only validate references to a type, but not the type itself.  And then the implementation is very cut & paste.  So I'm fine with deleting this for now, but maybe adding it as an interesting project idea to the Projects page - with a reference to the hash of this commit as a starting point?

It's a neat idea but it's also been 5 years now and it was never made useful...


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

https://reviews.llvm.org/D71310





More information about the lldb-commits mailing list