+2018-05-10 Omair Javaid <omair.javaid@linaro.org>
+
+ PR gdb/23127
+ * aarch64-linux-tdep.c (aarch64_linux_init_abi): Add call to
+ set_gdbarch_significant_addr_bit.
+ * aarch64-tdep.c (aarch64_gdbarch_init): Remove call to
+ set_gdbarch_significant_addr_bit.
+ * utils.c (address_significant): Update to sign extend addr.
+
2018-05-09 Max Filippov <jcmvbkbc@gmail.com>
* xtensa-linux-tdep.c (xtensa-tdep.h): New include.
/* Syscall record. */
tdep->aarch64_syscall_record = aarch64_linux_syscall_record;
+ /* The top byte of a user space address known as the "tag",
+ is ignored by the kernel and can be regarded as additional
+ data associated with the address. */
+ set_gdbarch_significant_addr_bit (gdbarch, 56);
+
/* Initialize the aarch64_linux_record_tdep. */
/* These values are the size of the type that will be used in a system
call. They are obtained from Linux Kernel source. */
set_tdesc_pseudo_register_reggroup_p (gdbarch,
aarch64_pseudo_register_reggroup_p);
- /* The top byte of an address is known as the "tag" and is
- ignored by the kernel, the hardware, etc. and can be regarded
- as additional data associated with the address. */
- set_gdbarch_significant_addr_bit (gdbarch, 56);
-
/* ABI */
set_gdbarch_short_bit (gdbarch, 16);
set_gdbarch_int_bit (gdbarch, 32);
CORE_ADDR
address_significant (gdbarch *gdbarch, CORE_ADDR addr)
{
- /* Truncate address to the significant bits of a target address,
- avoiding shifts larger or equal than the width of a CORE_ADDR.
- The local variable ADDR_BIT stops the compiler reporting a shift
- overflow when it won't occur. */
+ /* Clear insignificant bits of a target address and sign extend resulting
+ address, avoiding shifts larger or equal than the width of a CORE_ADDR.
+ The local variable ADDR_BIT stops the compiler reporting a shift overflow
+ when it won't occur. */
int addr_bit = gdbarch_significant_addr_bit (gdbarch);
if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
- addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
+ {
+ CORE_ADDR sign = (CORE_ADDR) 1 << (addr_bit - 1);
+ addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
+ addr = (addr ^ sign) - sign;
+ }
return addr;
}