gdbarch: improve generation of validation in gdbarch getters
We currently generate some validation code within the gdbarch getter
methods.
This commit adjusts the algorithm used to generate this validation
slightly to make the gdbarch.py code (I think) clearer; there's no
significant changes to what is generated.
The validation algorithm for gdbarch values is now:
- If the Value has an 'invalid' field that is a string, use that for
validation,
- If the Value has its 'predicate' field set to true, then check the
predicate returns true, this ensures the predicate has been
called,
- If the Value has its 'invalid' field set to True, or the Value has
'postdefault' field, then check the fields has changed from its
initial value,
- Otherwise no validation is performed.
The only changes after this commit are:
- Some comments change slightly, and
- For 'gcore_bfd_target' and 'max_insn_length' we now validate by
calling the predicate rather than checking the field value
directly, the underlying check being performed is unchanged
though.
There should be no user visible changes after this commit.
Approved-By: Simon Marchi <simon.marchi@efficios.com>