]> 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)
committerLuis Machado <luis.machado@linaro.org>
Tue, 20 Oct 2020 18:06:03 +0000 (15:06 -0300)
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/ChangeLog
gdb/aarch64-tdep.c

index 5ba49ff62f6f7045e8661bec9f4af15b5e737c8d..7fbb4cf8e0a6f7e2b65c0433f87c9f94ee9bf208 100644 (file)
@@ -1,3 +1,8 @@
+2020-10-20  Luis Machado  <luis.machado@arm.com>
+
+       * aarch64-tdep.c (aarch64_addr_bits_remove): New function.
+       (aarch64_gdbarch_init): Register hook.
+
 2020-10-20  Luis Machado  <luis.machado@arm.com>
 
        * findvar.c (extract_typed_address): Handle capabilities.
index 47b435b888dcf9d89fffd32c806bff24bb26f154..220c519d4e8069e067c27cbfbb679900556c6aaf 100644 (file)
@@ -3539,6 +3539,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.
@@ -3815,6 +3824,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