]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Morello: Add gdbarch_print_cap* methods.
authorJohn Baldwin <jhb@FreeBSD.org>
Fri, 29 Jul 2022 01:04:32 +0000 (18:04 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 23:47:42 +0000 (16:47 -0700)
gdb/aarch64-tdep.c

index b47817ca7c208ac36ccf52ffa6b69fc225d92797..faa61ff8fc58a89ce658fe131032d2b00f61fefc 100644 (file)
@@ -5143,6 +5143,31 @@ aarch64_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR val)
   return (val & ~1);
 }
 
+/* Print a capability.  */
+
+static void
+morello_print_cap (struct gdbarch *gdbarch, const gdb_byte *contents, bool tag,
+                  bool compact, struct ui_file *stream)
+{
+  uint128_t dummy_cap;
+  memcpy (&dummy_cap, contents, sizeof(dummy_cap));
+  capability cap (dummy_cap, tag);
+  fprintf_filtered (stream, "%s ",
+                   cap.to_str (compact).c_str ());
+}
+
+/* Print attributes of a capability.  */
+
+static void
+morello_print_cap_attributes (struct gdbarch *gdbarch, const gdb_byte *contents,
+                             bool tag, struct ui_file *stream)
+{
+  uint128_t dummy_cap;
+  memcpy (&dummy_cap, contents, sizeof(dummy_cap));
+  capability cap (dummy_cap, tag);
+  fprintf_filtered (stream, "%s", cap.metadata_str ().c_str ());
+}
+
 /* Given ABFD, try to determine if we are dealing with a symbol file
    that uses capabilities.
 
@@ -5663,6 +5688,10 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_address_to_pointer (gdbarch, aarch64_address_to_pointer);
       set_gdbarch_integer_to_address (gdbarch, aarch64_integer_to_address);
 
+      /* Printing capabilities.  */
+      set_gdbarch_print_cap (gdbarch, morello_print_cap);
+      set_gdbarch_print_cap_attributes (gdbarch, morello_print_cap_attributes);
+
       /* For marking special symbols indicating a C64 region.  */
       set_gdbarch_elf_make_msymbol_special (gdbarch,
                                            aarch64_elf_make_msymbol_special);