forked from bminor/binutils-gdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgdbarch_components.py
2850 lines (2557 loc) · 78.4 KB
/
gdbarch_components.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Dynamic architecture support for GDB, the GNU debugger.
# Copyright (C) 1998-2024 Free Software Foundation, Inc.
# This file is part of GDB.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# How to add to gdbarch:
#
# There are four kinds of fields in gdbarch:
#
# * Info - you should never need this; it is only for things that are
# copied directly from the gdbarch_info.
#
# * Value - a variable.
#
# * Function - a function pointer.
#
# * Method - a function pointer, but the function takes a gdbarch as
# its first parameter.
#
# You construct a new one with a call to one of those functions. So,
# for instance, you can use the function named "Value" to make a new
# Value.
#
# All parameters are keyword-only. This is done to help catch typos.
#
# Some parameters are shared among all types (including Info):
#
# * "name" - required, the name of the field.
#
# * "type" - required, the type of the field. For functions and
# methods, this is the return type.
#
# * "printer" - an expression to turn this field into a 'const char
# *'. This is used for dumping. The string must live long enough to
# be passed to printf.
#
# Value, Function, and Method share some more parameters. Some of
# these work in conjunction in a somewhat complicated way, so they are
# described in a separate sub-section below.
#
# * "comment" - a comment that's written to the .h file. Please
# always use this. (It isn't currently a required option for
# historical reasons.)
#
# * "predicate" - a boolean, if True then a _p predicate function will
# be generated. The predicate will use the generic validation
# function for the field. See below.
#
# * "predefault", "postdefault", and "invalid" - These are used for
# the initialization and verification steps:
#
# A gdbarch is zero-initialized. Then, if a field has a "predefault",
# the field is set to that value. This becomes the field's initial
# value.
#
# After initialization is complete (that is, after the tdep code has a
# chance to change the settings), the post-initialization step is
# done.
#
# If the field still has its initial value (see above), and the field
# has a "postdefault", then the field is set to this value.
#
# After the possible "postdefault" assignment, validation is
# performed for fields that don't have a "predicate".
#
# If the field has an "invalid" attribute with a string value, then
# this string is the expression that should evaluate to true when the
# field is invalid.
#
# Otherwise, if "invalid" is True (the default), then the generic
# validation function is used: the field is considered invalid it
# still contains its default value. This validation is what is used
# within the _p predicate function if the field has "predicate" set to
# True.
#
# Function and Method share:
#
# * "params" - required, a tuple of tuples. Each inner tuple is a
# pair of the form (TYPE, NAME), where TYPE is the type of this
# argument, and NAME is the name. Note that while the names could be
# auto-generated, this approach lets the "comment" field refer to
# arguments in a nicer way. It is also just nicer for users.
#
# * "param_checks" - optional, a list of strings. Each string is an
# expression that is placed within a gdb_assert before the call is
# made to the Function/Method implementation. Each expression is
# something that should be true, and it is expected that the
# expression will make use of the parameters named in 'params' (though
# this is not required).
#
# * "result_checks" - optional, a list of strings. Each string is an
# expression that is placed within a gdb_assert after the call to the
# Function/Method implementation. Within each expression the variable
# 'result' can be used to reference the result of the function/method
# implementation. The 'result_checks' can only be used if the 'type'
# of this Function/Method is not 'void'.
#
# * "implement" - optional, a boolean. If True (the default), a
# wrapper function for this function will be emitted.
from gdbarch_types import Function, Info, Method, Value
Info(
type="const struct bfd_arch_info *",
name="bfd_arch_info",
printer="gdbarch_bfd_arch_info (gdbarch)->printable_name",
)
Info(
type="enum bfd_endian",
name="byte_order",
)
Info(
type="enum bfd_endian",
name="byte_order_for_code",
)
Info(
type="enum gdb_osabi",
name="osabi",
)
Info(
type="const struct target_desc *",
name="target_desc",
printer="host_address_to_string (gdbarch->target_desc)",
)
Value(
comment="""
Number of bits in a short or unsigned short for the target machine.
""",
type="int",
name="short_bit",
predefault="2*TARGET_CHAR_BIT",
invalid=False,
)
int_bit = Value(
comment="""
Number of bits in an int or unsigned int for the target machine.
""",
type="int",
name="int_bit",
predefault="4*TARGET_CHAR_BIT",
invalid=False,
)
long_bit_predefault = "4*TARGET_CHAR_BIT"
long_bit = Value(
comment="""
Number of bits in a long or unsigned long for the target machine.
""",
type="int",
name="long_bit",
predefault=long_bit_predefault,
invalid=False,
)
Value(
comment="""
Number of bits in a long long or unsigned long long for the target
machine.
""",
type="int",
name="long_long_bit",
predefault="2*" + long_bit_predefault,
invalid=False,
)
Value(
comment="""
The ABI default bit-size and format for "bfloat16", "half", "float", "double", and
"long double". These bit/format pairs should eventually be combined
into a single object. For the moment, just initialize them as a pair.
Each format describes both the big and little endian layouts (if
useful).
""",
type="int",
name="bfloat16_bit",
predefault="2*TARGET_CHAR_BIT",
invalid=False,
)
Value(
type="const struct floatformat **",
name="bfloat16_format",
predefault="floatformats_bfloat16",
printer="pformat (gdbarch, gdbarch->bfloat16_format)",
invalid=False,
)
Value(
type="int",
name="half_bit",
predefault="2*TARGET_CHAR_BIT",
invalid=False,
)
Value(
type="const struct floatformat **",
name="half_format",
predefault="floatformats_ieee_half",
printer="pformat (gdbarch, gdbarch->half_format)",
invalid=False,
)
Value(
type="int",
name="float_bit",
predefault="4*TARGET_CHAR_BIT",
invalid=False,
)
Value(
type="const struct floatformat **",
name="float_format",
predefault="floatformats_ieee_single",
printer="pformat (gdbarch, gdbarch->float_format)",
invalid=False,
)
Value(
type="int",
name="double_bit",
predefault="8*TARGET_CHAR_BIT",
invalid=False,
)
Value(
type="const struct floatformat **",
name="double_format",
predefault="floatformats_ieee_double",
printer="pformat (gdbarch, gdbarch->double_format)",
invalid=False,
)
Value(
type="int",
name="long_double_bit",
predefault="8*TARGET_CHAR_BIT",
invalid=False,
)
Value(
type="const struct floatformat **",
name="long_double_format",
predefault="floatformats_ieee_double",
printer="pformat (gdbarch, gdbarch->long_double_format)",
invalid=False,
)
Value(
comment="""
The ABI default bit-size for "wchar_t". wchar_t is a built-in type
starting with C++11.
""",
type="int",
name="wchar_bit",
predefault="4*TARGET_CHAR_BIT",
invalid=False,
)
Value(
comment="""
One if `wchar_t' is signed, zero if unsigned.
""",
type="int",
name="wchar_signed",
predefault="-1",
postdefault="1",
invalid=False,
)
Method(
comment="""
Returns the floating-point format to be used for values of length LENGTH.
NAME, if non-NULL, is the type name, which may be used to distinguish
different target formats of the same length.
""",
type="const struct floatformat **",
name="floatformat_for_type",
params=[("const char *", "name"), ("int", "length")],
predefault="default_floatformat_for_type",
invalid=False,
)
Value(
comment="""
For most targets, a pointer on the target and its representation as an
address in GDB have the same size and "look the same". For such a
target, you need only set gdbarch_ptr_bit and gdbarch_addr_bit
/ addr_bit will be set from it.
If gdbarch_ptr_bit and gdbarch_addr_bit are different, you'll probably
also need to set gdbarch_dwarf2_addr_size, gdbarch_pointer_to_address and
gdbarch_address_to_pointer as well.
ptr_bit is the size of a pointer on the target
""",
type="int",
name="ptr_bit",
predefault=int_bit.predefault,
invalid=False,
)
Value(
comment="""
addr_bit is the size of a target address as represented in gdb
""",
type="int",
name="addr_bit",
predefault="0",
postdefault="gdbarch_ptr_bit (gdbarch)",
invalid=False,
)
Value(
comment="""
dwarf2_addr_size is the target address size as used in the Dwarf debug
info. For .debug_frame FDEs, this is supposed to be the target address
size from the associated CU header, and which is equivalent to the
DWARF2_ADDR_SIZE as defined by the target specific GCC back-end.
Unfortunately there is no good way to determine this value. Therefore
dwarf2_addr_size simply defaults to the target pointer size.
dwarf2_addr_size is not used for .eh_frame FDEs, which are generally
defined using the target's pointer size so far.
Note that dwarf2_addr_size only needs to be redefined by a target if the
GCC back-end defines a DWARF2_ADDR_SIZE other than the target pointer size,
and if Dwarf versions < 4 need to be supported.
""",
type="int",
name="dwarf2_addr_size",
postdefault="gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT",
invalid=False,
)
Value(
comment="""
One if `char' acts like `signed char', zero if `unsigned char'.
""",
type="int",
name="char_signed",
predefault="-1",
postdefault="1",
invalid=False,
)
Function(
type="CORE_ADDR",
name="read_pc",
params=[("readable_regcache *", "regcache")],
predicate=True,
)
Function(
type="void",
name="write_pc",
params=[("struct regcache *", "regcache"), ("CORE_ADDR", "val")],
predicate=True,
)
Method(
comment="""
Function for getting target's idea of a frame pointer. FIXME: GDB's
whole scheme for dealing with "frames" and "frame pointers" needs a
serious shakedown.
""",
type="void",
name="virtual_frame_pointer",
params=[
("CORE_ADDR", "pc"),
("int *", "frame_regnum"),
("LONGEST *", "frame_offset"),
],
predefault="legacy_virtual_frame_pointer",
invalid=False,
)
Method(
type="enum register_status",
name="pseudo_register_read",
params=[
("readable_regcache *", "regcache"),
("int", "cookednum"),
("gdb_byte *", "buf"),
],
predicate=True,
)
Method(
comment="""
Read a register into a new struct value. If the register is wholly
or partly unavailable, this should call mark_value_bytes_unavailable
as appropriate. If this is defined, then pseudo_register_read will
never be called.
""",
type="struct value *",
name="pseudo_register_read_value",
params=[("const frame_info_ptr &", "next_frame"), ("int", "cookednum")],
predicate=True,
)
Method(
comment="""
Write bytes in BUF to pseudo register with number PSEUDO_REG_NUM.
Raw registers backing the pseudo register should be written to using
NEXT_FRAME.
""",
type="void",
name="pseudo_register_write",
params=[
("const frame_info_ptr &", "next_frame"),
("int", "pseudo_reg_num"),
("gdb::array_view<const gdb_byte>", "buf"),
],
predicate=True,
)
Method(
comment="""
Write bytes to a pseudo register.
This is marked as deprecated because it gets passed a regcache for
implementations to write raw registers in. This doesn't work for unwound
frames, where the raw registers backing the pseudo registers may have been
saved elsewhere.
Implementations should be migrated to implement pseudo_register_write instead.
""",
type="void",
name="deprecated_pseudo_register_write",
params=[
("struct regcache *", "regcache"),
("int", "cookednum"),
("const gdb_byte *", "buf"),
],
predicate=True,
)
Value(
type="int",
name="num_regs",
predefault="-1",
)
Value(
comment="""
This macro gives the number of pseudo-registers that live in the
register namespace but do not get fetched or stored on the target.
These pseudo-registers may be aliases for other registers,
combinations of other registers, or they may be computed by GDB.
""",
type="int",
name="num_pseudo_regs",
predefault="0",
invalid=False,
)
Method(
comment="""
Assemble agent expression bytecode to collect pseudo-register REG.
Return -1 if something goes wrong, 0 otherwise.
""",
type="int",
name="ax_pseudo_register_collect",
params=[("struct agent_expr *", "ax"), ("int", "reg")],
predicate=True,
)
Method(
comment="""
Assemble agent expression bytecode to push the value of pseudo-register
REG on the interpreter stack.
Return -1 if something goes wrong, 0 otherwise.
""",
type="int",
name="ax_pseudo_register_push_stack",
params=[("struct agent_expr *", "ax"), ("int", "reg")],
predicate=True,
)
Method(
comment="""
Some architectures can display additional information for specific
signals.
UIOUT is the output stream where the handler will place information.
""",
type="void",
name="report_signal_info",
params=[("struct ui_out *", "uiout"), ("enum gdb_signal", "siggnal")],
predicate=True,
)
Value(
comment="""
GDB's standard (or well known) register numbers. These can map onto
a real register or a pseudo (computed) register or not be defined at
all (-1).
gdbarch_sp_regnum will hopefully be replaced by UNWIND_SP.
""",
type="int",
name="sp_regnum",
predefault="-1",
invalid=False,
)
Value(
type="int",
name="pc_regnum",
predefault="-1",
invalid=False,
)
Value(
type="int",
name="ps_regnum",
predefault="-1",
invalid=False,
)
Value(
type="int",
name="fp0_regnum",
predefault="-1",
invalid=False,
)
Method(
comment="""
Convert stab register number (from `r' declaration) to a gdb REGNUM.
""",
type="int",
name="stab_reg_to_regnum",
params=[("int", "stab_regnr")],
predefault="no_op_reg_to_regnum",
invalid=False,
)
Method(
comment="""
Provide a default mapping from a ecoff register number to a gdb REGNUM.
""",
type="int",
name="ecoff_reg_to_regnum",
params=[("int", "ecoff_regnr")],
predefault="no_op_reg_to_regnum",
invalid=False,
)
Method(
comment="""
Convert from an sdb register number to an internal gdb register number.
""",
type="int",
name="sdb_reg_to_regnum",
params=[("int", "sdb_regnr")],
predefault="no_op_reg_to_regnum",
invalid=False,
)
Method(
comment="""
Provide a default mapping from a DWARF2 register number to a gdb REGNUM.
Return -1 for bad REGNUM. Note: Several targets get this wrong.
""",
type="int",
name="dwarf2_reg_to_regnum",
params=[("int", "dwarf2_regnr")],
predefault="no_op_reg_to_regnum",
invalid=False,
)
Method(
comment="""
Return the name of register REGNR for the specified architecture.
REGNR can be any value greater than, or equal to zero, and less than
'gdbarch_num_cooked_regs (GDBARCH)'. If REGNR is not supported for
GDBARCH, then this function will return an empty string, this function
should never return nullptr.
""",
type="const char *",
name="register_name",
params=[("int", "regnr")],
param_checks=["regnr >= 0", "regnr < gdbarch_num_cooked_regs (gdbarch)"],
result_checks=["result != nullptr"],
)
Method(
comment="""
Return the type of a register specified by the architecture. Only
the register cache should call this function directly; others should
use "register_type".
""",
type="struct type *",
name="register_type",
params=[("int", "reg_nr")],
)
Method(
comment="""
Generate a dummy frame_id for THIS_FRAME assuming that the frame is
a dummy frame. A dummy frame is created before an inferior call,
the frame_id returned here must match the frame_id that was built
for the inferior call. Usually this means the returned frame_id's
stack address should match the address returned by
gdbarch_push_dummy_call, and the returned frame_id's code address
should match the address at which the breakpoint was set in the dummy
frame.
""",
type="struct frame_id",
name="dummy_id",
params=[("const frame_info_ptr &", "this_frame")],
predefault="default_dummy_id",
invalid=False,
)
Value(
comment="""
Implement DUMMY_ID and PUSH_DUMMY_CALL, then delete
deprecated_fp_regnum.
""",
type="int",
name="deprecated_fp_regnum",
predefault="-1",
invalid=False,
)
Method(
type="CORE_ADDR",
name="push_dummy_call",
params=[
("struct value *", "function"),
("struct regcache *", "regcache"),
("CORE_ADDR", "bp_addr"),
("int", "nargs"),
("struct value **", "args"),
("CORE_ADDR", "sp"),
("function_call_return_method", "return_method"),
("CORE_ADDR", "struct_addr"),
],
predicate=True,
)
Value(
type="enum call_dummy_location_type",
name="call_dummy_location",
predefault="AT_ENTRY_POINT",
invalid=False,
)
Method(
type="CORE_ADDR",
name="push_dummy_code",
params=[
("CORE_ADDR", "sp"),
("CORE_ADDR", "funaddr"),
("struct value **", "args"),
("int", "nargs"),
("struct type *", "value_type"),
("CORE_ADDR *", "real_pc"),
("CORE_ADDR *", "bp_addr"),
("struct regcache *", "regcache"),
],
predicate=True,
)
Method(
comment="""
Return true if the code of FRAME is writable.
""",
type="int",
name="code_of_frame_writable",
params=[("const frame_info_ptr &", "frame")],
predefault="default_code_of_frame_writable",
invalid=False,
)
Method(
type="void",
name="print_registers_info",
params=[
("struct ui_file *", "file"),
("const frame_info_ptr &", "frame"),
("int", "regnum"),
("int", "all"),
],
predefault="default_print_registers_info",
invalid=False,
)
Method(
type="void",
name="print_float_info",
params=[
("struct ui_file *", "file"),
("const frame_info_ptr &", "frame"),
("const char *", "args"),
],
predefault="default_print_float_info",
invalid=False,
)
Method(
type="void",
name="print_vector_info",
params=[
("struct ui_file *", "file"),
("const frame_info_ptr &", "frame"),
("const char *", "args"),
],
predicate=True,
)
Method(
comment="""
MAP a GDB RAW register number onto a simulator register number. See
also include/...-sim.h.
""",
type="int",
name="register_sim_regno",
params=[("int", "reg_nr")],
predefault="legacy_register_sim_regno",
invalid=False,
)
Method(
type="int",
name="cannot_fetch_register",
params=[("int", "regnum")],
predefault="cannot_register_not",
invalid=False,
)
Method(
type="int",
name="cannot_store_register",
params=[("int", "regnum")],
predefault="cannot_register_not",
invalid=False,
)
Function(
comment="""
Determine the address where a longjmp will land and save this address
in PC. Return nonzero on success.
FRAME corresponds to the longjmp frame.
""",
type="int",
name="get_longjmp_target",
params=[("const frame_info_ptr &", "frame"), ("CORE_ADDR *", "pc")],
predicate=True,
)
Value(
type="int",
name="believe_pcc_promotion",
invalid=False,
)
Method(
type="int",
name="convert_register_p",
params=[("int", "regnum"), ("struct type *", "type")],
predefault="generic_convert_register_p",
invalid=False,
)
Function(
type="int",
name="register_to_value",
params=[
("const frame_info_ptr &", "frame"),
("int", "regnum"),
("struct type *", "type"),
("gdb_byte *", "buf"),
("int *", "optimizedp"),
("int *", "unavailablep"),
],
invalid=False,
)
Function(
type="void",
name="value_to_register",
params=[
("const frame_info_ptr &", "frame"),
("int", "regnum"),
("struct type *", "type"),
("const gdb_byte *", "buf"),
],
invalid=False,
)
Method(
comment="""
Construct a value representing the contents of register REGNUM in
frame THIS_FRAME, interpreted as type TYPE. The routine needs to
allocate and return a struct value with all value attributes
(but not the value contents) filled in.
""",
type="struct value *",
name="value_from_register",
params=[
("struct type *", "type"),
("int", "regnum"),
("const frame_info_ptr &", "this_frame"),
],
predefault="default_value_from_register",
invalid=False,
)
Method(
comment="""
For a DW_OP_piece located in a register, but not occupying the
entire register, return the placement of the piece within that
register as defined by the ABI.
""",
type="ULONGEST",
name="dwarf2_reg_piece_offset",
params=[("int", "regnum"), ("ULONGEST", "size")],
predefault="default_dwarf2_reg_piece_offset",
invalid=False,
)
Method(
type="CORE_ADDR",
name="pointer_to_address",
params=[("struct type *", "type"), ("const gdb_byte *", "buf")],
predefault="unsigned_pointer_to_address",
invalid=False,
)
Method(
type="void",
name="address_to_pointer",
params=[("struct type *", "type"), ("gdb_byte *", "buf"), ("CORE_ADDR", "addr")],
predefault="unsigned_address_to_pointer",
invalid=False,
)
Method(
type="CORE_ADDR",
name="integer_to_address",
params=[("struct type *", "type"), ("const gdb_byte *", "buf")],
predicate=True,
)
Method(
comment="""
Return the return-value convention that will be used by FUNCTION
to return a value of type VALTYPE. FUNCTION may be NULL in which
case the return convention is computed based only on VALTYPE.
If READBUF is not NULL, extract the return value and save it in this buffer.
If WRITEBUF is not NULL, it contains a return value which will be
stored into the appropriate register. This can be used when we want
to force the value returned by a function (see the "return" command
for instance).
NOTE: it is better to implement return_value_as_value instead, as that
method can properly handle variably-sized types.
""",
type="enum return_value_convention",
name="return_value",
params=[
("struct value *", "function"),
("struct type *", "valtype"),
("struct regcache *", "regcache"),
("gdb_byte *", "readbuf"),
("const gdb_byte *", "writebuf"),
],
invalid=False,
# We don't want to accidentally introduce calls to this, as gdb
# should only ever call return_value_new (see below).
implement=False,
)
Method(
comment="""
Return the return-value convention that will be used by FUNCTION
to return a value of type VALTYPE. FUNCTION may be NULL in which
case the return convention is computed based only on VALTYPE.
If READ_VALUE is not NULL, extract the return value and save it in
this pointer.
If WRITEBUF is not NULL, it contains a return value which will be
stored into the appropriate register. This can be used when we want
to force the value returned by a function (see the "return" command
for instance).
""",
type="enum return_value_convention",
name="return_value_as_value",
params=[
("struct value *", "function"),
("struct type *", "valtype"),
("struct regcache *", "regcache"),
("struct value **", "read_value"),
("const gdb_byte *", "writebuf"),
],
predefault="default_gdbarch_return_value",
# If we're using the default, then the other method must be set;
# but if we aren't using the default here then the other method
# must not be set.
invalid="(gdbarch->return_value_as_value == default_gdbarch_return_value) == (gdbarch->return_value == nullptr)",
)
Function(
comment="""
Return the address at which the value being returned from
the current function will be stored. This routine is only
called if the current function uses the the "struct return
convention".
May return 0 when unable to determine that address.""",
type="CORE_ADDR",
name="get_return_buf_addr",
params=[("struct type *", "val_type"), ("const frame_info_ptr &", "cur_frame")],
predefault="default_get_return_buf_addr",
invalid=False,
)
# The DWARF info currently does not distinguish between IEEE 128-bit floating
# point values and the IBM 128-bit floating point format. GCC has an internal
# hack to identify the IEEE 128-bit floating point value. The long double is a
# defined base type in C. The GCC hack uses a typedef for long double to
# reference_Float128 base to identify the long double as and IEEE 128-bit
# value. The following method is used to "fix" the long double type to be a
# base type with the IEEE float format info from the _Float128 basetype and
# the long double name. With the fix, the proper name is printed for the
# GDB typedef command.
Function(
comment="""
Return true if the typedef record needs to be replaced.".
Return 0 by default""",
type="bool",
name="dwarf2_omit_typedef_p",
params=[
("struct type *", "target_type"),
("const char *", "producer"),
("const char *", "name"),
],
predefault="default_dwarf2_omit_typedef_p",
invalid=False,
)
Method(
comment="""
Update PC when trying to find a call site. This is useful on
architectures where the call site PC, as reported in the DWARF, can be
incorrect for some reason.
The passed-in PC will be an address in the inferior. GDB will have
already failed to find a call site at this PC. This function may
simply return its parameter if it thinks that should be the correct
address.""",
type="CORE_ADDR",
name="update_call_site_pc",
params=[("CORE_ADDR", "pc")],
predefault="default_update_call_site_pc",
invalid=False,
)
Method(
comment="""
Return true if the return value of function is stored in the first hidden
parameter. In theory, this feature should be language-dependent, specified
by language and its ABI, such as C++. Unfortunately, compiler may
implement it to a target-dependent feature. So that we need such hook here
to be aware of this in GDB.
""",
type="int",
name="return_in_first_hidden_param_p",
params=[("struct type *", "type")],
predefault="default_return_in_first_hidden_param_p",
invalid=False,
)