/* Skip verify of bfloat16_bit, invalid_p == 0 */
if (gdbarch->bfloat16_format == 0)
gdbarch->bfloat16_format = floatformats_bfloat16;
+ /* Skip verify of bfloat16_format, invalid_p == 0 */
/* Skip verify of half_bit, invalid_p == 0 */
if (gdbarch->half_format == 0)
gdbarch->half_format = floatformats_ieee_half;
+ /* Skip verify of half_format, invalid_p == 0 */
/* Skip verify of float_bit, invalid_p == 0 */
if (gdbarch->float_format == 0)
gdbarch->float_format = floatformats_ieee_single;
+ /* Skip verify of float_format, invalid_p == 0 */
/* Skip verify of double_bit, invalid_p == 0 */
if (gdbarch->double_format == 0)
gdbarch->double_format = floatformats_ieee_double;
+ /* Skip verify of double_format, invalid_p == 0 */
/* Skip verify of long_double_bit, invalid_p == 0 */
if (gdbarch->long_double_format == 0)
gdbarch->long_double_format = floatformats_ieee_double;
+ /* Skip verify of long_double_format, invalid_p == 0 */
/* Skip verify of wchar_bit, invalid_p == 0 */
if (gdbarch->wchar_signed == -1)
gdbarch->wchar_signed = 1;
+ /* Skip verify of wchar_signed, invalid_p == 0 */
/* Skip verify of floatformat_for_type, invalid_p == 0 */
/* Skip verify of ptr_bit, invalid_p == 0 */
if (gdbarch->addr_bit == 0)
gdbarch->addr_bit = gdbarch_ptr_bit (gdbarch);
+ /* Skip verify of addr_bit, invalid_p == 0 */
if (gdbarch->dwarf2_addr_size == 0)
gdbarch->dwarf2_addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
+ /* Skip verify of dwarf2_addr_size, invalid_p == 0 */
if (gdbarch->char_signed == -1)
gdbarch->char_signed = 1;
+ /* Skip verify of char_signed, invalid_p == 0 */
/* Skip verify of read_pc, has predicate. */
/* Skip verify of write_pc, has predicate. */
/* Skip verify of virtual_frame_pointer, invalid_p == 0 */
/* Skip verify of skip_trampoline_code, invalid_p == 0 */
if (gdbarch->so_ops == 0)
gdbarch->so_ops = &solib_target_so_ops;
+ /* Skip verify of so_ops, invalid_p == 0 */
/* Skip verify of skip_solib_resolver, invalid_p == 0 */
/* Skip verify of in_solib_return_trampoline, invalid_p == 0 */
/* Skip verify of in_indirect_branch_thunk, invalid_p == 0 */
gdbarch_bfloat16_format (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
+ /* Skip verify of bfloat16_format, invalid_p == 0 */
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_bfloat16_format called\n");
return gdbarch->bfloat16_format;
gdbarch_half_format (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
+ /* Skip verify of half_format, invalid_p == 0 */
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_half_format called\n");
return gdbarch->half_format;
gdbarch_float_format (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
+ /* Skip verify of float_format, invalid_p == 0 */
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_float_format called\n");
return gdbarch->float_format;
gdbarch_double_format (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
+ /* Skip verify of double_format, invalid_p == 0 */
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_double_format called\n");
return gdbarch->double_format;
gdbarch_long_double_format (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
+ /* Skip verify of long_double_format, invalid_p == 0 */
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_long_double_format called\n");
return gdbarch->long_double_format;
gdbarch_so_ops (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
+ /* Skip verify of so_ops, invalid_p == 0 */
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_so_ops called\n");
return gdbarch->so_ops;
print(f" gdbarch->{c.name} = {c.postdefault};", file=f)
# Now validate the value.
- if c.invalid is False:
- print(f" /* Skip verify of {c.name}, invalid_p == 0 */", file=f)
- elif c.predicate:
- print(f" /* Skip verify of {c.name}, has predicate. */", file=f)
- elif c.invalid is None:
- # No validation has been requested for this component.
- pass
- elif isinstance(c.invalid, str):
+ if isinstance(c.invalid, str):
print(f" if ({c.invalid})", file=f)
print(f""" log.puts ("\\n\\t{c.name}");""", file=f)
- elif c.invalid is True:
+ elif c.predicate:
+ print(f" /* Skip verify of {c.name}, has predicate. */", file=f)
+ elif c.invalid:
if c.postdefault is not None:
# This component has its 'invalid' field set to True, but
# also has a postdefault. This makes no sense, the
print(f" if (gdbarch->{c.name} == {init_value})", file=f)
print(f""" log.puts ("\\n\\t{c.name}");""", file=f)
else:
- # We should not allow ourselves to simply do nothing here
- # because no other case applies. If we end up here then
- # either the input data needs adjusting so one of the
- # above cases matches, or we need additional cases adding
- # here.
- raise Exception(
- f"unhandled case when generating gdbarch validation: {c.name}"
- )
+ print(f" /* Skip verify of {c.name}, invalid_p == 0 */", file=f)
print(" if (!log.empty ())", file=f)
print(
""" internal_error (_("verify_gdbarch: the following are invalid ...%s"),""",
print(f"gdbarch_{c.name} (struct gdbarch *gdbarch)", file=f)
print("{", file=f)
print(" gdb_assert (gdbarch != NULL);", file=f)
- if c.invalid is False:
- print(f" /* Skip verify of {c.name}, invalid_p == 0 */", file=f)
- elif isinstance(c.invalid, str):
+ if isinstance(c.invalid, str):
print(" /* Check variable is valid. */", file=f)
print(f" gdb_assert (!({c.invalid}));", file=f)
- elif c.predefault:
+ elif c.postdefault is not None and c.predefault is not None:
print(" /* Check variable changed from pre-default. */", file=f)
print(f" gdb_assert (gdbarch->{c.name} != {c.predefault});", file=f)
+ elif c.invalid:
+ if c.predefault:
+ print(" /* Check variable changed from pre-default. */", file=f)
+ print(
+ f" gdb_assert (gdbarch->{c.name} != {c.predefault});", file=f
+ )
+ else:
+ print(f" /* Skip verify of {c.name}, invalid_p == 0 */", file=f)
print(" if (gdbarch_debug >= 2)", file=f)
print(
f""" gdb_printf (gdb_stdlog, "gdbarch_{c.name} called\\n");""",
predicate: bool = False,
predefault: Optional[str] = None,
postdefault: Optional[str] = None,
- invalid: Optional[Union[bool, str]] = None,
+ invalid: Union[bool, str] = False,
params: Optional[List[Tuple[str, str]]] = None,
param_checks: Optional[List[str]] = None,
result_checks: Optional[List[str]] = None,
def get_predicate(self):
"Return the expression used for validity checking."
- assert self.predicate and not isinstance(self.invalid, str)
if self.predefault:
predicate = f"gdbarch->{self.name} != {self.predefault}"
else:
predicate: bool = False,
predefault: Optional[str] = None,
postdefault: Optional[str] = None,
- invalid: Optional[Union[bool, str]] = None,
+ invalid: Union[bool, str] = False,
printer: Optional[str] = None,
):
super().__init__(
predicate: bool = False,
predefault: Optional[str] = None,
postdefault: Optional[str] = None,
- invalid: Optional[Union[bool, str]] = None,
+ invalid: Union[bool, str] = False,
printer: Optional[str] = None,
param_checks: Optional[List[str]] = None,
result_checks: Optional[List[str]] = None,