From: Luis Machado Date: Tue, 15 Sep 2020 17:16:30 +0000 (-0300) Subject: [Morello] Mask the LSB from cap mode addresses X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31eb749d1c11a39687103bd5bfc8581df10f9ca6;p=thirdparty%2Fbinutils-gdb.git [Morello] Mask the LSB from cap mode addresses 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 * aarch64-tdep.c (aarch64_addr_bits_remove): New function. (aarch64_gdbarch_init): Register hook. --- diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 2e8feb033c2..7c9d238fe2d 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -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