]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[General] gdbarch update to include code_capability_bit, data_capability_bit etc
authorLuis Machado <luis.machado@arm.com>
Fri, 27 Mar 2020 14:33:55 +0000 (11:33 -0300)
committerLuis Machado <luis.machado@linaro.org>
Tue, 20 Oct 2020 18:04:51 +0000 (15:04 -0300)
gdb/ChangeLog:

2020-10-20  Luis Machado  <luis.machado@arm.com>

* gdb/gdbarch.c: Regenerate.
* gdb/gdbarch.h: Regenerate.
* gdb/gdbarch.sh (code_capability_bit)
(data_capability_bit, capability_bit, dwarf2_capability_size): New
methods.
* gdb/gdbtypes.c (gdbtypes_post_init): Initialize data address
capability to a pointer to intcap_t.

gdb/ChangeLog
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/gdbtypes.c

index aa200a33613ac29bd9cc27e987172d43a659b4da..613d925e88f4de144ed34cd1ff996d21db1cb383 100644 (file)
@@ -1,3 +1,13 @@
+2020-10-20  Luis Machado  <luis.machado@arm.com>
+
+       * gdb/gdbarch.c: Regenerate.
+       * gdb/gdbarch.h: Regenerate.
+       * gdb/gdbarch.sh (code_capability_bit)
+       (data_capability_bit, capability_bit, dwarf2_capability_size): New
+       methods.
+       * gdb/gdbtypes.c (gdbtypes_post_init): Initialize data address
+       capability to a pointer to intcap_t.
+
 2020-10-20  Luis Machado  <luis.machado@arm.com>
 
        * gdb/c-exp.y (CAPABILITY, INTCAP_KEYWORD, UINTCAP_KEYWORD): New
index 5e44047c2a969231c344ca1f45ed0705ac60ea95..8bab2d9de9ef5ddbb7fd12886de2399012c1b29d 100644 (file)
@@ -182,6 +182,10 @@ 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;
@@ -394,6 +398,7 @@ 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;
@@ -550,6 +555,13 @@ 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.  */
@@ -846,9 +858,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                       "gdbarch_dump: cannot_store_register = <%s>\n",
                       host_address_to_string (gdbarch->cannot_store_register));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: capability_bit = %s\n",
+                      plongest (gdbarch->capability_bit));
   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));
@@ -903,6 +921,9 @@ 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));
@@ -972,6 +993,9 @@ 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));
@@ -1902,6 +1926,77 @@ 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)
+{
+  gdb_assert (gdbarch != NULL);
+  /* Check variable changed from pre-default.  */
+  gdb_assert (gdbarch->capability_bit != 0);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_capability_bit called\n");
+  return gdbarch->capability_bit;
+}
+
+void
+set_gdbarch_capability_bit (struct gdbarch *gdbarch,
+                            int capability_bit)
+{
+  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)
 {
index 9f98ae835667fa9b2cff5cae743bf0f1d5c7f136..fd9692d16846eed535e8fd806381b23859a62363 100644 (file)
@@ -249,6 +249,31 @@ extern void set_gdbarch_addr_bit (struct gdbarch *gdbarch, int addr_bit);
 extern int gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch);
 extern void set_gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch, int dwarf2_addr_size);
 
+/* 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 */
+
+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);
index f9aed71fa7c3b5b0c8dda54740d7b4b8eb227ef8..08ad20f26494ffc2b96ee0e001718f236b221af3 100755 (executable)
@@ -381,7 +381,22 @@ v;int;addr_bit;;;8 * sizeof (void*);0;gdbarch_ptr_bit (gdbarch);
 # GCC back-end defines a DWARF2_ADDR_SIZE other than the target pointer size,
 # and if Dwarf versions < 4 need to be supported.
 v;int;dwarf2_addr_size;;;sizeof (void*);0;gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
-#
+
+# 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
 #
index aabfac65eaa1bdef6a1fcf66e11f5ea8d289a7e0..a52a57c8394056a60e161b877b13f736f0819a26 100644 (file)
@@ -5896,7 +5896,7 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
 
   /* Capability pointer types.  */
   builtin_type->builtin_data_addr_capability
-    = lookup_pointer_type (builtin_type->builtin_intcap_t);
+    = lookup_pointer_type (builtin_type->builtin_void);
   builtin_type->builtin_code_addr_capability
     = lookup_pointer_type (lookup_function_type (builtin_type->builtin_void));