]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[Morello] Mask the LSB from cap mode addresses
authorLuis Machado <luis.machado@arm.com>
Tue, 15 Sep 2020 17:16:30 +0000 (14:16 -0300)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:53:22 +0000 (15:53 -0700)
This patch removes the LSB from capability mode addresses. This is a bit set
to indicate that a given function deals with capabilities.

gdb/ChangeLog:

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

* aarch64-tdep.c (aarch64_addr_bits_remove): New function.
(aarch64_gdbarch_init): Register hook.

gdb/aarch64-tdep.c

index 2e8feb033c247475e064c5acc768ea60d9d79a09..7c9d238fe2d7334d5521bc85ffb211041e0281a1 100644 (file)
@@ -3609,6 +3609,15 @@ aarch64_integer_to_address (struct gdbarch *gdbarch,
   return aarch64_pointer_to_address (gdbarch, type, buf);
 }
 
+/* Remove useless bits from addresses in a running program.  This is
+   important for Morello due to the C64 mode having the LSB set.  */
+
+static CORE_ADDR
+aarch64_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR val)
+{
+  return (val & ~1);
+}
+
 /* Initialize the current architecture based on INFO.  If possible,
    re-use an architecture from ARCHES, which is a list of
    architectures already created during this debugging session.
@@ -3927,6 +3936,9 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Set address class hooks for capabilities.  */
   if (feature_capability)
     {
+      /* Address manipulation.  */
+      set_gdbarch_addr_bits_remove (gdbarch, aarch64_addr_bits_remove);
+
       set_gdbarch_address_class_type_flags
        (gdbarch, aarch64_address_class_type_flags);
       set_gdbarch_address_class_name_to_type_flags