diff options
Diffstat (limited to 'gdb')
| -rwxr-xr-x | gdb/check-gdbarch.py | 8 | ||||
| -rw-r--r-- | gdb/gdbarch_components.py | 18 | ||||
| -rw-r--r-- | gdb/gdbarch_types.py | 6 |
3 files changed, 32 insertions, 0 deletions
diff --git a/gdb/check-gdbarch.py b/gdb/check-gdbarch.py index 3c68fd9..3d6f3de 100755 --- a/gdb/check-gdbarch.py +++ b/gdb/check-gdbarch.py @@ -50,6 +50,8 @@ called_names = set() for c in filter(not_info, components): if c.implement: defined_names.add(c.name) + if c.unused: + set_names.add(c.name) if c.predicate: # Predicates are always "set". pname = c.name + "_p" @@ -91,7 +93,13 @@ for filename in tqdm.tqdm(files, desc="Scanning", leave=False): called_names.add(m[2]) +printed = False for elt in sorted(defined_names - set_names): + printed = True print(f"never set: {elt}") for elt in sorted(defined_names - called_names): + printed = True print(f"never called: {elt}") + +if not printed: + print("Everything ok!") diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py index 6e765e9..46283c1 100644 --- a/gdb/gdbarch_components.py +++ b/gdb/gdbarch_components.py @@ -48,6 +48,10 @@ # *'. This is used for dumping. The string must live long enough to # be passed to printf. # +# * "unused" - a boolean. If true, the hook is known to be unused, we +# but agreed to keep it around nevertheless. check-gdbarch.py uses +# this. This should be used sparingly, if at all. +# # Value, Function, and Method share some more parameters. Some of # these work in conjunction in a somewhat complicated way, so they are # described in a separate sub-section below. @@ -195,6 +199,8 @@ useful). name="bfloat16_bit", predefault="2*TARGET_CHAR_BIT", invalid=False, + # Currently unused but we wanted to keep this hook around. + unused=True, ) Value( @@ -210,6 +216,8 @@ Value( name="half_bit", predefault="2*TARGET_CHAR_BIT", invalid=False, + # Currently unused but we wanted to keep this hook around. + unused=True, ) Value( @@ -2122,6 +2130,8 @@ on the architecture's assembly. name="stap_integer_suffixes", invalid=False, printer="pstring_list (gdbarch->stap_integer_suffixes)", + # Currently unused but we wanted to keep this hook around. + unused=True, ) Value( @@ -2149,6 +2159,8 @@ the architecture's assembly. name="stap_register_suffixes", invalid=False, printer="pstring_list (gdbarch->stap_register_suffixes)", + # Currently unused but we wanted to keep this hook around. + unused=True, ) Value( @@ -2202,6 +2214,8 @@ register would be represented as `r10' internally. name="stap_gdb_register_prefix", invalid=False, printer="pstring (gdbarch->stap_gdb_register_prefix)", + # Currently unused but we wanted to keep this hook around. + unused=True, ) Value( @@ -2212,6 +2226,8 @@ Suffix used to name a register using GDB's nomenclature. name="stap_gdb_register_suffix", invalid=False, printer="pstring (gdbarch->stap_gdb_register_suffix)", + # Currently unused but we wanted to keep this hook around. + unused=True, ) Method( @@ -2640,6 +2656,8 @@ each address in memory. params=[], predefault="default_addressable_memory_unit_size", invalid=False, + # Currently unused but we wanted to keep this hook around. + unused=True, ) Value( diff --git a/gdb/gdbarch_types.py b/gdb/gdbarch_types.py index 02c81c5..f2a40e1 100644 --- a/gdb/gdbarch_types.py +++ b/gdb/gdbarch_types.py @@ -51,6 +51,7 @@ class Component: param_checks: Optional[List[str]] = None, result_checks: Optional[List[str]] = None, implement: bool = True, + unused: bool = False, ): self.name = name self.type = type @@ -64,6 +65,7 @@ class Component: self.param_checks = param_checks self.result_checks = result_checks self.implement = implement + self.unused = unused components.append(self) @@ -99,6 +101,7 @@ class Value(Component): postdefault: Optional[str] = None, invalid: Union[bool, str] = True, printer: Optional[str] = None, + unused: bool = False, ): super().__init__( comment=comment, @@ -109,6 +112,7 @@ class Value(Component): postdefault=postdefault, invalid=invalid, printer=printer, + unused=unused, ) @@ -130,6 +134,7 @@ class Function(Component): param_checks: Optional[List[str]] = None, result_checks: Optional[List[str]] = None, implement: bool = True, + unused: bool = False, ): super().__init__( comment=comment, @@ -144,6 +149,7 @@ class Function(Component): param_checks=param_checks, result_checks=result_checks, implement=implement, + unused=unused, ) def ftype(self): |
