mips: set significant_addr_bit to number of bits in CORE_ADDR

Message ID 20180315143855.17941-1-vlad.ivanov@lab-systems.ru
State New
Headers show
Series
  • mips: set significant_addr_bit to number of bits in CORE_ADDR
Related show

Commit Message

Vlad Ivanov March 15, 2018, 2:38 p.m.
MIPS targets use signed PC values.  Since commit a0de8c21
single-stepping on these targets didn't work due to the addition of
address_significant in adjust_breakpoint_address - sign bits were cut
off because of default value of significant_addr_bit.  With this
commit, significant_addr_bit in gdbarch is set to the number of bits
in CORE_ADDR so breakpoint address comparison works again for MIPS
targets.

	* mips-tdep.c (mips_gdbarch_init): Set significant_addr_bit
---
 gdb/mips-tdep.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.14.3

Comments

Maciej W. Rozycki March 19, 2018, 2:11 p.m. | #1
On Thu, 15 Mar 2018, Vlad Ivanov wrote:

> MIPS targets use signed PC values.  Since commit a0de8c21

> single-stepping on these targets didn't work due to the addition of

> address_significant in adjust_breakpoint_address - sign bits were cut

> off because of default value of significant_addr_bit.  With this

> commit, significant_addr_bit in gdbarch is set to the number of bits

> in CORE_ADDR so breakpoint address comparison works again for MIPS

> targets.


 NAK.  As noted in the other thread I think it's the default that has to 
be fixed instead.

  Maciej

Patch

diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index f9f84c4d48..5d38168af0 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -8685,6 +8685,7 @@  mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Add/remove bits from an address.  The MIPS needs be careful to
      ensure that all 32 bit addresses are sign extended to 64 bits.  */
   set_gdbarch_addr_bits_remove (gdbarch, mips_addr_bits_remove);
+  set_gdbarch_significant_addr_bit (gdbarch, sizeof (CORE_ADDR) * HOST_CHAR_BIT);
 
   /* Unwind the frame.  */
   set_gdbarch_unwind_pc (gdbarch, mips_unwind_pc);