4 Commits

Author SHA1 Message Date
0605df704d gdb/gdbarch: remove yet more 'invalid=True' from gdbarch_components.py
Following on from the previous commit, this commit removes yet more
'invalid=True' lines from gdbarch_components.py where the invalid
setting has no effect.

Due to the algorithm used in gdbarch.py for generated verify_gdbarch,
if a component has a postdefault value then no invalid check will ever
be generated for the component, as such setting 'invalid=True' on the
component is pointless.  This commit removes the setting of invalid.

There is no change in the generated code after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-03-13 21:51:03 +00:00
021c14f638 gdb/gdbarch: remove unused 'invalid=True' from gdbarch_components.py
Due to the algorithm used to generate verify_gdbarch in gdbarch.py, if
a component has a predicate, then a validation check will never be
generated.

There are a bunch of components that are declared with both a
predicate AND have 'invalid=True' set.  The 'invalid=True' has no
effect.

In this commit I clean things up by removing all these additional
'invalid=True' lines.  There's no change in any of the generated files
after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-03-13 21:51:03 +00:00
116e3492f2 gdb: gdbarch*.py, copyright.py: add type annotations
Add type annotations to gdbarch*.py to fix all errors shown by pyright.
There is one change in copyright.py too, to fix this one:

    /home/simark/src/binutils-gdb/gdb/gdbarch.py
      /home/simark/src/binutils-gdb/gdb/gdbarch.py:206:13 - error: Type of "copyright" is partially unknown
        Type of "copyright" is "(tool: Unknown, description: Unknown) -> str" (reportUnknownMemberType)

Change-Id: Ia109b53e267f6e2f5bd79a1288d0d5c9508c9ac4
Reviewed-By: Tom Tromey <tom@tromey.com>
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
2023-02-27 13:28:32 -05:00
05e4e89373 gdb: split gdbarch component types to gdbarch_types.py
Editing gdbarch-components.py is not an experience in an editor that is
minimally smart about Python.  Because gdbarch-components.py is read and
exec'd by gdbarch.py, it doesn't import the  Info / Method / Function /
Value types.  And because these types are defined in gdbarch.py, it
can't import them, as that would make a cyclic dependency.

Solve this by introducing a third file, gdbarch_types.py, to define
these types.  Make gdbarch.py and gdbarch-components.py import it.
Also, replace the read & exec of gdbarch-components.py by a regular
import.  For this to work though, gdbarch-components.py needs to be
renamed to gdbarch_components.py.

Change-Id: Ibe994d56ef9efcc0698b3ca9670d4d9bf8bbb853
Reviewed-By: Tom Tromey <tom@tromey.com>
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
2023-02-27 13:28:32 -05:00