Home | History | Annotate | Line # | Download | only in gdb
gdbarch_components.py revision 1.1.1.2
      1 # Dynamic architecture support for GDB, the GNU debugger.
      2 
      3 # Copyright (C) 1998-2024 Free Software Foundation, Inc.
      4 
      5 # This file is part of GDB.
      6 
      7 # This program is free software; you can redistribute it and/or modify
      8 # it under the terms of the GNU General Public License as published by
      9 # the Free Software Foundation; either version 3 of the License, or
     10 # (at your option) any later version.
     11 
     12 # This program is distributed in the hope that it will be useful,
     13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 # GNU General Public License for more details.
     16 
     17 # You should have received a copy of the GNU General Public License
     18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
     19 
     20 # How to add to gdbarch:
     21 #
     22 # There are four kinds of fields in gdbarch:
     23 #
     24 # * Info - you should never need this; it is only for things that are
     25 # copied directly from the gdbarch_info.
     26 #
     27 # * Value - a variable.
     28 #
     29 # * Function - a function pointer.
     30 #
     31 # * Method - a function pointer, but the function takes a gdbarch as
     32 # its first parameter.
     33 #
     34 # You construct a new one with a call to one of those functions.  So,
     35 # for instance, you can use the function named "Value" to make a new
     36 # Value.
     37 #
     38 # All parameters are keyword-only.  This is done to help catch typos.
     39 #
     40 # Some parameters are shared among all types (including Info):
     41 #
     42 # * "name" - required, the name of the field.
     43 #
     44 # * "type" - required, the type of the field.  For functions and
     45 # methods, this is the return type.
     46 #
     47 # * "printer" - an expression to turn this field into a 'const char
     48 # *'.  This is used for dumping.  The string must live long enough to
     49 # be passed to printf.
     50 #
     51 # Value, Function, and Method share some more parameters.  Some of
     52 # these work in conjunction in a somewhat complicated way, so they are
     53 # described in a separate sub-section below.
     54 #
     55 # * "comment" - a comment that's written to the .h file.  Please
     56 # always use this.  (It isn't currently a required option for
     57 # historical reasons.)
     58 #
     59 # * "predicate" - a boolean, if True then a _p predicate function will
     60 # be generated.  The predicate will use the generic validation
     61 # function for the field.  See below.
     62 #
     63 # * "predefault", "postdefault", and "invalid" - These are used for
     64 # the initialization and verification steps:
     65 #
     66 # A gdbarch is zero-initialized.  Then, if a field has a "predefault",
     67 # the field is set to that value.  This becomes the field's initial
     68 # value.
     69 #
     70 # After initialization is complete (that is, after the tdep code has a
     71 # chance to change the settings), the post-initialization step is
     72 # done.
     73 #
     74 # If the field still has its initial value (see above), and the field
     75 # has a "postdefault", then the field is set to this value.
     76 #
     77 # After the possible "postdefault" assignment, validation is
     78 # performed for fields that don't have a "predicate".
     79 #
     80 # If the field has an "invalid" attribute with a string value, then
     81 # this string is the expression that should evaluate to true when the
     82 # field is invalid.
     83 #
     84 # Otherwise, if "invalid" is True (the default), then the generic
     85 # validation function is used: the field is considered invalid it
     86 # still contains its default value.  This validation is what is used
     87 # within the _p predicate function if the field has "predicate" set to
     88 # True.
     89 #
     90 # Function and Method share:
     91 #
     92 # * "params" - required, a tuple of tuples.  Each inner tuple is a
     93 # pair of the form (TYPE, NAME), where TYPE is the type of this
     94 # argument, and NAME is the name.  Note that while the names could be
     95 # auto-generated, this approach lets the "comment" field refer to
     96 # arguments in a nicer way.  It is also just nicer for users.
     97 #
     98 # * "param_checks" - optional, a list of strings.  Each string is an
     99 # expression that is placed within a gdb_assert before the call is
    100 # made to the Function/Method implementation.  Each expression is
    101 # something that should be true, and it is expected that the
    102 # expression will make use of the parameters named in 'params' (though
    103 # this is not required).
    104 #
    105 # * "result_checks" - optional, a list of strings.  Each string is an
    106 # expression that is placed within a gdb_assert after the call to the
    107 # Function/Method implementation.  Within each expression the variable
    108 # 'result' can be used to reference the result of the function/method
    109 # implementation.  The 'result_checks' can only be used if the 'type'
    110 # of this Function/Method is not 'void'.
    111 #
    112 # * "implement" - optional, a boolean.  If True (the default), a
    113 # wrapper function for this function will be emitted.
    114 
    115 from gdbarch_types import Function, Info, Method, Value
    116 
    117 Info(
    118     type="const struct bfd_arch_info *",
    119     name="bfd_arch_info",
    120     printer="gdbarch_bfd_arch_info (gdbarch)->printable_name",
    121 )
    122 
    123 Info(
    124     type="enum bfd_endian",
    125     name="byte_order",
    126 )
    127 
    128 Info(
    129     type="enum bfd_endian",
    130     name="byte_order_for_code",
    131 )
    132 
    133 Info(
    134     type="enum gdb_osabi",
    135     name="osabi",
    136 )
    137 
    138 Info(
    139     type="const struct target_desc *",
    140     name="target_desc",
    141     printer="host_address_to_string (gdbarch->target_desc)",
    142 )
    143 
    144 Value(
    145     comment="""
    146 Number of bits in a short or unsigned short for the target machine.
    147 """,
    148     type="int",
    149     name="short_bit",
    150     predefault="2*TARGET_CHAR_BIT",
    151     invalid=False,
    152 )
    153 
    154 int_bit = Value(
    155     comment="""
    156 Number of bits in an int or unsigned int for the target machine.
    157 """,
    158     type="int",
    159     name="int_bit",
    160     predefault="4*TARGET_CHAR_BIT",
    161     invalid=False,
    162 )
    163 
    164 long_bit_predefault = "4*TARGET_CHAR_BIT"
    165 long_bit = Value(
    166     comment="""
    167 Number of bits in a long or unsigned long for the target machine.
    168 """,
    169     type="int",
    170     name="long_bit",
    171     predefault=long_bit_predefault,
    172     invalid=False,
    173 )
    174 
    175 Value(
    176     comment="""
    177 Number of bits in a long long or unsigned long long for the target
    178 machine.
    179 """,
    180     type="int",
    181     name="long_long_bit",
    182     predefault="2*" + long_bit_predefault,
    183     invalid=False,
    184 )
    185 
    186 Value(
    187     comment="""
    188 The ABI default bit-size and format for "bfloat16", "half", "float", "double", and
    189 "long double".  These bit/format pairs should eventually be combined
    190 into a single object.  For the moment, just initialize them as a pair.
    191 Each format describes both the big and little endian layouts (if
    192 useful).
    193 """,
    194     type="int",
    195     name="bfloat16_bit",
    196     predefault="2*TARGET_CHAR_BIT",
    197     invalid=False,
    198 )
    199 
    200 Value(
    201     type="const struct floatformat **",
    202     name="bfloat16_format",
    203     predefault="floatformats_bfloat16",
    204     printer="pformat (gdbarch, gdbarch->bfloat16_format)",
    205     invalid=False,
    206 )
    207 
    208 Value(
    209     type="int",
    210     name="half_bit",
    211     predefault="2*TARGET_CHAR_BIT",
    212     invalid=False,
    213 )
    214 
    215 Value(
    216     type="const struct floatformat **",
    217     name="half_format",
    218     predefault="floatformats_ieee_half",
    219     printer="pformat (gdbarch, gdbarch->half_format)",
    220     invalid=False,
    221 )
    222 
    223 Value(
    224     type="int",
    225     name="float_bit",
    226     predefault="4*TARGET_CHAR_BIT",
    227     invalid=False,
    228 )
    229 
    230 Value(
    231     type="const struct floatformat **",
    232     name="float_format",
    233     predefault="floatformats_ieee_single",
    234     printer="pformat (gdbarch, gdbarch->float_format)",
    235     invalid=False,
    236 )
    237 
    238 Value(
    239     type="int",
    240     name="double_bit",
    241     predefault="8*TARGET_CHAR_BIT",
    242     invalid=False,
    243 )
    244 
    245 Value(
    246     type="const struct floatformat **",
    247     name="double_format",
    248     predefault="floatformats_ieee_double",
    249     printer="pformat (gdbarch, gdbarch->double_format)",
    250     invalid=False,
    251 )
    252 
    253 Value(
    254     type="int",
    255     name="long_double_bit",
    256     predefault="8*TARGET_CHAR_BIT",
    257     invalid=False,
    258 )
    259 
    260 Value(
    261     type="const struct floatformat **",
    262     name="long_double_format",
    263     predefault="floatformats_ieee_double",
    264     printer="pformat (gdbarch, gdbarch->long_double_format)",
    265     invalid=False,
    266 )
    267 
    268 Value(
    269     comment="""
    270 The ABI default bit-size for "wchar_t".  wchar_t is a built-in type
    271 starting with C++11.
    272 """,
    273     type="int",
    274     name="wchar_bit",
    275     predefault="4*TARGET_CHAR_BIT",
    276     invalid=False,
    277 )
    278 
    279 Value(
    280     comment="""
    281 One if `wchar_t' is signed, zero if unsigned.
    282 """,
    283     type="int",
    284     name="wchar_signed",
    285     predefault="-1",
    286     postdefault="1",
    287     invalid=False,
    288 )
    289 
    290 Method(
    291     comment="""
    292 Returns the floating-point format to be used for values of length LENGTH.
    293 NAME, if non-NULL, is the type name, which may be used to distinguish
    294 different target formats of the same length.
    295 """,
    296     type="const struct floatformat **",
    297     name="floatformat_for_type",
    298     params=[("const char *", "name"), ("int", "length")],
    299     predefault="default_floatformat_for_type",
    300     invalid=False,
    301 )
    302 
    303 Value(
    304     comment="""
    305 For most targets, a pointer on the target and its representation as an
    306 address in GDB have the same size and "look the same".  For such a
    307 target, you need only set gdbarch_ptr_bit and gdbarch_addr_bit
    308 / addr_bit will be set from it.
    309 
    310 If gdbarch_ptr_bit and gdbarch_addr_bit are different, you'll probably
    311 also need to set gdbarch_dwarf2_addr_size, gdbarch_pointer_to_address and
    312 gdbarch_address_to_pointer as well.
    313 
    314 ptr_bit is the size of a pointer on the target
    315 """,
    316     type="int",
    317     name="ptr_bit",
    318     predefault=int_bit.predefault,
    319     invalid=False,
    320 )
    321 
    322 Value(
    323     comment="""
    324 addr_bit is the size of a target address as represented in gdb
    325 """,
    326     type="int",
    327     name="addr_bit",
    328     predefault="0",
    329     postdefault="gdbarch_ptr_bit (gdbarch)",
    330     invalid=False,
    331 )
    332 
    333 Value(
    334     comment="""
    335 dwarf2_addr_size is the target address size as used in the Dwarf debug
    336 info.  For .debug_frame FDEs, this is supposed to be the target address
    337 size from the associated CU header, and which is equivalent to the
    338 DWARF2_ADDR_SIZE as defined by the target specific GCC back-end.
    339 Unfortunately there is no good way to determine this value.  Therefore
    340 dwarf2_addr_size simply defaults to the target pointer size.
    341 
    342 dwarf2_addr_size is not used for .eh_frame FDEs, which are generally
    343 defined using the target's pointer size so far.
    344 
    345 Note that dwarf2_addr_size only needs to be redefined by a target if the
    346 GCC back-end defines a DWARF2_ADDR_SIZE other than the target pointer size,
    347 and if Dwarf versions < 4 need to be supported.
    348 """,
    349     type="int",
    350     name="dwarf2_addr_size",
    351     postdefault="gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT",
    352     invalid=False,
    353 )
    354 
    355 Value(
    356     comment="""
    357 One if `char' acts like `signed char', zero if `unsigned char'.
    358 """,
    359     type="int",
    360     name="char_signed",
    361     predefault="-1",
    362     postdefault="1",
    363     invalid=False,
    364 )
    365 
    366 Function(
    367     type="CORE_ADDR",
    368     name="read_pc",
    369     params=[("readable_regcache *", "regcache")],
    370     predicate=True,
    371 )
    372 
    373 Function(
    374     type="void",
    375     name="write_pc",
    376     params=[("struct regcache *", "regcache"), ("CORE_ADDR", "val")],
    377     predicate=True,
    378 )
    379 
    380 Method(
    381     comment="""
    382 Function for getting target's idea of a frame pointer.  FIXME: GDB's
    383 whole scheme for dealing with "frames" and "frame pointers" needs a
    384 serious shakedown.
    385 """,
    386     type="void",
    387     name="virtual_frame_pointer",
    388     params=[
    389         ("CORE_ADDR", "pc"),
    390         ("int *", "frame_regnum"),
    391         ("LONGEST *", "frame_offset"),
    392     ],
    393     predefault="legacy_virtual_frame_pointer",
    394     invalid=False,
    395 )
    396 
    397 Method(
    398     type="enum register_status",
    399     name="pseudo_register_read",
    400     params=[
    401         ("readable_regcache *", "regcache"),
    402         ("int", "cookednum"),
    403         ("gdb_byte *", "buf"),
    404     ],
    405     predicate=True,
    406 )
    407 
    408 Method(
    409     comment="""
    410 Read a register into a new struct value.  If the register is wholly
    411 or partly unavailable, this should call mark_value_bytes_unavailable
    412 as appropriate.  If this is defined, then pseudo_register_read will
    413 never be called.
    414 """,
    415     type="struct value *",
    416     name="pseudo_register_read_value",
    417     params=[("const frame_info_ptr &", "next_frame"), ("int", "cookednum")],
    418     predicate=True,
    419 )
    420 
    421 Method(
    422     comment="""
    423 Write bytes in BUF to pseudo register with number PSEUDO_REG_NUM.
    424 
    425 Raw registers backing the pseudo register should be written to using
    426 NEXT_FRAME.
    427 """,
    428     type="void",
    429     name="pseudo_register_write",
    430     params=[
    431         ("const frame_info_ptr &", "next_frame"),
    432         ("int", "pseudo_reg_num"),
    433         ("gdb::array_view<const gdb_byte>", "buf"),
    434     ],
    435     predicate=True,
    436 )
    437 
    438 Method(
    439     comment="""
    440 Write bytes to a pseudo register.
    441 
    442 This is marked as deprecated because it gets passed a regcache for
    443 implementations to write raw registers in.  This doesn't work for unwound
    444 frames, where the raw registers backing the pseudo registers may have been
    445 saved elsewhere.
    446 
    447 Implementations should be migrated to implement pseudo_register_write instead.
    448 """,
    449     type="void",
    450     name="deprecated_pseudo_register_write",
    451     params=[
    452         ("struct regcache *", "regcache"),
    453         ("int", "cookednum"),
    454         ("const gdb_byte *", "buf"),
    455     ],
    456     predicate=True,
    457 )
    458 
    459 Value(
    460     type="int",
    461     name="num_regs",
    462     predefault="-1",
    463 )
    464 
    465 Value(
    466     comment="""
    467 This macro gives the number of pseudo-registers that live in the
    468 register namespace but do not get fetched or stored on the target.
    469 These pseudo-registers may be aliases for other registers,
    470 combinations of other registers, or they may be computed by GDB.
    471 """,
    472     type="int",
    473     name="num_pseudo_regs",
    474     predefault="0",
    475     invalid=False,
    476 )
    477 
    478 Method(
    479     comment="""
    480 Assemble agent expression bytecode to collect pseudo-register REG.
    481 Return -1 if something goes wrong, 0 otherwise.
    482 """,
    483     type="int",
    484     name="ax_pseudo_register_collect",
    485     params=[("struct agent_expr *", "ax"), ("int", "reg")],
    486     predicate=True,
    487 )
    488 
    489 Method(
    490     comment="""
    491 Assemble agent expression bytecode to push the value of pseudo-register
    492 REG on the interpreter stack.
    493 Return -1 if something goes wrong, 0 otherwise.
    494 """,
    495     type="int",
    496     name="ax_pseudo_register_push_stack",
    497     params=[("struct agent_expr *", "ax"), ("int", "reg")],
    498     predicate=True,
    499 )
    500 
    501 Method(
    502     comment="""
    503 Some architectures can display additional information for specific
    504 signals.
    505 UIOUT is the output stream where the handler will place information.
    506 """,
    507     type="void",
    508     name="report_signal_info",
    509     params=[("struct ui_out *", "uiout"), ("enum gdb_signal", "siggnal")],
    510     predicate=True,
    511 )
    512 
    513 Value(
    514     comment="""
    515 GDB's standard (or well known) register numbers.  These can map onto
    516 a real register or a pseudo (computed) register or not be defined at
    517 all (-1).
    518 gdbarch_sp_regnum will hopefully be replaced by UNWIND_SP.
    519 """,
    520     type="int",
    521     name="sp_regnum",
    522     predefault="-1",
    523     invalid=False,
    524 )
    525 
    526 Value(
    527     type="int",
    528     name="pc_regnum",
    529     predefault="-1",
    530     invalid=False,
    531 )
    532 
    533 Value(
    534     type="int",
    535     name="ps_regnum",
    536     predefault="-1",
    537     invalid=False,
    538 )
    539 
    540 Value(
    541     type="int",
    542     name="fp0_regnum",
    543     predefault="-1",
    544     invalid=False,
    545 )
    546 
    547 Method(
    548     comment="""
    549 Convert stab register number (from `r' declaration) to a gdb REGNUM.
    550 """,
    551     type="int",
    552     name="stab_reg_to_regnum",
    553     params=[("int", "stab_regnr")],
    554     predefault="no_op_reg_to_regnum",
    555     invalid=False,
    556 )
    557 
    558 Method(
    559     comment="""
    560 Provide a default mapping from a ecoff register number to a gdb REGNUM.
    561 """,
    562     type="int",
    563     name="ecoff_reg_to_regnum",
    564     params=[("int", "ecoff_regnr")],
    565     predefault="no_op_reg_to_regnum",
    566     invalid=False,
    567 )
    568 
    569 Method(
    570     comment="""
    571 Convert from an sdb register number to an internal gdb register number.
    572 """,
    573     type="int",
    574     name="sdb_reg_to_regnum",
    575     params=[("int", "sdb_regnr")],
    576     predefault="no_op_reg_to_regnum",
    577     invalid=False,
    578 )
    579 
    580 Method(
    581     comment="""
    582 Provide a default mapping from a DWARF2 register number to a gdb REGNUM.
    583 Return -1 for bad REGNUM.  Note: Several targets get this wrong.
    584 """,
    585     type="int",
    586     name="dwarf2_reg_to_regnum",
    587     params=[("int", "dwarf2_regnr")],
    588     predefault="no_op_reg_to_regnum",
    589     invalid=False,
    590 )
    591 
    592 Method(
    593     comment="""
    594 Return the name of register REGNR for the specified architecture.
    595 REGNR can be any value greater than, or equal to zero, and less than
    596 'gdbarch_num_cooked_regs (GDBARCH)'.  If REGNR is not supported for
    597 GDBARCH, then this function will return an empty string, this function
    598 should never return nullptr.
    599 """,
    600     type="const char *",
    601     name="register_name",
    602     params=[("int", "regnr")],
    603     param_checks=["regnr >= 0", "regnr < gdbarch_num_cooked_regs (gdbarch)"],
    604     result_checks=["result != nullptr"],
    605 )
    606 
    607 Method(
    608     comment="""
    609 Return the type of a register specified by the architecture.  Only
    610 the register cache should call this function directly; others should
    611 use "register_type".
    612 """,
    613     type="struct type *",
    614     name="register_type",
    615     params=[("int", "reg_nr")],
    616 )
    617 
    618 Method(
    619     comment="""
    620 Generate a dummy frame_id for THIS_FRAME assuming that the frame is
    621 a dummy frame.  A dummy frame is created before an inferior call,
    622 the frame_id returned here must match the frame_id that was built
    623 for the inferior call.  Usually this means the returned frame_id's
    624 stack address should match the address returned by
    625 gdbarch_push_dummy_call, and the returned frame_id's code address
    626 should match the address at which the breakpoint was set in the dummy
    627 frame.
    628 """,
    629     type="struct frame_id",
    630     name="dummy_id",
    631     params=[("const frame_info_ptr &", "this_frame")],
    632     predefault="default_dummy_id",
    633     invalid=False,
    634 )
    635 
    636 Value(
    637     comment="""
    638 Implement DUMMY_ID and PUSH_DUMMY_CALL, then delete
    639 deprecated_fp_regnum.
    640 """,
    641     type="int",
    642     name="deprecated_fp_regnum",
    643     predefault="-1",
    644     invalid=False,
    645 )
    646 
    647 Method(
    648     type="CORE_ADDR",
    649     name="push_dummy_call",
    650     params=[
    651         ("struct value *", "function"),
    652         ("struct regcache *", "regcache"),
    653         ("CORE_ADDR", "bp_addr"),
    654         ("int", "nargs"),
    655         ("struct value **", "args"),
    656         ("CORE_ADDR", "sp"),
    657         ("function_call_return_method", "return_method"),
    658         ("CORE_ADDR", "struct_addr"),
    659     ],
    660     predicate=True,
    661 )
    662 
    663 Value(
    664     type="enum call_dummy_location_type",
    665     name="call_dummy_location",
    666     predefault="AT_ENTRY_POINT",
    667     invalid=False,
    668 )
    669 
    670 Method(
    671     type="CORE_ADDR",
    672     name="push_dummy_code",
    673     params=[
    674         ("CORE_ADDR", "sp"),
    675         ("CORE_ADDR", "funaddr"),
    676         ("struct value **", "args"),
    677         ("int", "nargs"),
    678         ("struct type *", "value_type"),
    679         ("CORE_ADDR *", "real_pc"),
    680         ("CORE_ADDR *", "bp_addr"),
    681         ("struct regcache *", "regcache"),
    682     ],
    683     predicate=True,
    684 )
    685 
    686 Method(
    687     comment="""
    688 Return true if the code of FRAME is writable.
    689 """,
    690     type="int",
    691     name="code_of_frame_writable",
    692     params=[("const frame_info_ptr &", "frame")],
    693     predefault="default_code_of_frame_writable",
    694     invalid=False,
    695 )
    696 
    697 Method(
    698     type="void",
    699     name="print_registers_info",
    700     params=[
    701         ("struct ui_file *", "file"),
    702         ("const frame_info_ptr &", "frame"),
    703         ("int", "regnum"),
    704         ("int", "all"),
    705     ],
    706     predefault="default_print_registers_info",
    707     invalid=False,
    708 )
    709 
    710 Method(
    711     type="void",
    712     name="print_float_info",
    713     params=[
    714         ("struct ui_file *", "file"),
    715         ("const frame_info_ptr &", "frame"),
    716         ("const char *", "args"),
    717     ],
    718     predefault="default_print_float_info",
    719     invalid=False,
    720 )
    721 
    722 Method(
    723     type="void",
    724     name="print_vector_info",
    725     params=[
    726         ("struct ui_file *", "file"),
    727         ("const frame_info_ptr &", "frame"),
    728         ("const char *", "args"),
    729     ],
    730     predicate=True,
    731 )
    732 
    733 Method(
    734     comment="""
    735 MAP a GDB RAW register number onto a simulator register number.  See
    736 also include/...-sim.h.
    737 """,
    738     type="int",
    739     name="register_sim_regno",
    740     params=[("int", "reg_nr")],
    741     predefault="legacy_register_sim_regno",
    742     invalid=False,
    743 )
    744 
    745 Method(
    746     type="int",
    747     name="cannot_fetch_register",
    748     params=[("int", "regnum")],
    749     predefault="cannot_register_not",
    750     invalid=False,
    751 )
    752 
    753 Method(
    754     type="int",
    755     name="cannot_store_register",
    756     params=[("int", "regnum")],
    757     predefault="cannot_register_not",
    758     invalid=False,
    759 )
    760 
    761 Function(
    762     comment="""
    763 Determine the address where a longjmp will land and save this address
    764 in PC.  Return nonzero on success.
    765 
    766 FRAME corresponds to the longjmp frame.
    767 """,
    768     type="int",
    769     name="get_longjmp_target",
    770     params=[("const frame_info_ptr &", "frame"), ("CORE_ADDR *", "pc")],
    771     predicate=True,
    772 )
    773 
    774 Value(
    775     type="int",
    776     name="believe_pcc_promotion",
    777     invalid=False,
    778 )
    779 
    780 Method(
    781     type="int",
    782     name="convert_register_p",
    783     params=[("int", "regnum"), ("struct type *", "type")],
    784     predefault="generic_convert_register_p",
    785     invalid=False,
    786 )
    787 
    788 Function(
    789     type="int",
    790     name="register_to_value",
    791     params=[
    792         ("const frame_info_ptr &", "frame"),
    793         ("int", "regnum"),
    794         ("struct type *", "type"),
    795         ("gdb_byte *", "buf"),
    796         ("int *", "optimizedp"),
    797         ("int *", "unavailablep"),
    798     ],
    799     invalid=False,
    800 )
    801 
    802 Function(
    803     type="void",
    804     name="value_to_register",
    805     params=[
    806         ("const frame_info_ptr &", "frame"),
    807         ("int", "regnum"),
    808         ("struct type *", "type"),
    809         ("const gdb_byte *", "buf"),
    810     ],
    811     invalid=False,
    812 )
    813 
    814 Method(
    815     comment="""
    816 Construct a value representing the contents of register REGNUM in
    817 frame THIS_FRAME, interpreted as type TYPE.  The routine needs to
    818 allocate and return a struct value with all value attributes
    819 (but not the value contents) filled in.
    820 """,
    821     type="struct value *",
    822     name="value_from_register",
    823     params=[
    824         ("struct type *", "type"),
    825         ("int", "regnum"),
    826         ("const frame_info_ptr &", "this_frame"),
    827     ],
    828     predefault="default_value_from_register",
    829     invalid=False,
    830 )
    831 
    832 Method(
    833     type="CORE_ADDR",
    834     name="pointer_to_address",
    835     params=[("struct type *", "type"), ("const gdb_byte *", "buf")],
    836     predefault="unsigned_pointer_to_address",
    837     invalid=False,
    838 )
    839 
    840 Method(
    841     type="void",
    842     name="address_to_pointer",
    843     params=[("struct type *", "type"), ("gdb_byte *", "buf"), ("CORE_ADDR", "addr")],
    844     predefault="unsigned_address_to_pointer",
    845     invalid=False,
    846 )
    847 
    848 Method(
    849     type="CORE_ADDR",
    850     name="integer_to_address",
    851     params=[("struct type *", "type"), ("const gdb_byte *", "buf")],
    852     predicate=True,
    853 )
    854 
    855 Method(
    856     comment="""
    857 Return the return-value convention that will be used by FUNCTION
    858 to return a value of type VALTYPE.  FUNCTION may be NULL in which
    859 case the return convention is computed based only on VALTYPE.
    860 
    861 If READBUF is not NULL, extract the return value and save it in this buffer.
    862 
    863 If WRITEBUF is not NULL, it contains a return value which will be
    864 stored into the appropriate register.  This can be used when we want
    865 to force the value returned by a function (see the "return" command
    866 for instance).
    867 
    868 NOTE: it is better to implement return_value_as_value instead, as that
    869 method can properly handle variably-sized types.
    870 """,
    871     type="enum return_value_convention",
    872     name="return_value",
    873     params=[
    874         ("struct value *", "function"),
    875         ("struct type *", "valtype"),
    876         ("struct regcache *", "regcache"),
    877         ("gdb_byte *", "readbuf"),
    878         ("const gdb_byte *", "writebuf"),
    879     ],
    880     invalid=False,
    881     # We don't want to accidentally introduce calls to this, as gdb
    882     # should only ever call return_value_new (see below).
    883     implement=False,
    884 )
    885 
    886 Method(
    887     comment="""
    888 Return the return-value convention that will be used by FUNCTION
    889 to return a value of type VALTYPE.  FUNCTION may be NULL in which
    890 case the return convention is computed based only on VALTYPE.
    891 
    892 If READ_VALUE is not NULL, extract the return value and save it in
    893 this pointer.
    894 
    895 If WRITEBUF is not NULL, it contains a return value which will be
    896 stored into the appropriate register.  This can be used when we want
    897 to force the value returned by a function (see the "return" command
    898 for instance).
    899 """,
    900     type="enum return_value_convention",
    901     name="return_value_as_value",
    902     params=[
    903         ("struct value *", "function"),
    904         ("struct type *", "valtype"),
    905         ("struct regcache *", "regcache"),
    906         ("struct value **", "read_value"),
    907         ("const gdb_byte *", "writebuf"),
    908     ],
    909     predefault="default_gdbarch_return_value",
    910     # If we're using the default, then the other method must be set;
    911     # but if we aren't using the default here then the other method
    912     # must not be set.
    913     invalid="(gdbarch->return_value_as_value == default_gdbarch_return_value) == (gdbarch->return_value == nullptr)",
    914 )
    915 
    916 Function(
    917     comment="""
    918 Return the address at which the value being returned from
    919 the current function will be stored.  This routine is only
    920 called if the current function uses the the "struct return
    921 convention".
    922 
    923 May return 0 when unable to determine that address.""",
    924     type="CORE_ADDR",
    925     name="get_return_buf_addr",
    926     params=[("struct type *", "val_type"), ("const frame_info_ptr &", "cur_frame")],
    927     predefault="default_get_return_buf_addr",
    928     invalid=False,
    929 )
    930 
    931 
    932 # The DWARF info currently does not distinguish between IEEE 128-bit floating
    933 # point values and the IBM 128-bit floating point format.  GCC has an internal
    934 # hack to identify the IEEE 128-bit floating point value.  The long double is a
    935 # defined base type in C.  The GCC hack uses a typedef for long double to
    936 # reference_Float128 base to identify the long double as and IEEE 128-bit
    937 # value.  The following method is used to "fix" the long double type to be a
    938 # base type with the IEEE float format info from the _Float128 basetype and
    939 # the long double name.  With the fix, the proper name is printed for the
    940 # GDB typedef command.
    941 Function(
    942     comment="""
    943 Return true if the typedef record needs to be replaced.".
    944 
    945 Return 0 by default""",
    946     type="bool",
    947     name="dwarf2_omit_typedef_p",
    948     params=[
    949         ("struct type *", "target_type"),
    950         ("const char *", "producer"),
    951         ("const char *", "name"),
    952     ],
    953     predefault="default_dwarf2_omit_typedef_p",
    954     invalid=False,
    955 )
    956 
    957 Method(
    958     comment="""
    959 Update PC when trying to find a call site.  This is useful on
    960 architectures where the call site PC, as reported in the DWARF, can be
    961 incorrect for some reason.
    962 
    963 The passed-in PC will be an address in the inferior.  GDB will have
    964 already failed to find a call site at this PC.  This function may
    965 simply return its parameter if it thinks that should be the correct
    966 address.""",
    967     type="CORE_ADDR",
    968     name="update_call_site_pc",
    969     params=[("CORE_ADDR", "pc")],
    970     predefault="default_update_call_site_pc",
    971     invalid=False,
    972 )
    973 
    974 Method(
    975     comment="""
    976 Return true if the return value of function is stored in the first hidden
    977 parameter.  In theory, this feature should be language-dependent, specified
    978 by language and its ABI, such as C++.  Unfortunately, compiler may
    979 implement it to a target-dependent feature.  So that we need such hook here
    980 to be aware of this in GDB.
    981 """,
    982     type="int",
    983     name="return_in_first_hidden_param_p",
    984     params=[("struct type *", "type")],
    985     predefault="default_return_in_first_hidden_param_p",
    986     invalid=False,
    987 )
    988 
    989 Method(
    990     type="CORE_ADDR",
    991     name="skip_prologue",
    992     params=[("CORE_ADDR", "ip")],
    993 )
    994 
    995 Method(
    996     type="CORE_ADDR",
    997     name="skip_main_prologue",
    998     params=[("CORE_ADDR", "ip")],
    999     predicate=True,
   1000 )
   1001 
   1002 Method(
   1003     comment="""
   1004 On some platforms, a single function may provide multiple entry points,
   1005 e.g. one that is used for function-pointer calls and a different one
   1006 that is used for direct function calls.
   1007 In order to ensure that breakpoints set on the function will trigger
   1008 no matter via which entry point the function is entered, a platform
   1009 may provide the skip_entrypoint callback.  It is called with IP set
   1010 to the main entry point of a function (as determined by the symbol table),
   1011 and should return the address of the innermost entry point, where the
   1012 actual breakpoint needs to be set.  Note that skip_entrypoint is used
   1013 by GDB common code even when debugging optimized code, where skip_prologue
   1014 is not used.
   1015 """,
   1016     type="CORE_ADDR",
   1017     name="skip_entrypoint",
   1018     params=[("CORE_ADDR", "ip")],
   1019     predicate=True,
   1020 )
   1021 
   1022 Function(
   1023     type="bool",
   1024     name="inner_than",
   1025     params=[("CORE_ADDR", "lhs"), ("CORE_ADDR", "rhs")],
   1026 )
   1027 
   1028 Method(
   1029     type="const gdb_byte *",
   1030     name="breakpoint_from_pc",
   1031     params=[("CORE_ADDR *", "pcptr"), ("int *", "lenptr")],
   1032     predefault="default_breakpoint_from_pc",
   1033     invalid=False,
   1034 )
   1035 
   1036 Method(
   1037     comment="""
   1038 Return the breakpoint kind for this target based on *PCPTR.
   1039 """,
   1040     type="int",
   1041     name="breakpoint_kind_from_pc",
   1042     params=[("CORE_ADDR *", "pcptr")],
   1043 )
   1044 
   1045 Method(
   1046     comment="""
   1047 Return the software breakpoint from KIND.  KIND can have target
   1048 specific meaning like the Z0 kind parameter.
   1049 SIZE is set to the software breakpoint's length in memory.
   1050 """,
   1051     type="const gdb_byte *",
   1052     name="sw_breakpoint_from_kind",
   1053     params=[("int", "kind"), ("int *", "size")],
   1054     predefault="NULL",
   1055     invalid=False,
   1056 )
   1057 
   1058 Method(
   1059     comment="""
   1060 Return the breakpoint kind for this target based on the current
   1061 processor state (e.g. the current instruction mode on ARM) and the
   1062 *PCPTR.  In default, it is gdbarch->breakpoint_kind_from_pc.
   1063 """,
   1064     type="int",
   1065     name="breakpoint_kind_from_current_state",
   1066     params=[("struct regcache *", "regcache"), ("CORE_ADDR *", "pcptr")],
   1067     predefault="default_breakpoint_kind_from_current_state",
   1068     invalid=False,
   1069 )
   1070 
   1071 Method(
   1072     type="CORE_ADDR",
   1073     name="adjust_breakpoint_address",
   1074     params=[("CORE_ADDR", "bpaddr")],
   1075     predicate=True,
   1076 )
   1077 
   1078 Method(
   1079     type="int",
   1080     name="memory_insert_breakpoint",
   1081     params=[("struct bp_target_info *", "bp_tgt")],
   1082     predefault="default_memory_insert_breakpoint",
   1083     invalid=False,
   1084 )
   1085 
   1086 Method(
   1087     type="int",
   1088     name="memory_remove_breakpoint",
   1089     params=[("struct bp_target_info *", "bp_tgt")],
   1090     predefault="default_memory_remove_breakpoint",
   1091     invalid=False,
   1092 )
   1093 
   1094 Value(
   1095     type="CORE_ADDR",
   1096     name="decr_pc_after_break",
   1097     invalid=False,
   1098 )
   1099 
   1100 Value(
   1101     comment="""
   1102 A function can be addressed by either its "pointer" (possibly a
   1103 descriptor address) or "entry point" (first executable instruction).
   1104 The method "convert_from_func_ptr_addr" converting the former to the
   1105 latter.  gdbarch_deprecated_function_start_offset is being used to implement
   1106 a simplified subset of that functionality - the function's address
   1107 corresponds to the "function pointer" and the function's start
   1108 corresponds to the "function entry point" - and hence is redundant.
   1109 """,
   1110     type="CORE_ADDR",
   1111     name="deprecated_function_start_offset",
   1112     invalid=False,
   1113 )
   1114 
   1115 Method(
   1116     comment="""
   1117 Return the remote protocol register number associated with this
   1118 register.  Normally the identity mapping.
   1119 """,
   1120     type="int",
   1121     name="remote_register_number",
   1122     params=[("int", "regno")],
   1123     predefault="default_remote_register_number",
   1124     invalid=False,
   1125 )
   1126 
   1127 Function(
   1128     comment="""
   1129 Fetch the target specific address used to represent a load module.
   1130 """,
   1131     type="CORE_ADDR",
   1132     name="fetch_tls_load_module_address",
   1133     params=[("struct objfile *", "objfile")],
   1134     predicate=True,
   1135 )
   1136 
   1137 Method(
   1138     comment="""
   1139 Return the thread-local address at OFFSET in the thread-local
   1140 storage for the thread PTID and the shared library or executable
   1141 file given by LM_ADDR.  If that block of thread-local storage hasn't
   1142 been allocated yet, this function may throw an error.  LM_ADDR may
   1143 be zero for statically linked multithreaded inferiors.
   1144 """,
   1145     type="CORE_ADDR",
   1146     name="get_thread_local_address",
   1147     params=[("ptid_t", "ptid"), ("CORE_ADDR", "lm_addr"), ("CORE_ADDR", "offset")],
   1148     predicate=True,
   1149 )
   1150 
   1151 Value(
   1152     type="CORE_ADDR",
   1153     name="frame_args_skip",
   1154     invalid=False,
   1155 )
   1156 
   1157 Method(
   1158     type="CORE_ADDR",
   1159     name="unwind_pc",
   1160     params=[("const frame_info_ptr &", "next_frame")],
   1161     predefault="default_unwind_pc",
   1162     invalid=False,
   1163 )
   1164 
   1165 Method(
   1166     type="CORE_ADDR",
   1167     name="unwind_sp",
   1168     params=[("const frame_info_ptr &", "next_frame")],
   1169     predefault="default_unwind_sp",
   1170     invalid=False,
   1171 )
   1172 
   1173 Function(
   1174     comment="""
   1175 DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame
   1176 frame-base.  Enable frame-base before frame-unwind.
   1177 """,
   1178     type="int",
   1179     name="frame_num_args",
   1180     params=[("const frame_info_ptr &", "frame")],
   1181     predicate=True,
   1182 )
   1183 
   1184 Method(
   1185     type="CORE_ADDR",
   1186     name="frame_align",
   1187     params=[("CORE_ADDR", "address")],
   1188     predicate=True,
   1189 )
   1190 
   1191 Method(
   1192     type="int",
   1193     name="stabs_argument_has_addr",
   1194     params=[("struct type *", "type")],
   1195     predefault="default_stabs_argument_has_addr",
   1196     invalid=False,
   1197 )
   1198 
   1199 Value(
   1200     type="int",
   1201     name="frame_red_zone_size",
   1202     invalid=False,
   1203 )
   1204 
   1205 Method(
   1206     type="CORE_ADDR",
   1207     name="convert_from_func_ptr_addr",
   1208     params=[("CORE_ADDR", "addr"), ("struct target_ops *", "targ")],
   1209     predefault="convert_from_func_ptr_addr_identity",
   1210     invalid=False,
   1211 )
   1212 
   1213 Method(
   1214     comment="""
   1215 On some machines there are bits in addresses which are not really
   1216 part of the address, but are used by the kernel, the hardware, etc.
   1217 for special purposes.  gdbarch_addr_bits_remove takes out any such bits so
   1218 we get a "real" address such as one would find in a symbol table.
   1219 This is used only for addresses of instructions, and even then I'm
   1220 not sure it's used in all contexts.  It exists to deal with there
   1221 being a few stray bits in the PC which would mislead us, not as some
   1222 sort of generic thing to handle alignment or segmentation (it's
   1223 possible it should be in TARGET_READ_PC instead).
   1224 """,
   1225     type="CORE_ADDR",
   1226     name="addr_bits_remove",
   1227     params=[("CORE_ADDR", "addr")],
   1228     predefault="core_addr_identity",
   1229     invalid=False,
   1230 )
   1231 
   1232 Method(
   1233     comment="""
   1234 On some architectures, not all bits of a pointer are significant.
   1235 On AArch64 and amd64, for example, the top bits of a pointer may carry a
   1236 "tag", which can be ignored by the kernel and the hardware.  The "tag" can be
   1237 regarded as additional data associated with the pointer, but it is not part
   1238 of the address.
   1239 
   1240 Given a pointer for the architecture, this hook removes all the
   1241 non-significant bits and sign-extends things as needed.  It gets used to
   1242 remove non-address bits from pointers used for watchpoints.
   1243 """,
   1244     type="CORE_ADDR",
   1245     name="remove_non_address_bits_watchpoint",
   1246     params=[("CORE_ADDR", "pointer")],
   1247     predefault="default_remove_non_address_bits",
   1248     invalid=False,
   1249 )
   1250 
   1251 Method(
   1252     comment="""
   1253 On some architectures, not all bits of a pointer are significant.
   1254 On AArch64 and amd64, for example, the top bits of a pointer may carry a
   1255 "tag", which can be ignored by the kernel and the hardware.  The "tag" can be
   1256 regarded as additional data associated with the pointer, but it is not part
   1257 of the address.
   1258 
   1259 Given a pointer for the architecture, this hook removes all the
   1260 non-significant bits and sign-extends things as needed.  It gets used to
   1261 remove non-address bits from pointers used for breakpoints.
   1262 """,
   1263     type="CORE_ADDR",
   1264     name="remove_non_address_bits_breakpoint",
   1265     params=[("CORE_ADDR", "pointer")],
   1266     predefault="default_remove_non_address_bits",
   1267     invalid=False,
   1268 )
   1269 
   1270 Method(
   1271     comment="""
   1272 On some architectures, not all bits of a pointer are significant.
   1273 On AArch64 and amd64, for example, the top bits of a pointer may carry a
   1274 "tag", which can be ignored by the kernel and the hardware.  The "tag" can be
   1275 regarded as additional data associated with the pointer, but it is not part
   1276 of the address.
   1277 
   1278 Given a pointer for the architecture, this hook removes all the
   1279 non-significant bits and sign-extends things as needed.  It gets used to
   1280 remove non-address bits from any pointer used to access memory.
   1281 """,
   1282     type="CORE_ADDR",
   1283     name="remove_non_address_bits_memory",
   1284     params=[("CORE_ADDR", "pointer")],
   1285     predefault="default_remove_non_address_bits",
   1286     invalid=False,
   1287 )
   1288 
   1289 Method(
   1290     comment="""
   1291 Return a string representation of the memory tag TAG.
   1292 """,
   1293     type="std::string",
   1294     name="memtag_to_string",
   1295     params=[("struct value *", "tag")],
   1296     predefault="default_memtag_to_string",
   1297     invalid=False,
   1298 )
   1299 
   1300 Method(
   1301     comment="""
   1302 Return true if ADDRESS contains a tag and false otherwise.  ADDRESS
   1303 must be either a pointer or a reference type.
   1304 """,
   1305     type="bool",
   1306     name="tagged_address_p",
   1307     params=[("CORE_ADDR", "address")],
   1308     predefault="default_tagged_address_p",
   1309     invalid=False,
   1310 )
   1311 
   1312 Method(
   1313     comment="""
   1314 Return true if the tag from ADDRESS matches the memory tag for that
   1315 particular address.  Return false otherwise.
   1316 """,
   1317     type="bool",
   1318     name="memtag_matches_p",
   1319     params=[("struct value *", "address")],
   1320     predefault="default_memtag_matches_p",
   1321     invalid=False,
   1322 )
   1323 
   1324 Method(
   1325     comment="""
   1326 Set the tags of type TAG_TYPE, for the memory address range
   1327 [ADDRESS, ADDRESS + LENGTH) to TAGS.
   1328 Return true if successful and false otherwise.
   1329 """,
   1330     type="bool",
   1331     name="set_memtags",
   1332     params=[
   1333         ("struct value *", "address"),
   1334         ("size_t", "length"),
   1335         ("const gdb::byte_vector &", "tags"),
   1336         ("memtag_type", "tag_type"),
   1337     ],
   1338     predefault="default_set_memtags",
   1339     invalid=False,
   1340 )
   1341 
   1342 Method(
   1343     comment="""
   1344 Return the tag of type TAG_TYPE associated with the memory address ADDRESS,
   1345 assuming ADDRESS is tagged.
   1346 """,
   1347     type="struct value *",
   1348     name="get_memtag",
   1349     params=[("struct value *", "address"), ("memtag_type", "tag_type")],
   1350     predefault="default_get_memtag",
   1351     invalid=False,
   1352 )
   1353 
   1354 Value(
   1355     comment="""
   1356 memtag_granule_size is the size of the allocation tag granule, for
   1357 architectures that support memory tagging.
   1358 This is 0 for architectures that do not support memory tagging.
   1359 For a non-zero value, this represents the number of bytes of memory per tag.
   1360 """,
   1361     type="CORE_ADDR",
   1362     name="memtag_granule_size",
   1363     invalid=False,
   1364 )
   1365 
   1366 Function(
   1367     comment="""
   1368 FIXME/cagney/2001-01-18: This should be split in two.  A target method that
   1369 indicates if the target needs software single step.  An ISA method to
   1370 implement it.
   1371 
   1372 FIXME/cagney/2001-01-18: The logic is backwards.  It should be asking if the
   1373 target can single step.  If not, then implement single step using breakpoints.
   1374 
   1375 Return a vector of addresses on which the software single step
   1376 breakpoints should be inserted.  NULL means software single step is
   1377 not used.
   1378 Multiple breakpoints may be inserted for some instructions such as
   1379 conditional branch.  However, each implementation must always evaluate
   1380 the condition and only put the breakpoint at the branch destination if
   1381 the condition is true, so that we ensure forward progress when stepping
   1382 past a conditional branch to self.
   1383 """,
   1384     type="std::vector<CORE_ADDR>",
   1385     name="software_single_step",
   1386     params=[("struct regcache *", "regcache")],
   1387     predicate=True,
   1388 )
   1389 
   1390 Method(
   1391     comment="""
   1392 Return non-zero if the processor is executing a delay slot and a
   1393 further single-step is needed before the instruction finishes.
   1394 """,
   1395     type="int",
   1396     name="single_step_through_delay",
   1397     params=[("const frame_info_ptr &", "frame")],
   1398     predicate=True,
   1399 )
   1400 
   1401 Function(
   1402     comment="""
   1403 FIXME: cagney/2003-08-28: Need to find a better way of selecting the
   1404 disassembler.  Perhaps objdump can handle it?
   1405 """,
   1406     type="int",
   1407     name="print_insn",
   1408     params=[("bfd_vma", "vma"), ("struct disassemble_info *", "info")],
   1409     predefault="default_print_insn",
   1410     invalid=False,
   1411 )
   1412 
   1413 Function(
   1414     type="CORE_ADDR",
   1415     name="skip_trampoline_code",
   1416     params=[("const frame_info_ptr &", "frame"), ("CORE_ADDR", "pc")],
   1417     predefault="generic_skip_trampoline_code",
   1418     invalid=False,
   1419 )
   1420 
   1421 Value(
   1422     comment="Vtable of solib operations functions.",
   1423     type="const solib_ops *",
   1424     name="so_ops",
   1425     predefault="&solib_target_so_ops",
   1426     printer="host_address_to_string (gdbarch->so_ops)",
   1427     invalid=False,
   1428 )
   1429 
   1430 Method(
   1431     comment="""
   1432 If in_solib_dynsym_resolve_code() returns true, and SKIP_SOLIB_RESOLVER
   1433 evaluates non-zero, this is the address where the debugger will place
   1434 a step-resume breakpoint to get us past the dynamic linker.
   1435 """,
   1436     type="CORE_ADDR",
   1437     name="skip_solib_resolver",
   1438     params=[("CORE_ADDR", "pc")],
   1439     predefault="generic_skip_solib_resolver",
   1440     invalid=False,
   1441 )
   1442 
   1443 Method(
   1444     comment="""
   1445 Some systems also have trampoline code for returning from shared libs.
   1446 """,
   1447     type="int",
   1448     name="in_solib_return_trampoline",
   1449     params=[("CORE_ADDR", "pc"), ("const char *", "name")],
   1450     predefault="generic_in_solib_return_trampoline",
   1451     invalid=False,
   1452 )
   1453 
   1454 Method(
   1455     comment="""
   1456 Return true if PC lies inside an indirect branch thunk.
   1457 """,
   1458     type="bool",
   1459     name="in_indirect_branch_thunk",
   1460     params=[("CORE_ADDR", "pc")],
   1461     predefault="default_in_indirect_branch_thunk",
   1462     invalid=False,
   1463 )
   1464 
   1465 Method(
   1466     comment="""
   1467 A target might have problems with watchpoints as soon as the stack
   1468 frame of the current function has been destroyed.  This mostly happens
   1469 as the first action in a function's epilogue.  stack_frame_destroyed_p()
   1470 is defined to return a non-zero value if either the given addr is one
   1471 instruction after the stack destroying instruction up to the trailing
   1472 return instruction or if we can figure out that the stack frame has
   1473 already been invalidated regardless of the value of addr.  Targets
   1474 which don't suffer from that problem could just let this functionality
   1475 untouched.
   1476 """,
   1477     type="int",
   1478     name="stack_frame_destroyed_p",
   1479     params=[("CORE_ADDR", "addr")],
   1480     predefault="generic_stack_frame_destroyed_p",
   1481     invalid=False,
   1482 )
   1483 
   1484 Function(
   1485     comment="""
   1486 Process an ELF symbol in the minimal symbol table in a backend-specific
   1487 way.  Normally this hook is supposed to do nothing, however if required,
   1488 then this hook can be used to apply tranformations to symbols that are
   1489 considered special in some way.  For example the MIPS backend uses it
   1490 to interpret `st_other' information to mark compressed code symbols so
   1491 that they can be treated in the appropriate manner in the processing of
   1492 the main symbol table and DWARF-2 records.
   1493 """,
   1494     type="void",
   1495     name="elf_make_msymbol_special",
   1496     params=[("asymbol *", "sym"), ("struct minimal_symbol *", "msym")],
   1497     predicate=True,
   1498 )
   1499 
   1500 Function(
   1501     type="void",
   1502     name="coff_make_msymbol_special",
   1503     params=[("int", "val"), ("struct minimal_symbol *", "msym")],
   1504     predefault="default_coff_make_msymbol_special",
   1505     invalid=False,
   1506 )
   1507 
   1508 Function(
   1509     comment="""
   1510 Process a symbol in the main symbol table in a backend-specific way.
   1511 Normally this hook is supposed to do nothing, however if required,
   1512 then this hook can be used to apply tranformations to symbols that
   1513 are considered special in some way.  This is currently used by the
   1514 MIPS backend to make sure compressed code symbols have the ISA bit
   1515 set.  This in turn is needed for symbol values seen in GDB to match
   1516 the values used at the runtime by the program itself, for function
   1517 and label references.
   1518 """,
   1519     type="void",
   1520     name="make_symbol_special",
   1521     params=[("struct symbol *", "sym"), ("struct objfile *", "objfile")],
   1522     predefault="default_make_symbol_special",
   1523     invalid=False,
   1524 )
   1525 
   1526 Function(
   1527     comment="""
   1528 Adjust the address retrieved from a DWARF-2 record other than a line
   1529 entry in a backend-specific way.  Normally this hook is supposed to
   1530 return the address passed unchanged, however if that is incorrect for
   1531 any reason, then this hook can be used to fix the address up in the
   1532 required manner.  This is currently used by the MIPS backend to make
   1533 sure addresses in FDE, range records, etc. referring to compressed
   1534 code have the ISA bit set, matching line information and the symbol
   1535 table.
   1536 """,
   1537     type="CORE_ADDR",
   1538     name="adjust_dwarf2_addr",
   1539     params=[("CORE_ADDR", "pc")],
   1540     predefault="default_adjust_dwarf2_addr",
   1541     invalid=False,
   1542 )
   1543 
   1544 Function(
   1545     comment="""
   1546 Adjust the address updated by a line entry in a backend-specific way.
   1547 Normally this hook is supposed to return the address passed unchanged,
   1548 however in the case of inconsistencies in these records, this hook can
   1549 be used to fix them up in the required manner.  This is currently used
   1550 by the MIPS backend to make sure all line addresses in compressed code
   1551 are presented with the ISA bit set, which is not always the case.  This
   1552 in turn ensures breakpoint addresses are correctly matched against the
   1553 stop PC.
   1554 """,
   1555     type="CORE_ADDR",
   1556     name="adjust_dwarf2_line",
   1557     params=[("CORE_ADDR", "addr"), ("int", "rel")],
   1558     predefault="default_adjust_dwarf2_line",
   1559     invalid=False,
   1560 )
   1561 
   1562 Value(
   1563     type="int",
   1564     name="cannot_step_breakpoint",
   1565     predefault="0",
   1566     invalid=False,
   1567 )
   1568 
   1569 Value(
   1570     comment="""
   1571 See comment in target.h about continuable, steppable and
   1572 non-steppable watchpoints.
   1573 """,
   1574     type="int",
   1575     name="have_nonsteppable_watchpoint",
   1576     predefault="0",
   1577     invalid=False,
   1578 )
   1579 
   1580 Function(
   1581     type="type_instance_flags",
   1582     name="address_class_type_flags",
   1583     params=[("int", "byte_size"), ("int", "dwarf2_addr_class")],
   1584     predicate=True,
   1585 )
   1586 
   1587 Method(
   1588     type="const char *",
   1589     name="address_class_type_flags_to_name",
   1590     params=[("type_instance_flags", "type_flags")],
   1591     predicate=True,
   1592 )
   1593 
   1594 Method(
   1595     comment="""
   1596 Execute vendor-specific DWARF Call Frame Instruction.  OP is the instruction.
   1597 FS are passed from the generic execute_cfa_program function.
   1598 """,
   1599     type="bool",
   1600     name="execute_dwarf_cfa_vendor_op",
   1601     params=[("gdb_byte", "op"), ("struct dwarf2_frame_state *", "fs")],
   1602     predefault="default_execute_dwarf_cfa_vendor_op",
   1603     invalid=False,
   1604 )
   1605 
   1606 Method(
   1607     comment="""
   1608 Return the appropriate type_flags for the supplied address class.
   1609 This function should return true if the address class was recognized and
   1610 type_flags was set, false otherwise.
   1611 """,
   1612     type="bool",
   1613     name="address_class_name_to_type_flags",
   1614     params=[("const char *", "name"), ("type_instance_flags *", "type_flags_ptr")],
   1615     predicate=True,
   1616 )
   1617 
   1618 Method(
   1619     comment="""
   1620 Is a register in a group
   1621 """,
   1622     type="int",
   1623     name="register_reggroup_p",
   1624     params=[("int", "regnum"), ("const struct reggroup *", "reggroup")],
   1625     predefault="default_register_reggroup_p",
   1626     invalid=False,
   1627 )
   1628 
   1629 Function(
   1630     comment="""
   1631 Fetch the pointer to the ith function argument.
   1632 """,
   1633     type="CORE_ADDR",
   1634     name="fetch_pointer_argument",
   1635     params=[
   1636         ("const frame_info_ptr &", "frame"),
   1637         ("int", "argi"),
   1638         ("struct type *", "type"),
   1639     ],
   1640     predicate=True,
   1641 )
   1642 
   1643 Method(
   1644     comment="""
   1645 Iterate over all supported register notes in a core file.  For each
   1646 supported register note section, the iterator must call CB and pass
   1647 CB_DATA unchanged.  If REGCACHE is not NULL, the iterator can limit
   1648 the supported register note sections based on the current register
   1649 values.  Otherwise it should enumerate all supported register note
   1650 sections.
   1651 """,
   1652     type="void",
   1653     name="iterate_over_regset_sections",
   1654     params=[
   1655         ("iterate_over_regset_sections_cb *", "cb"),
   1656         ("void *", "cb_data"),
   1657         ("const struct regcache *", "regcache"),
   1658     ],
   1659     predicate=True,
   1660 )
   1661 
   1662 Method(
   1663     comment="""
   1664 Create core file notes
   1665 """,
   1666     type="gdb::unique_xmalloc_ptr<char>",
   1667     name="make_corefile_notes",
   1668     params=[("bfd *", "obfd"), ("int *", "note_size")],
   1669     predicate=True,
   1670 )
   1671 
   1672 Method(
   1673     comment="""
   1674 Find core file memory regions
   1675 """,
   1676     type="int",
   1677     name="find_memory_regions",
   1678     params=[("find_memory_region_ftype", "func"), ("void *", "data")],
   1679     predicate=True,
   1680 )
   1681 
   1682 Method(
   1683     comment="""
   1684 Given a bfd OBFD, segment ADDRESS and SIZE, create a memory tag section to be dumped to a core file
   1685 """,
   1686     type="asection *",
   1687     name="create_memtag_section",
   1688     params=[("bfd *", "obfd"), ("CORE_ADDR", "address"), ("size_t", "size")],
   1689     predicate=True,
   1690 )
   1691 
   1692 Method(
   1693     comment="""
   1694 Given a memory tag section OSEC, fill OSEC's contents with the appropriate tag data
   1695 """,
   1696     type="bool",
   1697     name="fill_memtag_section",
   1698     params=[("asection *", "osec")],
   1699     predicate=True,
   1700 )
   1701 
   1702 Method(
   1703     comment="""
   1704 Decode a memory tag SECTION and return the tags of type TYPE contained in
   1705 the memory range [ADDRESS, ADDRESS + LENGTH).
   1706 If no tags were found, return an empty vector.
   1707 """,
   1708     type="gdb::byte_vector",
   1709     name="decode_memtag_section",
   1710     params=[
   1711         ("bfd_section *", "section"),
   1712         ("int", "type"),
   1713         ("CORE_ADDR", "address"),
   1714         ("size_t", "length"),
   1715     ],
   1716     predicate=True,
   1717 )
   1718 
   1719 Method(
   1720     comment="""
   1721 Read offset OFFSET of TARGET_OBJECT_LIBRARIES formatted shared libraries list from
   1722 core file into buffer READBUF with length LEN.  Return the number of bytes read
   1723 (zero indicates failure).
   1724 failed, otherwise, return the red length of READBUF.
   1725 """,
   1726     type="ULONGEST",
   1727     name="core_xfer_shared_libraries",
   1728     params=[("gdb_byte *", "readbuf"), ("ULONGEST", "offset"), ("ULONGEST", "len")],
   1729     predicate=True,
   1730 )
   1731 
   1732 Method(
   1733     comment="""
   1734 Read offset OFFSET of TARGET_OBJECT_LIBRARIES_AIX formatted shared
   1735 libraries list from core file into buffer READBUF with length LEN.
   1736 Return the number of bytes read (zero indicates failure).
   1737 """,
   1738     type="ULONGEST",
   1739     name="core_xfer_shared_libraries_aix",
   1740     params=[("gdb_byte *", "readbuf"), ("ULONGEST", "offset"), ("ULONGEST", "len")],
   1741     predicate=True,
   1742 )
   1743 
   1744 Method(
   1745     comment="""
   1746 How the core target converts a PTID from a core file to a string.
   1747 """,
   1748     type="std::string",
   1749     name="core_pid_to_str",
   1750     params=[("ptid_t", "ptid")],
   1751     predicate=True,
   1752 )
   1753 
   1754 Method(
   1755     comment="""
   1756 How the core target extracts the name of a thread from a core file.
   1757 """,
   1758     type="const char *",
   1759     name="core_thread_name",
   1760     params=[("struct thread_info *", "thr")],
   1761     predicate=True,
   1762 )
   1763 
   1764 Method(
   1765     comment="""
   1766 Read offset OFFSET of TARGET_OBJECT_SIGNAL_INFO signal information
   1767 from core file into buffer READBUF with length LEN.  Return the number
   1768 of bytes read (zero indicates EOF, a negative value indicates failure).
   1769 """,
   1770     type="LONGEST",
   1771     name="core_xfer_siginfo",
   1772     params=[("gdb_byte *", "readbuf"), ("ULONGEST", "offset"), ("ULONGEST", "len")],
   1773     predicate=True,
   1774 )
   1775 
   1776 Method(
   1777     comment="""
   1778 Read x86 XSAVE layout information from core file into XSAVE_LAYOUT.
   1779 Returns true if the layout was read successfully.
   1780 """,
   1781     type="bool",
   1782     name="core_read_x86_xsave_layout",
   1783     params=[("x86_xsave_layout &", "xsave_layout")],
   1784     predicate=True,
   1785 )
   1786 
   1787 Value(
   1788     comment="""
   1789 BFD target to use when generating a core file.
   1790 """,
   1791     type="const char *",
   1792     name="gcore_bfd_target",
   1793     predicate=True,
   1794     printer="pstring (gdbarch->gcore_bfd_target)",
   1795 )
   1796 
   1797 Value(
   1798     comment="""
   1799 If the elements of C++ vtables are in-place function descriptors rather
   1800 than normal function pointers (which may point to code or a descriptor),
   1801 set this to one.
   1802 """,
   1803     type="int",
   1804     name="vtable_function_descriptors",
   1805     predefault="0",
   1806     invalid=False,
   1807 )
   1808 
   1809 Value(
   1810     comment="""
   1811 Set if the least significant bit of the delta is used instead of the least
   1812 significant bit of the pfn for pointers to virtual member functions.
   1813 """,
   1814     type="int",
   1815     name="vbit_in_delta",
   1816     invalid=False,
   1817 )
   1818 
   1819 Function(
   1820     comment="""
   1821 Advance PC to next instruction in order to skip a permanent breakpoint.
   1822 """,
   1823     type="void",
   1824     name="skip_permanent_breakpoint",
   1825     params=[("struct regcache *", "regcache")],
   1826     predefault="default_skip_permanent_breakpoint",
   1827     invalid=False,
   1828 )
   1829 
   1830 Value(
   1831     comment="""
   1832 The maximum length of an instruction on this architecture in bytes.
   1833 """,
   1834     type="ULONGEST",
   1835     name="max_insn_length",
   1836     predefault="0",
   1837     predicate=True,
   1838 )
   1839 
   1840 Method(
   1841     comment="""
   1842 Copy the instruction at FROM to TO, and make any adjustments
   1843 necessary to single-step it at that address.
   1844 
   1845 REGS holds the state the thread's registers will have before
   1846 executing the copied instruction; the PC in REGS will refer to FROM,
   1847 not the copy at TO.  The caller should update it to point at TO later.
   1848 
   1849 Return a pointer to data of the architecture's choice to be passed
   1850 to gdbarch_displaced_step_fixup.
   1851 
   1852 For a general explanation of displaced stepping and how GDB uses it,
   1853 see the comments in infrun.c.
   1854 
   1855 The TO area is only guaranteed to have space for
   1856 gdbarch_displaced_step_buffer_length (arch) octets, so this
   1857 function must not write more octets than that to this area.
   1858 
   1859 If you do not provide this function, GDB assumes that the
   1860 architecture does not support displaced stepping.
   1861 
   1862 If the instruction cannot execute out of line, return NULL.  The
   1863 core falls back to stepping past the instruction in-line instead in
   1864 that case.
   1865 """,
   1866     type="displaced_step_copy_insn_closure_up",
   1867     name="displaced_step_copy_insn",
   1868     params=[("CORE_ADDR", "from"), ("CORE_ADDR", "to"), ("struct regcache *", "regs")],
   1869     predicate=True,
   1870 )
   1871 
   1872 Method(
   1873     comment="""
   1874 Return true if GDB should use hardware single-stepping to execute a displaced
   1875 step instruction.  If false, GDB will simply restart execution at the
   1876 displaced instruction location, and it is up to the target to ensure GDB will
   1877 receive control again (e.g. by placing a software breakpoint instruction into
   1878 the displaced instruction buffer).
   1879 
   1880 The default implementation returns false on all targets that provide a
   1881 gdbarch_software_single_step routine, and true otherwise.
   1882 """,
   1883     type="bool",
   1884     name="displaced_step_hw_singlestep",
   1885     params=[],
   1886     predefault="default_displaced_step_hw_singlestep",
   1887     invalid=False,
   1888 )
   1889 
   1890 Method(
   1891     comment="""
   1892 Fix up the state after attempting to single-step a displaced
   1893 instruction, to give the result we would have gotten from stepping the
   1894 instruction in its original location.
   1895 
   1896 REGS is the register state resulting from single-stepping the
   1897 displaced instruction.
   1898 
   1899 CLOSURE is the result from the matching call to
   1900 gdbarch_displaced_step_copy_insn.
   1901 
   1902 FROM is the address where the instruction was original located, TO is
   1903 the address of the displaced buffer where the instruction was copied
   1904 to for stepping.
   1905 
   1906 COMPLETED_P is true if GDB stopped as a result of the requested step
   1907 having completed (e.g. the inferior stopped with SIGTRAP), otherwise
   1908 COMPLETED_P is false and GDB stopped for some other reason.  In the
   1909 case where a single instruction is expanded to multiple replacement
   1910 instructions for stepping then it may be necessary to read the current
   1911 program counter from REGS in order to decide how far through the
   1912 series of replacement instructions the inferior got before stopping,
   1913 this may impact what will need fixing up in this function.
   1914 
   1915 For a general explanation of displaced stepping and how GDB uses it,
   1916 see the comments in infrun.c.
   1917 """,
   1918     type="void",
   1919     name="displaced_step_fixup",
   1920     params=[
   1921         ("struct displaced_step_copy_insn_closure *", "closure"),
   1922         ("CORE_ADDR", "from"),
   1923         ("CORE_ADDR", "to"),
   1924         ("struct regcache *", "regs"),
   1925         ("bool", "completed_p"),
   1926     ],
   1927     predicate=False,
   1928     predefault="NULL",
   1929     invalid="(gdbarch->displaced_step_copy_insn == nullptr) != (gdbarch->displaced_step_fixup == nullptr)",
   1930 )
   1931 
   1932 Method(
   1933     comment="""
   1934 Prepare THREAD for it to displaced step the instruction at its current PC.
   1935 
   1936 Throw an exception if any unexpected error happens.
   1937 """,
   1938     type="displaced_step_prepare_status",
   1939     name="displaced_step_prepare",
   1940     params=[("thread_info *", "thread"), ("CORE_ADDR &", "displaced_pc")],
   1941     predicate=True,
   1942 )
   1943 
   1944 Method(
   1945     comment="""
   1946 Clean up after a displaced step of THREAD.
   1947 
   1948 It is possible for the displaced-stepped instruction to have caused
   1949 the thread to exit.  The implementation can detect this case by
   1950 checking if WS.kind is TARGET_WAITKIND_THREAD_EXITED.
   1951 """,
   1952     type="displaced_step_finish_status",
   1953     name="displaced_step_finish",
   1954     params=[("thread_info *", "thread"), ("const target_waitstatus &", "ws")],
   1955     predefault="NULL",
   1956     invalid="(! gdbarch->displaced_step_finish) != (! gdbarch->displaced_step_prepare)",
   1957 )
   1958 
   1959 Function(
   1960     comment="""
   1961 Return the closure associated to the displaced step buffer that is at ADDR.
   1962 """,
   1963     type="const displaced_step_copy_insn_closure *",
   1964     name="displaced_step_copy_insn_closure_by_addr",
   1965     params=[("inferior *", "inf"), ("CORE_ADDR", "addr")],
   1966     predicate=True,
   1967 )
   1968 
   1969 Function(
   1970     comment="""
   1971 PARENT_INF has forked and CHILD_PTID is the ptid of the child.  Restore the
   1972 contents of all displaced step buffers in the child's address space.
   1973 """,
   1974     type="void",
   1975     name="displaced_step_restore_all_in_ptid",
   1976     params=[("inferior *", "parent_inf"), ("ptid_t", "child_ptid")],
   1977     invalid=False,
   1978 )
   1979 
   1980 Value(
   1981     comment="""
   1982 The maximum length in octets required for a displaced-step instruction
   1983 buffer.  By default this will be the same as gdbarch::max_insn_length,
   1984 but should be overridden for architectures that might expand a
   1985 displaced-step instruction to multiple replacement instructions.
   1986 """,
   1987     type="ULONGEST",
   1988     name="displaced_step_buffer_length",
   1989     predefault="0",
   1990     postdefault="gdbarch->max_insn_length",
   1991     invalid="gdbarch->displaced_step_buffer_length < gdbarch->max_insn_length",
   1992 )
   1993 
   1994 Method(
   1995     comment="""
   1996 Relocate an instruction to execute at a different address.  OLDLOC
   1997 is the address in the inferior memory where the instruction to
   1998 relocate is currently at.  On input, TO points to the destination
   1999 where we want the instruction to be copied (and possibly adjusted)
   2000 to.  On output, it points to one past the end of the resulting
   2001 instruction(s).  The effect of executing the instruction at TO shall
   2002 be the same as if executing it at FROM.  For example, call
   2003 instructions that implicitly push the return address on the stack
   2004 should be adjusted to return to the instruction after OLDLOC;
   2005 relative branches, and other PC-relative instructions need the
   2006 offset adjusted; etc.
   2007 """,
   2008     type="void",
   2009     name="relocate_instruction",
   2010     params=[("CORE_ADDR *", "to"), ("CORE_ADDR", "from")],
   2011     predicate=True,
   2012     predefault="NULL",
   2013 )
   2014 
   2015 Function(
   2016     comment="""
   2017 Refresh overlay mapped state for section OSECT.
   2018 """,
   2019     type="void",
   2020     name="overlay_update",
   2021     params=[("struct obj_section *", "osect")],
   2022     predicate=True,
   2023 )
   2024 
   2025 Method(
   2026     type="const struct target_desc *",
   2027     name="core_read_description",
   2028     params=[("struct target_ops *", "target"), ("bfd *", "abfd")],
   2029     predicate=True,
   2030 )
   2031 
   2032 Value(
   2033     comment="""
   2034 Set if the address in N_SO or N_FUN stabs may be zero.
   2035 """,
   2036     type="int",
   2037     name="sofun_address_maybe_missing",
   2038     predefault="0",
   2039     invalid=False,
   2040 )
   2041 
   2042 Method(
   2043     comment="""
   2044 Parse the instruction at ADDR storing in the record execution log
   2045 the registers REGCACHE and memory ranges that will be affected when
   2046 the instruction executes, along with their current values.
   2047 Return -1 if something goes wrong, 0 otherwise.
   2048 """,
   2049     type="int",
   2050     name="process_record",
   2051     params=[("struct regcache *", "regcache"), ("CORE_ADDR", "addr")],
   2052     predicate=True,
   2053 )
   2054 
   2055 Method(
   2056     comment="""
   2057 Save process state after a signal.
   2058 Return -1 if something goes wrong, 0 otherwise.
   2059 """,
   2060     type="int",
   2061     name="process_record_signal",
   2062     params=[("struct regcache *", "regcache"), ("enum gdb_signal", "signal")],
   2063     predicate=True,
   2064 )
   2065 
   2066 Method(
   2067     comment="""
   2068 Signal translation: translate inferior's signal (target's) number
   2069 into GDB's representation.  The implementation of this method must
   2070 be host independent.  IOW, don't rely on symbols of the NAT_FILE
   2071 header (the nm-*.h files), the host <signal.h> header, or similar
   2072 headers.  This is mainly used when cross-debugging core files ---
   2073 "Live" targets hide the translation behind the target interface
   2074 (target_wait, target_resume, etc.).
   2075 """,
   2076     type="enum gdb_signal",
   2077     name="gdb_signal_from_target",
   2078     params=[("int", "signo")],
   2079     predicate=True,
   2080 )
   2081 
   2082 Method(
   2083     comment="""
   2084 Signal translation: translate the GDB's internal signal number into
   2085 the inferior's signal (target's) representation.  The implementation
   2086 of this method must be host independent.  IOW, don't rely on symbols
   2087 of the NAT_FILE header (the nm-*.h files), the host <signal.h>
   2088 header, or similar headers.
   2089 Return the target signal number if found, or -1 if the GDB internal
   2090 signal number is invalid.
   2091 """,
   2092     type="int",
   2093     name="gdb_signal_to_target",
   2094     params=[("enum gdb_signal", "signal")],
   2095     predicate=True,
   2096 )
   2097 
   2098 Method(
   2099     comment="""
   2100 Extra signal info inspection.
   2101 
   2102 Return a type suitable to inspect extra signal information.
   2103 """,
   2104     type="struct type *",
   2105     name="get_siginfo_type",
   2106     params=[],
   2107     predicate=True,
   2108 )
   2109 
   2110 Method(
   2111     comment="""
   2112 Record architecture-specific information from the symbol table.
   2113 """,
   2114     type="void",
   2115     name="record_special_symbol",
   2116     params=[("struct objfile *", "objfile"), ("asymbol *", "sym")],
   2117     predicate=True,
   2118 )
   2119 
   2120 Method(
   2121     comment="""
   2122 Function for the 'catch syscall' feature.
   2123 Get architecture-specific system calls information from registers.
   2124 """,
   2125     type="LONGEST",
   2126     name="get_syscall_number",
   2127     params=[("thread_info *", "thread")],
   2128     predicate=True,
   2129 )
   2130 
   2131 Value(
   2132     comment="""
   2133 The filename of the XML syscall for this architecture.
   2134 """,
   2135     type="const char *",
   2136     name="xml_syscall_file",
   2137     invalid=False,
   2138     printer="pstring (gdbarch->xml_syscall_file)",
   2139 )
   2140 
   2141 Value(
   2142     comment="""
   2143 Information about system calls from this architecture
   2144 """,
   2145     type="struct syscalls_info *",
   2146     name="syscalls_info",
   2147     invalid=False,
   2148     printer="host_address_to_string (gdbarch->syscalls_info)",
   2149 )
   2150 
   2151 Value(
   2152     comment="""
   2153 SystemTap related fields and functions.
   2154 A NULL-terminated array of prefixes used to mark an integer constant
   2155 on the architecture's assembly.
   2156 For example, on x86 integer constants are written as:
   2157 
   2158 $10 ;; integer constant 10
   2159 
   2160 in this case, this prefix would be the character `$'.
   2161 """,
   2162     type="const char *const *",
   2163     name="stap_integer_prefixes",
   2164     invalid=False,
   2165     printer="pstring_list (gdbarch->stap_integer_prefixes)",
   2166 )
   2167 
   2168 Value(
   2169     comment="""
   2170 A NULL-terminated array of suffixes used to mark an integer constant
   2171 on the architecture's assembly.
   2172 """,
   2173     type="const char *const *",
   2174     name="stap_integer_suffixes",
   2175     invalid=False,
   2176     printer="pstring_list (gdbarch->stap_integer_suffixes)",
   2177 )
   2178 
   2179 Value(
   2180     comment="""
   2181 A NULL-terminated array of prefixes used to mark a register name on
   2182 the architecture's assembly.
   2183 For example, on x86 the register name is written as:
   2184 
   2185 %eax ;; register eax
   2186 
   2187 in this case, this prefix would be the character `%'.
   2188 """,
   2189     type="const char *const *",
   2190     name="stap_register_prefixes",
   2191     invalid=False,
   2192     printer="pstring_list (gdbarch->stap_register_prefixes)",
   2193 )
   2194 
   2195 Value(
   2196     comment="""
   2197 A NULL-terminated array of suffixes used to mark a register name on
   2198 the architecture's assembly.
   2199 """,
   2200     type="const char *const *",
   2201     name="stap_register_suffixes",
   2202     invalid=False,
   2203     printer="pstring_list (gdbarch->stap_register_suffixes)",
   2204 )
   2205 
   2206 Value(
   2207     comment="""
   2208 A NULL-terminated array of prefixes used to mark a register
   2209 indirection on the architecture's assembly.
   2210 For example, on x86 the register indirection is written as:
   2211 
   2212 (%eax) ;; indirecting eax
   2213 
   2214 in this case, this prefix would be the charater `('.
   2215 
   2216 Please note that we use the indirection prefix also for register
   2217 displacement, e.g., `4(%eax)' on x86.
   2218 """,
   2219     type="const char *const *",
   2220     name="stap_register_indirection_prefixes",
   2221     invalid=False,
   2222     printer="pstring_list (gdbarch->stap_register_indirection_prefixes)",
   2223 )
   2224 
   2225 Value(
   2226     comment="""
   2227 A NULL-terminated array of suffixes used to mark a register
   2228 indirection on the architecture's assembly.
   2229 For example, on x86 the register indirection is written as:
   2230 
   2231 (%eax) ;; indirecting eax
   2232 
   2233 in this case, this prefix would be the charater `)'.
   2234 
   2235 Please note that we use the indirection suffix also for register
   2236 displacement, e.g., `4(%eax)' on x86.
   2237 """,
   2238     type="const char *const *",
   2239     name="stap_register_indirection_suffixes",
   2240     invalid=False,
   2241     printer="pstring_list (gdbarch->stap_register_indirection_suffixes)",
   2242 )
   2243 
   2244 Value(
   2245     comment="""
   2246 Prefix(es) used to name a register using GDB's nomenclature.
   2247 
   2248 For example, on PPC a register is represented by a number in the assembly
   2249 language (e.g., `10' is the 10th general-purpose register).  However,
   2250 inside GDB this same register has an `r' appended to its name, so the 10th
   2251 register would be represented as `r10' internally.
   2252 """,
   2253     type="const char *",
   2254     name="stap_gdb_register_prefix",
   2255     invalid=False,
   2256     printer="pstring (gdbarch->stap_gdb_register_prefix)",
   2257 )
   2258 
   2259 Value(
   2260     comment="""
   2261 Suffix used to name a register using GDB's nomenclature.
   2262 """,
   2263     type="const char *",
   2264     name="stap_gdb_register_suffix",
   2265     invalid=False,
   2266     printer="pstring (gdbarch->stap_gdb_register_suffix)",
   2267 )
   2268 
   2269 Method(
   2270     comment="""
   2271 Check if S is a single operand.
   2272 
   2273 Single operands can be:
   2274 - Literal integers, e.g. `$10' on x86
   2275 - Register access, e.g. `%eax' on x86
   2276 - Register indirection, e.g. `(%eax)' on x86
   2277 - Register displacement, e.g. `4(%eax)' on x86
   2278 
   2279 This function should check for these patterns on the string
   2280 and return 1 if some were found, or zero otherwise.  Please try to match
   2281 as much info as you can from the string, i.e., if you have to match
   2282 something like `(%', do not match just the `('.
   2283 """,
   2284     type="int",
   2285     name="stap_is_single_operand",
   2286     params=[("const char *", "s")],
   2287     predicate=True,
   2288 )
   2289 
   2290 Method(
   2291     comment="""
   2292 Function used to handle a "special case" in the parser.
   2293 
   2294 A "special case" is considered to be an unknown token, i.e., a token
   2295 that the parser does not know how to parse.  A good example of special
   2296 case would be ARM's register displacement syntax:
   2297 
   2298 [R0, #4]  ;; displacing R0 by 4
   2299 
   2300 Since the parser assumes that a register displacement is of the form:
   2301 
   2302 <number> <indirection_prefix> <register_name> <indirection_suffix>
   2303 
   2304 it means that it will not be able to recognize and parse this odd syntax.
   2305 Therefore, we should add a special case function that will handle this token.
   2306 
   2307 This function should generate the proper expression form of the expression
   2308 using GDB's internal expression mechanism (e.g., `write_exp_elt_opcode'
   2309 and so on).  It should also return 1 if the parsing was successful, or zero
   2310 if the token was not recognized as a special token (in this case, returning
   2311 zero means that the special parser is deferring the parsing to the generic
   2312 parser), and should advance the buffer pointer (p->arg).
   2313 """,
   2314     type="expr::operation_up",
   2315     name="stap_parse_special_token",
   2316     params=[("struct stap_parse_info *", "p")],
   2317     predicate=True,
   2318 )
   2319 
   2320 Method(
   2321     comment="""
   2322 Perform arch-dependent adjustments to a register name.
   2323 
   2324 In very specific situations, it may be necessary for the register
   2325 name present in a SystemTap probe's argument to be handled in a
   2326 special way.  For example, on i386, GCC may over-optimize the
   2327 register allocation and use smaller registers than necessary.  In
   2328 such cases, the client that is reading and evaluating the SystemTap
   2329 probe (ourselves) will need to actually fetch values from the wider
   2330 version of the register in question.
   2331 
   2332 To illustrate the example, consider the following probe argument
   2333 (i386):
   2334 
   2335 4@%ax
   2336 
   2337 This argument says that its value can be found at the %ax register,
   2338 which is a 16-bit register.  However, the argument's prefix says
   2339 that its type is "uint32_t", which is 32-bit in size.  Therefore, in
   2340 this case, GDB should actually fetch the probe's value from register
   2341 %eax, not %ax.  In this scenario, this function would actually
   2342 replace the register name from %ax to %eax.
   2343 
   2344 The rationale for this can be found at PR breakpoints/24541.
   2345 """,
   2346     type="std::string",
   2347     name="stap_adjust_register",
   2348     params=[
   2349         ("struct stap_parse_info *", "p"),
   2350         ("const std::string &", "regname"),
   2351         ("int", "regnum"),
   2352     ],
   2353     predicate=True,
   2354 )
   2355 
   2356 Method(
   2357     comment="""
   2358 DTrace related functions.
   2359 The expression to compute the NARTGth+1 argument to a DTrace USDT probe.
   2360 NARG must be >= 0.
   2361 """,
   2362     type="expr::operation_up",
   2363     name="dtrace_parse_probe_argument",
   2364     params=[("int", "narg")],
   2365     predicate=True,
   2366 )
   2367 
   2368 Method(
   2369     comment="""
   2370 True if the given ADDR does not contain the instruction sequence
   2371 corresponding to a disabled DTrace is-enabled probe.
   2372 """,
   2373     type="int",
   2374     name="dtrace_probe_is_enabled",
   2375     params=[("CORE_ADDR", "addr")],
   2376     predicate=True,
   2377 )
   2378 
   2379 Method(
   2380     comment="""
   2381 Enable a DTrace is-enabled probe at ADDR.
   2382 """,
   2383     type="void",
   2384     name="dtrace_enable_probe",
   2385     params=[("CORE_ADDR", "addr")],
   2386     predicate=True,
   2387 )
   2388 
   2389 Method(
   2390     comment="""
   2391 Disable a DTrace is-enabled probe at ADDR.
   2392 """,
   2393     type="void",
   2394     name="dtrace_disable_probe",
   2395     params=[("CORE_ADDR", "addr")],
   2396     predicate=True,
   2397 )
   2398 
   2399 Value(
   2400     comment="""
   2401 True if the list of shared libraries is one and only for all
   2402 processes, as opposed to a list of shared libraries per inferior.
   2403 This usually means that all processes, although may or may not share
   2404 an address space, will see the same set of symbols at the same
   2405 addresses.
   2406 """,
   2407     type="int",
   2408     name="has_global_solist",
   2409     predefault="0",
   2410     invalid=False,
   2411 )
   2412 
   2413 Value(
   2414     comment="""
   2415 On some targets, even though each inferior has its own private
   2416 address space, the debug interface takes care of making breakpoints
   2417 visible to all address spaces automatically.  For such cases,
   2418 this property should be set to true.
   2419 """,
   2420     type="int",
   2421     name="has_global_breakpoints",
   2422     predefault="0",
   2423     invalid=False,
   2424 )
   2425 
   2426 Method(
   2427     comment="""
   2428 True if inferiors share an address space (e.g., uClinux).
   2429 """,
   2430     type="int",
   2431     name="has_shared_address_space",
   2432     params=[],
   2433     predefault="default_has_shared_address_space",
   2434     invalid=False,
   2435 )
   2436 
   2437 Method(
   2438     comment="""
   2439 True if a fast tracepoint can be set at an address.
   2440 """,
   2441     type="int",
   2442     name="fast_tracepoint_valid_at",
   2443     params=[("CORE_ADDR", "addr"), ("std::string *", "msg")],
   2444     predefault="default_fast_tracepoint_valid_at",
   2445     invalid=False,
   2446 )
   2447 
   2448 Method(
   2449     comment="""
   2450 Guess register state based on tracepoint location.  Used for tracepoints
   2451 where no registers have been collected, but there's only one location,
   2452 allowing us to guess the PC value, and perhaps some other registers.
   2453 On entry, regcache has all registers marked as unavailable.
   2454 """,
   2455     type="void",
   2456     name="guess_tracepoint_registers",
   2457     params=[("struct regcache *", "regcache"), ("CORE_ADDR", "addr")],
   2458     predefault="default_guess_tracepoint_registers",
   2459     invalid=False,
   2460 )
   2461 
   2462 Function(
   2463     comment="""
   2464 Return the "auto" target charset.
   2465 """,
   2466     type="const char *",
   2467     name="auto_charset",
   2468     params=[],
   2469     predefault="default_auto_charset",
   2470     invalid=False,
   2471 )
   2472 
   2473 Function(
   2474     comment="""
   2475 Return the "auto" target wide charset.
   2476 """,
   2477     type="const char *",
   2478     name="auto_wide_charset",
   2479     params=[],
   2480     predefault="default_auto_wide_charset",
   2481     invalid=False,
   2482 )
   2483 
   2484 Value(
   2485     comment="""
   2486 If non-empty, this is a file extension that will be opened in place
   2487 of the file extension reported by the shared library list.
   2488 
   2489 This is most useful for toolchains that use a post-linker tool,
   2490 where the names of the files run on the target differ in extension
   2491 compared to the names of the files GDB should load for debug info.
   2492 """,
   2493     type="const char *",
   2494     name="solib_symbols_extension",
   2495     invalid=False,
   2496     printer="pstring (gdbarch->solib_symbols_extension)",
   2497 )
   2498 
   2499 Value(
   2500     comment="""
   2501 If true, the target OS has DOS-based file system semantics.  That
   2502 is, absolute paths include a drive name, and the backslash is
   2503 considered a directory separator.
   2504 """,
   2505     type="int",
   2506     name="has_dos_based_file_system",
   2507     predefault="0",
   2508     invalid=False,
   2509 )
   2510 
   2511 Method(
   2512     comment="""
   2513 Generate bytecodes to collect the return address in a frame.
   2514 Since the bytecodes run on the target, possibly with GDB not even
   2515 connected, the full unwinding machinery is not available, and
   2516 typically this function will issue bytecodes for one or more likely
   2517 places that the return address may be found.
   2518 """,
   2519     type="void",
   2520     name="gen_return_address",
   2521     params=[
   2522         ("struct agent_expr *", "ax"),
   2523         ("struct axs_value *", "value"),
   2524         ("CORE_ADDR", "scope"),
   2525     ],
   2526     predefault="default_gen_return_address",
   2527     invalid=False,
   2528 )
   2529 
   2530 Method(
   2531     comment="""
   2532 Implement the "info proc" command.
   2533 """,
   2534     type="void",
   2535     name="info_proc",
   2536     params=[("const char *", "args"), ("enum info_proc_what", "what")],
   2537     predicate=True,
   2538 )
   2539 
   2540 Method(
   2541     comment="""
   2542 Implement the "info proc" command for core files.  Noe that there
   2543 are two "info_proc"-like methods on gdbarch -- one for core files,
   2544 one for live targets.
   2545 """,
   2546     type="void",
   2547     name="core_info_proc",
   2548     params=[("const char *", "args"), ("enum info_proc_what", "what")],
   2549     predicate=True,
   2550 )
   2551 
   2552 Method(
   2553     comment="""
   2554 Iterate over all objfiles in the order that makes the most sense
   2555 for the architecture to make global symbol searches.
   2556 
   2557 CB is a callback function passed an objfile to be searched.  The iteration stops
   2558 if this function returns nonzero.
   2559 
   2560 If not NULL, CURRENT_OBJFILE corresponds to the objfile being
   2561 inspected when the symbol search was requested.
   2562 """,
   2563     type="void",
   2564     name="iterate_over_objfiles_in_search_order",
   2565     params=[
   2566         ("iterate_over_objfiles_in_search_order_cb_ftype", "cb"),
   2567         ("struct objfile *", "current_objfile"),
   2568     ],
   2569     predefault="default_iterate_over_objfiles_in_search_order",
   2570     invalid=False,
   2571 )
   2572 
   2573 Value(
   2574     comment="""
   2575 Ravenscar arch-dependent ops.
   2576 """,
   2577     type="struct ravenscar_arch_ops *",
   2578     name="ravenscar_ops",
   2579     predefault="NULL",
   2580     invalid=False,
   2581     printer="host_address_to_string (gdbarch->ravenscar_ops)",
   2582 )
   2583 
   2584 Method(
   2585     comment="""
   2586 Return non-zero if the instruction at ADDR is a call; zero otherwise.
   2587 """,
   2588     type="int",
   2589     name="insn_is_call",
   2590     params=[("CORE_ADDR", "addr")],
   2591     predefault="default_insn_is_call",
   2592     invalid=False,
   2593 )
   2594 
   2595 Method(
   2596     comment="""
   2597 Return non-zero if the instruction at ADDR is a return; zero otherwise.
   2598 """,
   2599     type="int",
   2600     name="insn_is_ret",
   2601     params=[("CORE_ADDR", "addr")],
   2602     predefault="default_insn_is_ret",
   2603     invalid=False,
   2604 )
   2605 
   2606 Method(
   2607     comment="""
   2608 Return non-zero if the instruction at ADDR is a jump; zero otherwise.
   2609 """,
   2610     type="int",
   2611     name="insn_is_jump",
   2612     params=[("CORE_ADDR", "addr")],
   2613     predefault="default_insn_is_jump",
   2614     invalid=False,
   2615 )
   2616 
   2617 Method(
   2618     comment="""
   2619 Return true if there's a program/permanent breakpoint planted in
   2620 memory at ADDRESS, return false otherwise.
   2621 """,
   2622     type="bool",
   2623     name="program_breakpoint_here_p",
   2624     params=[("CORE_ADDR", "address")],
   2625     predefault="default_program_breakpoint_here_p",
   2626     invalid=False,
   2627 )
   2628 
   2629 Method(
   2630     comment="""
   2631 Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
   2632 Return 0 if *READPTR is already at the end of the buffer.
   2633 Return -1 if there is insufficient buffer for a whole entry.
   2634 Return 1 if an entry was read into *TYPEP and *VALP.
   2635 """,
   2636     type="int",
   2637     name="auxv_parse",
   2638     params=[
   2639         ("const gdb_byte **", "readptr"),
   2640         ("const gdb_byte *", "endptr"),
   2641         ("CORE_ADDR *", "typep"),
   2642         ("CORE_ADDR *", "valp"),
   2643     ],
   2644     predicate=True,
   2645 )
   2646 
   2647 Method(
   2648     comment="""
   2649 Print the description of a single auxv entry described by TYPE and VAL
   2650 to FILE.
   2651 """,
   2652     type="void",
   2653     name="print_auxv_entry",
   2654     params=[("struct ui_file *", "file"), ("CORE_ADDR", "type"), ("CORE_ADDR", "val")],
   2655     predefault="default_print_auxv_entry",
   2656     invalid=False,
   2657 )
   2658 
   2659 Method(
   2660     comment="""
   2661 Find the address range of the current inferior's vsyscall/vDSO, and
   2662 write it to *RANGE.  If the vsyscall's length can't be determined, a
   2663 range with zero length is returned.  Returns true if the vsyscall is
   2664 found, false otherwise.
   2665 """,
   2666     type="int",
   2667     name="vsyscall_range",
   2668     params=[("struct mem_range *", "range")],
   2669     predefault="default_vsyscall_range",
   2670     invalid=False,
   2671 )
   2672 
   2673 Function(
   2674     comment="""
   2675 Allocate SIZE bytes of PROT protected page aligned memory in inferior.
   2676 PROT has GDB_MMAP_PROT_* bitmask format.
   2677 Throw an error if it is not possible.  Returned address is always valid.
   2678 """,
   2679     type="CORE_ADDR",
   2680     name="infcall_mmap",
   2681     params=[("CORE_ADDR", "size"), ("unsigned", "prot")],
   2682     predefault="default_infcall_mmap",
   2683     invalid=False,
   2684 )
   2685 
   2686 Function(
   2687     comment="""
   2688 Deallocate SIZE bytes of memory at ADDR in inferior from gdbarch_infcall_mmap.
   2689 Print a warning if it is not possible.
   2690 """,
   2691     type="void",
   2692     name="infcall_munmap",
   2693     params=[("CORE_ADDR", "addr"), ("CORE_ADDR", "size")],
   2694     predefault="default_infcall_munmap",
   2695     invalid=False,
   2696 )
   2697 
   2698 Method(
   2699     comment="""
   2700 Return string (caller has to use xfree for it) with options for GCC
   2701 to produce code for this target, typically "-m64", "-m32" or "-m31".
   2702 These options are put before CU's DW_AT_producer compilation options so that
   2703 they can override it.
   2704 """,
   2705     type="std::string",
   2706     name="gcc_target_options",
   2707     params=[],
   2708     predefault="default_gcc_target_options",
   2709     invalid=False,
   2710 )
   2711 
   2712 Method(
   2713     comment="""
   2714 Return a regular expression that matches names used by this
   2715 architecture in GNU configury triplets.  The result is statically
   2716 allocated and must not be freed.  The default implementation simply
   2717 returns the BFD architecture name, which is correct in nearly every
   2718 case.
   2719 """,
   2720     type="const char *",
   2721     name="gnu_triplet_regexp",
   2722     params=[],
   2723     predefault="default_gnu_triplet_regexp",
   2724     invalid=False,
   2725 )
   2726 
   2727 Method(
   2728     comment="""
   2729 Return the size in 8-bit bytes of an addressable memory unit on this
   2730 architecture.  This corresponds to the number of 8-bit bytes associated to
   2731 each address in memory.
   2732 """,
   2733     type="int",
   2734     name="addressable_memory_unit_size",
   2735     params=[],
   2736     predefault="default_addressable_memory_unit_size",
   2737     invalid=False,
   2738 )
   2739 
   2740 Value(
   2741     comment="""
   2742 Functions for allowing a target to modify its disassembler options.
   2743 """,
   2744     type="const char *",
   2745     name="disassembler_options_implicit",
   2746     invalid=False,
   2747     printer="pstring (gdbarch->disassembler_options_implicit)",
   2748 )
   2749 
   2750 Value(
   2751     type="std::string *",
   2752     name="disassembler_options",
   2753     invalid=False,
   2754     printer="pstring_ptr (gdbarch->disassembler_options)",
   2755 )
   2756 
   2757 Value(
   2758     type="const disasm_options_and_args_t *",
   2759     name="valid_disassembler_options",
   2760     invalid=False,
   2761     printer="host_address_to_string (gdbarch->valid_disassembler_options)",
   2762 )
   2763 
   2764 Method(
   2765     comment="""
   2766 Type alignment override method.  Return the architecture specific
   2767 alignment required for TYPE.  If there is no special handling
   2768 required for TYPE then return the value 0, GDB will then apply the
   2769 default rules as laid out in gdbtypes.c:type_align.
   2770 """,
   2771     type="ULONGEST",
   2772     name="type_align",
   2773     params=[("struct type *", "type")],
   2774     predefault="default_type_align",
   2775     invalid=False,
   2776 )
   2777 
   2778 Function(
   2779     comment="""
   2780 Return a string containing any flags for the given PC in the given FRAME.
   2781 """,
   2782     type="std::string",
   2783     name="get_pc_address_flags",
   2784     params=[("const frame_info_ptr &", "frame"), ("CORE_ADDR", "pc")],
   2785     predefault="default_get_pc_address_flags",
   2786     invalid=False,
   2787 )
   2788 
   2789 Method(
   2790     comment="""
   2791 Read core file mappings
   2792 """,
   2793     type="void",
   2794     name="read_core_file_mappings",
   2795     params=[
   2796         ("struct bfd *", "cbfd"),
   2797         ("read_core_file_mappings_pre_loop_ftype", "pre_loop_cb"),
   2798         ("read_core_file_mappings_loop_ftype", "loop_cb"),
   2799     ],
   2800     predefault="default_read_core_file_mappings",
   2801     invalid=False,
   2802 )
   2803 
   2804 Method(
   2805     comment="""
   2806 Return true if the target description for all threads should be read from the
   2807 target description core file note(s).  Return false if the target description
   2808 for all threads should be inferred from the core file contents/sections.
   2809 
   2810 The corefile's bfd is passed through COREFILE_BFD.
   2811 """,
   2812     type="bool",
   2813     name="use_target_description_from_corefile_notes",
   2814     params=[("struct bfd *", "corefile_bfd")],
   2815     predefault="default_use_target_description_from_corefile_notes",
   2816     invalid=False,
   2817 )
   2818 
   2819 Method(
   2820     comment="""
   2821 Examine the core file bfd object CBFD and try to extract the name of
   2822 the current executable and the argument list, which are return in a
   2823 core_file_exec_context object.
   2824 
   2825 If for any reason the details can't be extracted from CBFD then an
   2826 empty context is returned.
   2827 
   2828 It is required that the current inferior be the one associated with
   2829 CBFD, strings are read from the current inferior using target methods
   2830 which all assume current_inferior() is the one to read from.
   2831 """,
   2832     type="core_file_exec_context",
   2833     name="core_parse_exec_context",
   2834     params=[("bfd *", "cbfd")],
   2835     predefault="default_core_parse_exec_context",
   2836     invalid=False,
   2837 )
   2838