]> 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)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:53:22 +0000 (15:53 -0700)
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/gdbarch-components.py
gdb/gdbarch-gen.h
gdb/gdbarch.c
gdb/gdbtypes.c

index 5feb04d0c093462917d727e27a732f7bb79b5806..516707129042624ffdeb3793e961ea7981ca6e07 100644 (file)
@@ -338,6 +338,55 @@ and if Dwarf versions < 4 need to be supported.
     invalid=True,
 )
 
+Value(
+    comment="""
+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
+""",
+    type="int",
+    name="code_capability_bit",
+    predefault="gdbarch->int_bit",
+    invalid=False,
+)
+
+Value(
+    comment="""
+data_capability is the size of a target capability as represented in gdb
+""",
+    type="int",
+    name="data_capability_bit",
+    predefault="0",
+    postdefault="gdbarch_ptr_bit (gdbarch)",
+    invalid=True
+)
+
+Value(
+    comment="""
+capability_bit is the size of a target capability as represented in gdb
+""",
+    type="int",
+    name="capability_bit",
+    predefault="0",
+    postdefault="gdbarch_ptr_bit (gdbarch)",
+    invalid=True
+)
+
+Value(
+    comment="""
+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.
+""",
+    type="int",
+    name="dwarf2_capability_size",
+    predefault="0",
+    postdefault="gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT",
+    invalid=True,
+)
+
 Value(
     comment="""
 One if `char' acts like `signed char', zero if `unsigned char'.
index 1282746d88b4f0f3b58b60f7ca9652ab8c74e2d5..4dd66f58631e3b85e4156ffd917de83e4103132c 100644 (file)
@@ -158,6 +158,32 @@ 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 732b4314d322a47b14c7c0a91c033fab1afa5042..7e44134b461642581e9e8f234367d6cc80301fd7 100644 (file)
@@ -70,6 +70,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;
@@ -294,6 +298,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;
@@ -422,6 +427,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.  */
@@ -706,6 +718,18 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   fprintf_filtered (file,
                       "gdbarch_dump: dwarf2_addr_size = %s\n",
                       plongest (gdbarch->dwarf2_addr_size));
+  fprintf_filtered (file,
+                      "gdbarch_dump: code_capability_bit = %s\n",
+                      plongest (gdbarch->code_capability_bit));
+  fprintf_filtered (file,
+                      "gdbarch_dump: data_capability_bit = %s\n",
+                      plongest (gdbarch->data_capability_bit));
+  fprintf_filtered (file,
+                      "gdbarch_dump: capability_bit = %s\n",
+                      plongest (gdbarch->capability_bit));
+  fprintf_filtered (file,
+                      "gdbarch_dump: dwarf2_capability_size = %s\n",
+                      plongest (gdbarch->dwarf2_capability_size));
   fprintf_filtered (file,
                       "gdbarch_dump: char_signed = %s\n",
                       plongest (gdbarch->char_signed));
@@ -1832,6 +1856,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 18b449960ea53d76bfffc6bcb0805b5aa174e5c9..83b1c28af4623e23ee4df1d15e14a268fd989070 100644 (file)
@@ -6210,7 +6210,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));