From: Luis Machado luis.machado@arm.com
Support the data_capability and code_capability types, which the capability counterparts of the data_ptr and code_ptr types.
Adjust the Morello C registers to be of data_capability and code_capability types.
gdb/ChangeLog:
YYYY-MM-DD Luis Machado luis.machado@arm.com
* aarch64-tdep.c (aarch64_address_class_type_flags) (aarch64_address_class_type_flags_to_name) (aarch64_address_class_name_to_type_flags): Use TYPE_INSTANCE_FLAG_CAPABILITY instead of TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1. (aarch64_gdbarch_init): Set capability size to 128. * features/aarch64-capability.c: Regenerate. * features/aarch64-capability.xml: Update C register types. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (code_capability_bit, data_capability) (dwarf2_capability_size): Remove. * gdbtypes.c (gdbtypes_post_init): Initialize data_capability and code_capability types. * gdbtypes.h (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL): Include TYPE_INSTANCE_FLAG_CAPABILITY in the list of address classes. (struct builtin_type) <builtin_data_addr_capability>: Rename to builtin_data_capability. (struct builtin_type) <builtin_code_addr_capability>: Rename to builtin_code_capability. * target-descriptions.c (make_gdb_type): Update type names.
gdbsupport/ChangeLog:
YYYY-MM-DD Luis Machado luis.machado@arm.com
* tdesc.cc (tdesc_predefined_types): Update type names for capabilities. --- gdb/aarch64-tdep.c | 2 + gdb/features/aarch64-capability.c | 78 ++++++++++++++--------------- gdb/features/aarch64-capability.xml | 78 ++++++++++++++--------------- gdb/gdbarch.c | 71 -------------------------- gdb/gdbarch.h | 19 +------ gdb/gdbarch.sh | 9 ---- gdb/gdbtypes.c | 23 ++++++--- gdb/gdbtypes.h | 4 +- gdb/target-descriptions.c | 6 +-- gdbsupport/tdesc.cc | 4 +- 10 files changed, 104 insertions(+), 190 deletions(-)
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 6fab1cc2fb..e30a61e6a6 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -4263,6 +4263,8 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_bit (gdbarch, 64); set_gdbarch_long_long_bit (gdbarch, 64); set_gdbarch_ptr_bit (gdbarch, 64); + /* Regardless of the ABI, capabilities are always 128-bit. */ + set_gdbarch_capability_bit (gdbarch, 128); set_gdbarch_char_signed (gdbarch, 0); set_gdbarch_wchar_signed (gdbarch, 0); set_gdbarch_float_format (gdbarch, floatformats_ieee_single); diff --git a/gdb/features/aarch64-capability.c b/gdb/features/aarch64-capability.c index b6180e64b6..a4098af710 100644 --- a/gdb/features/aarch64-capability.c +++ b/gdb/features/aarch64-capability.c @@ -10,45 +10,45 @@ create_feature_aarch64_capability (struct target_desc *result, long regnum)
feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.capability");
- tdesc_create_reg (feature, "c0", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c1", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c2", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c3", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c4", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c5", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c6", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c7", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c8", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c9", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c10", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c11", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c12", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c13", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c14", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c15", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c16", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c17", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c18", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c19", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c20", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c21", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c22", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c23", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c24", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c25", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c26", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c27", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c28", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c29", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "c30", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "csp", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "pcc", regnum++, 1, "general", 128, "uintcap"); - tdesc_create_reg (feature, "ddc", regnum++, 1, "system", 128, "uintcap"); - tdesc_create_reg (feature, "ctpidr", regnum++, 1, "system", 128, "uintcap"); - tdesc_create_reg (feature, "rcsp", regnum++, 1, "system", 128, "uintcap"); - tdesc_create_reg (feature, "rddc", regnum++, 1, "system", 128, "uintcap"); - tdesc_create_reg (feature, "rctpidr", regnum++, 1, "system", 128, "uintcap"); - tdesc_create_reg (feature, "cid", regnum++, 1, "system", 128, "uintcap"); + tdesc_create_reg (feature, "c0", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c1", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c2", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c3", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c4", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c5", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c6", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c7", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c8", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c9", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c10", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c11", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c12", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c13", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c14", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c15", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c16", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c17", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c18", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c19", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c20", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c21", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c22", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c23", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c24", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c25", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c26", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c27", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c28", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c29", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "c30", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "csp", regnum++, 1, "general", 128, "data_capability"); + tdesc_create_reg (feature, "pcc", regnum++, 1, "general", 128, "code_capability"); + tdesc_create_reg (feature, "ddc", regnum++, 1, "system", 128, "data_capability"); + tdesc_create_reg (feature, "ctpidr", regnum++, 1, "system", 128, "data_capability"); + tdesc_create_reg (feature, "rcsp", regnum++, 1, "system", 128, "data_capability"); + tdesc_create_reg (feature, "rddc", regnum++, 1, "system", 128, "data_capability"); + tdesc_create_reg (feature, "rctpidr", regnum++, 1, "system", 128, "data_capability"); + tdesc_create_reg (feature, "cid", regnum++, 1, "system", 128, "data_capability"); tdesc_create_reg (feature, "tag_map", regnum++, 1, "system", 64, "uint64"); tdesc_create_reg (feature, "cctlr", regnum++, 1, "system", 64, "uint64"); return regnum; diff --git a/gdb/features/aarch64-capability.xml b/gdb/features/aarch64-capability.xml index ebe8aea733..e8ae9b2db9 100644 --- a/gdb/features/aarch64-capability.xml +++ b/gdb/features/aarch64-capability.xml @@ -7,45 +7,45 @@
<!DOCTYPE feature SYSTEM "gdb-target.dtd"> <feature name="org.gnu.gdb.aarch64.capability"> - <reg name="c0" bitsize="128" type="uintcap" group="general"/> - <reg name="c1" bitsize="128" type="uintcap" group="general"/> - <reg name="c2" bitsize="128" type="uintcap" group="general"/> - <reg name="c3" bitsize="128" type="uintcap" group="general"/> - <reg name="c4" bitsize="128" type="uintcap" group="general"/> - <reg name="c5" bitsize="128" type="uintcap" group="general"/> - <reg name="c6" bitsize="128" type="uintcap" group="general"/> - <reg name="c7" bitsize="128" type="uintcap" group="general"/> - <reg name="c8" bitsize="128" type="uintcap" group="general"/> - <reg name="c9" bitsize="128" type="uintcap" group="general"/> - <reg name="c10" bitsize="128" type="uintcap" group="general"/> - <reg name="c11" bitsize="128" type="uintcap" group="general"/> - <reg name="c12" bitsize="128" type="uintcap" group="general"/> - <reg name="c13" bitsize="128" type="uintcap" group="general"/> - <reg name="c14" bitsize="128" type="uintcap" group="general"/> - <reg name="c15" bitsize="128" type="uintcap" group="general"/> - <reg name="c16" bitsize="128" type="uintcap" group="general"/> - <reg name="c17" bitsize="128" type="uintcap" group="general"/> - <reg name="c18" bitsize="128" type="uintcap" group="general"/> - <reg name="c19" bitsize="128" type="uintcap" group="general"/> - <reg name="c20" bitsize="128" type="uintcap" group="general"/> - <reg name="c21" bitsize="128" type="uintcap" group="general"/> - <reg name="c22" bitsize="128" type="uintcap" group="general"/> - <reg name="c23" bitsize="128" type="uintcap" group="general"/> - <reg name="c24" bitsize="128" type="uintcap" group="general"/> - <reg name="c25" bitsize="128" type="uintcap" group="general"/> - <reg name="c26" bitsize="128" type="uintcap" group="general"/> - <reg name="c27" bitsize="128" type="uintcap" group="general"/> - <reg name="c28" bitsize="128" type="uintcap" group="general"/> - <reg name="c29" bitsize="128" type="uintcap" group="general"/> - <reg name="c30" bitsize="128" type="uintcap" group="general"/> - <reg name="csp" bitsize="128" type="uintcap" group="general"/> - <reg name="pcc" bitsize="128" type="uintcap" group="general"/> - <reg name="ddc" bitsize="128" type="uintcap" group="system"/> - <reg name="ctpidr" bitsize="128" type="uintcap" group="system"/> - <reg name="rcsp" bitsize="128" type="uintcap" group="general"/> - <reg name="rddc" bitsize="128" type="uintcap" group="general"/> - <reg name="rctpidr" bitsize="128" type="uintcap" group="system"/> - <reg name="cid" bitsize="128" type="uintcap" group="system"/> + <reg name="c0" bitsize="128" type="data_capability" group="general"/> + <reg name="c1" bitsize="128" type="data_capability" group="general"/> + <reg name="c2" bitsize="128" type="data_capability" group="general"/> + <reg name="c3" bitsize="128" type="data_capability" group="general"/> + <reg name="c4" bitsize="128" type="data_capability" group="general"/> + <reg name="c5" bitsize="128" type="data_capability" group="general"/> + <reg name="c6" bitsize="128" type="data_capability" group="general"/> + <reg name="c7" bitsize="128" type="data_capability" group="general"/> + <reg name="c8" bitsize="128" type="data_capability" group="general"/> + <reg name="c9" bitsize="128" type="data_capability" group="general"/> + <reg name="c10" bitsize="128" type="data_capability" group="general"/> + <reg name="c11" bitsize="128" type="data_capability" group="general"/> + <reg name="c12" bitsize="128" type="data_capability" group="general"/> + <reg name="c13" bitsize="128" type="data_capability" group="general"/> + <reg name="c14" bitsize="128" type="data_capability" group="general"/> + <reg name="c15" bitsize="128" type="data_capability" group="general"/> + <reg name="c16" bitsize="128" type="data_capability" group="general"/> + <reg name="c17" bitsize="128" type="data_capability" group="general"/> + <reg name="c18" bitsize="128" type="data_capability" group="general"/> + <reg name="c19" bitsize="128" type="data_capability" group="general"/> + <reg name="c20" bitsize="128" type="data_capability" group="general"/> + <reg name="c21" bitsize="128" type="data_capability" group="general"/> + <reg name="c22" bitsize="128" type="data_capability" group="general"/> + <reg name="c23" bitsize="128" type="data_capability" group="general"/> + <reg name="c24" bitsize="128" type="data_capability" group="general"/> + <reg name="c25" bitsize="128" type="data_capability" group="general"/> + <reg name="c26" bitsize="128" type="data_capability" group="general"/> + <reg name="c27" bitsize="128" type="data_capability" group="general"/> + <reg name="c28" bitsize="128" type="data_capability" group="general"/> + <reg name="c29" bitsize="128" type="data_capability" group="general"/> + <reg name="c30" bitsize="128" type="data_capability" group="general"/> + <reg name="csp" bitsize="128" type="data_capability" group="general"/> + <reg name="pcc" bitsize="128" type="code_capability" group="general"/> + <reg name="ddc" bitsize="128" type="data_capability" group="system"/> + <reg name="ctpidr" bitsize="128" type="data_capability" group="system"/> + <reg name="rcsp" bitsize="128" type="data_capability" group="general"/> + <reg name="rddc" bitsize="128" type="data_capability" group="general"/> + <reg name="rctpidr" bitsize="128" type="data_capability" group="system"/> + <reg name="cid" bitsize="128" type="data_capability" group="system"/> <reg name="tag_map" bitsize="64" type="uint64" group="system"/> <reg name="cctlr" bitsize="64" type="uint64" group="system"/> </feature> diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 875b31cb3b..00f6272243 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -182,10 +182,7 @@ struct gdbarch int ptr_bit; int addr_bit; int dwarf2_addr_size; - int code_capability_bit; - int data_capability_bit; int capability_bit; - int dwarf2_capability_size; int char_signed; gdbarch_read_pc_ftype *read_pc; gdbarch_write_pc_ftype *write_pc; @@ -400,7 +397,6 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->wchar_signed = -1; gdbarch->floatformat_for_type = default_floatformat_for_type; gdbarch->ptr_bit = gdbarch->int_bit; - gdbarch->code_capability_bit = gdbarch->int_bit; gdbarch->char_signed = -1; gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer; gdbarch->num_regs = -1; @@ -559,13 +555,8 @@ verify_gdbarch (struct gdbarch *gdbarch) gdbarch->addr_bit = gdbarch_ptr_bit (gdbarch); if (gdbarch->dwarf2_addr_size == 0) gdbarch->dwarf2_addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT; - /* Skip verify of code_capability_bit, invalid_p == 0 */ - if (gdbarch->data_capability_bit == 0) - gdbarch->data_capability_bit = gdbarch_ptr_bit (gdbarch); if (gdbarch->capability_bit == 0) gdbarch->capability_bit = gdbarch_ptr_bit (gdbarch); - if (gdbarch->dwarf2_capability_size == 0) - gdbarch->dwarf2_capability_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT; if (gdbarch->char_signed == -1) gdbarch->char_signed = 1; /* Skip verify of read_pc, has predicate. */ @@ -870,9 +861,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: char_signed = %s\n", plongest (gdbarch->char_signed)); - fprintf_unfiltered (file, - "gdbarch_dump: code_capability_bit = %s\n", - plongest (gdbarch->code_capability_bit)); fprintf_unfiltered (file, "gdbarch_dump: code_of_frame_writable = <%s>\n", host_address_to_string (gdbarch->code_of_frame_writable)); @@ -927,9 +915,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: core_xfer_siginfo = <%s>\n", host_address_to_string (gdbarch->core_xfer_siginfo)); - fprintf_unfiltered (file, - "gdbarch_dump: data_capability_bit = %s\n", - plongest (gdbarch->data_capability_bit)); fprintf_unfiltered (file, "gdbarch_dump: decr_pc_after_break = %s\n", core_addr_to_string_nz (gdbarch->decr_pc_after_break)); @@ -999,9 +984,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: dwarf2_addr_size = %s\n", plongest (gdbarch->dwarf2_addr_size)); - fprintf_unfiltered (file, - "gdbarch_dump: dwarf2_capability_size = %s\n", - plongest (gdbarch->dwarf2_capability_size)); fprintf_unfiltered (file, "gdbarch_dump: dwarf2_reg_to_regnum = <%s>\n", host_address_to_string (gdbarch->dwarf2_reg_to_regnum)); @@ -1938,41 +1920,6 @@ set_gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch, gdbarch->dwarf2_addr_size = dwarf2_addr_size; }
-int -gdbarch_code_capability_bit (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - /* Skip verify of code_capability_bit, invalid_p == 0 */ - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_code_capability_bit called\n"); - return gdbarch->code_capability_bit; -} - -void -set_gdbarch_code_capability_bit (struct gdbarch *gdbarch, - int code_capability_bit) -{ - gdbarch->code_capability_bit = code_capability_bit; -} - -int -gdbarch_data_capability_bit (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - /* Check variable changed from pre-default. */ - gdb_assert (gdbarch->data_capability_bit != 0); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_data_capability_bit called\n"); - return gdbarch->data_capability_bit; -} - -void -set_gdbarch_data_capability_bit (struct gdbarch *gdbarch, - int data_capability_bit) -{ - gdbarch->data_capability_bit = data_capability_bit; -} - int gdbarch_capability_bit (struct gdbarch *gdbarch) { @@ -1991,24 +1938,6 @@ set_gdbarch_capability_bit (struct gdbarch *gdbarch, gdbarch->capability_bit = capability_bit; }
-int -gdbarch_dwarf2_capability_size (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - /* Check variable changed from pre-default. */ - gdb_assert (gdbarch->dwarf2_capability_size != 0); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf2_capability_size called\n"); - return gdbarch->dwarf2_capability_size; -} - -void -set_gdbarch_dwarf2_capability_size (struct gdbarch *gdbarch, - int dwarf2_capability_size) -{ - gdbarch->dwarf2_capability_size = dwarf2_capability_size; -} - int gdbarch_char_signed (struct gdbarch *gdbarch) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index bcce5060ad..b36dbd0ab2 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -252,28 +252,11 @@ extern void set_gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch, int dwarf2_ad /* For capability-based targets, the capability representation will likely differ from regular pointers. We can have a code capability and a data capability. - code_capability is the size of a capability on the target */ - -extern int gdbarch_code_capability_bit (struct gdbarch *gdbarch); -extern void set_gdbarch_code_capability_bit (struct gdbarch *gdbarch, int code_capability_bit); - -/* data_capability is the size of a target capability as represented in gdb */ - -extern int gdbarch_data_capability_bit (struct gdbarch *gdbarch); -extern void set_gdbarch_data_capability_bit (struct gdbarch *gdbarch, int data_capability_bit); - -/* capability_bit is the size of a target capability as represented in gdb */ + capability_bit is the size of a target capability as represented in gdb */
extern int gdbarch_capability_bit (struct gdbarch *gdbarch); extern void set_gdbarch_capability_bit (struct gdbarch *gdbarch, int capability_bit);
-/* Note that dwarf2_capability_size only needs to be redefined by a target if the - GCC back-end defines a DWARF2_CAPABILITY_SIZE other than the target pointer - size, and if Dwarf versions < 4 need to be supported. */ - -extern int gdbarch_dwarf2_capability_size (struct gdbarch *gdbarch); -extern void set_gdbarch_dwarf2_capability_size (struct gdbarch *gdbarch, int dwarf2_capability_size); - /* One if `char' acts like `signed char', zero if `unsigned char'. */
extern int gdbarch_char_signed (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index d0b58eca60..f7f727611f 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -385,18 +385,9 @@ v;int;dwarf2_addr_size;;;sizeof (void*);0;gdbarch_ptr_bit (gdbarch) / TARGET_CHA # For capability-based targets, the capability representation will likely # differ from regular pointers. We can have a code capability and a data # capability. -# code_capability is the size of a capability on the target -v;int;code_capability_bit;;;8 * sizeof (void*);gdbarch->int_bit;;0 -# data_capability is the size of a target capability as represented in gdb -v;int;data_capability_bit;;;8 * sizeof (void*);0;gdbarch_ptr_bit (gdbarch); # capability_bit is the size of a target capability as represented in gdb v;int;capability_bit;;;8 * sizeof (void*);0;gdbarch_ptr_bit (gdbarch);
-# Note that dwarf2_capability_size only needs to be redefined by a target if the -# GCC back-end defines a DWARF2_CAPABILITY_SIZE other than the target pointer -# size, and if Dwarf versions < 4 need to be supported. -v;int;dwarf2_capability_size;;;sizeof (void*);0;gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT; - # One if `char' acts like `signed char', zero if `unsigned char'. v;int;char_signed;;;1;-1;1 # diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 0c36285245..b8d90fb75c 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -5925,15 +5925,26 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
/* Capability types. */ builtin_type->builtin_intcap_t - = arch_capability_type (gdbarch, 128, 0, "__intcap_t"); + = arch_capability_type (gdbarch, gdbarch_capability_bit (gdbarch), 0, + "__intcap_t"); builtin_type->builtin_uintcap_t - = arch_capability_type (gdbarch, 128, 1, "__uintcap_t"); + = arch_capability_type (gdbarch, gdbarch_capability_bit (gdbarch), 1, + "__uintcap_t");
/* Capability pointer types. */ - builtin_type->builtin_data_addr_capability - = lookup_pointer_type (builtin_type->builtin_void); - builtin_type->builtin_code_addr_capability - = lookup_pointer_type (lookup_function_type (builtin_type->builtin_void)); + builtin_type->builtin_data_capability + = arch_pointer_type (gdbarch, gdbarch_capability_bit (gdbarch), "", + builtin_type->builtin_void); + builtin_type->builtin_data_capability->set_instance_flags + (builtin_type->builtin_data_capability->instance_flags () + | TYPE_INSTANCE_FLAG_CAPABILITY); + + builtin_type->builtin_code_capability + = arch_pointer_type (gdbarch, gdbarch_capability_bit (gdbarch), "", + lookup_function_type (builtin_type->builtin_void)); + builtin_type->builtin_code_capability->set_instance_flags + (builtin_type->builtin_code_capability->instance_flags () + | TYPE_INSTANCE_FLAG_CAPABILITY);
/* This type represents a GDB internal function. */ builtin_type->internal_fn diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index a876cebcd1..36e44d0b39 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -2072,10 +2072,10 @@ struct builtin_type struct type *builtin_uintcap_t;
/* Data address capability. */ - struct type *builtin_data_addr_capability; + struct type *builtin_data_capability;
/* Code address capability. */ - struct type *builtin_code_addr_capability; + struct type *builtin_code_capability;
/* Special-purpose types. */
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index f883ec2c96..d5dd4835de 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -110,13 +110,11 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype) case TDESC_TYPE_DATA_PTR: m_type = builtin_type (m_gdbarch)->builtin_data_ptr; return; - /* FIXME-Morello: Fix naming of the type according to what the final - code will look like. */ case TDESC_TYPE_CODE_CAPABILITY: - m_type = builtin_type (m_gdbarch)->builtin_code_addr_capability; + m_type = builtin_type (m_gdbarch)->builtin_code_capability; return; case TDESC_TYPE_DATA_CAPABILITY: - m_type = builtin_type (m_gdbarch)->builtin_data_addr_capability; + m_type = builtin_type (m_gdbarch)->builtin_data_capability; return; case TDESC_TYPE_INTCAP: m_type = builtin_type (m_gdbarch)->builtin_intcap_t; diff --git a/gdbsupport/tdesc.cc b/gdbsupport/tdesc.cc index 9f4eac655f..abe98a77ed 100644 --- a/gdbsupport/tdesc.cc +++ b/gdbsupport/tdesc.cc @@ -50,8 +50,8 @@ static tdesc_type_builtin tdesc_predefined_types[] = { "uint128", TDESC_TYPE_UINT128 }, { "code_ptr", TDESC_TYPE_CODE_PTR }, { "data_ptr", TDESC_TYPE_DATA_PTR }, - { "code_addr_capability", TDESC_TYPE_CODE_CAPABILITY }, - { "data_addr_capability", TDESC_TYPE_DATA_CAPABILITY }, + { "code_capability", TDESC_TYPE_CODE_CAPABILITY }, + { "data_capability", TDESC_TYPE_DATA_CAPABILITY }, { "intcap", TDESC_TYPE_INTCAP }, { "uintcap", TDESC_TYPE_UINTCAP }, { "ieee_half", TDESC_TYPE_IEEE_HALF },