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: Vlad Ivanov <vlad dot ivanov at lab-systems dot ru>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 15 Mar 2018 14:36:37 +0300
- Subject: Re: [PATCH] gdbarch: Add pc_signed field and use it when adjusting BP addresses
- References: <20180315112111.15247-1-vlad.ivanov@lab-systems.ru> <mvmh8phlgii.fsf@suse.de>
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.
Regards,
Vlad