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