This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdbarch: Add pc_signed field and use it when adjusting BP addresses
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: vlad dot ivanov at lab-systems dot ru (Vlad Ivanov)
- Cc: schwab at suse dot de (Andreas Schwab), gdb-patches at sourceware dot org (gdb-patches at sourceware dot org)
- Date: Thu, 15 Mar 2018 13:59:01 +0100 (CET)
- Subject: Re: [PATCH] gdbarch: Add pc_signed field and use it when adjusting BP addresses
Vlad Ivanov wrote:
> 15.03.2018, 14:33, "Andreas Schwab" <schwab@suse.de>:
> > On Mär 15 2018, vlad.ivanov@lab-systems.ru wrote:
> >
> >> Â diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
> >> Â index 454fda7684..247ec34857 100644
> >> Â --- a/gdb/breakpoint.c
> >> Â +++ b/gdb/breakpoint.c
> >> Â @@ -6999,7 +6999,10 @@ adjust_breakpoint_address (struct gdbarch *gdbarch,
> >> Â Â Â Â Â Â Â Â Â Â Â Â adjusted_bpaddr = gdbarch_adjust_breakpoint_address (gdbarch, bpaddr);
> >> Â Â Â Â Â Â Â Â Â Â }
> >>
> >> Â - adjusted_bpaddr = address_significant (gdbarch, adjusted_bpaddr);
> >> Â + /* Don't cut out "insignificant" address bits on targets with
> >> Â + signed PC. */
> >> Â + if (!gdbarch_pc_signed (gdbarch))
> >> Â + adjusted_bpaddr = address_significant (gdbarch, adjusted_bpaddr);
> >
> > Shouldn't it be sign-extended instead?
> >
> > Andreas.
> >
>
> MIPS backend already returns a sign-extended value, and address_significant
> cuts out bits 63 to 32. This makes breakpoint address comparison in step
> routines to misbehave.
If the address is already correct, why don't you simply set
gdbarch_significant_addr_bit
to 64 in the mips back-end instead of adding a new gdbarch routine?
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com