From: Fred Fish Date: Thu, 19 Feb 2004 23:05:07 +0000 (+0000) Subject: Reviewed and approved by ezannoni@redhat.com X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5f883eddb2b471afa50855a210b5fefb4d76695b;p=binutils-gdb.git Reviewed and approved by ezannoni@redhat.com 2004-02-19 Fred Fish Fix for PR breakpoint/1558. * sh-tdep.c (IS_JSR): New macro. (sh_analyze_prologue): Use IS_JSR to terminate prologue scan. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a6c6f965ade..114cd44e7ea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2004-02-19 Fred Fish + + Fix for PR breakpoint/1558. + * sh-tdep.c (IS_JSR): New macro. + (sh_analyze_prologue): Use IS_JSR to terminate prologue scan. + 2004-02-19 Jim Blandy * findvar.c (value_from_register): Doc fix. diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 98706f6554b..cca2a15462f 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -311,6 +311,9 @@ sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) #define GET_SOURCE_REG(x) (((x) >> 4) & 0xf) #define GET_TARGET_REG(x) (((x) >> 8) & 0xf) +/* JSR @Rm 0100mmmm00001011 */ +#define IS_JSR(x) (((x) & 0xf0ff) == 0x400b) + /* STS.L PR,@-r15 0100111100100010 r15-4-->r15, PR-->(r15) */ #define IS_STS(x) ((x) == 0x4f22) @@ -510,6 +513,20 @@ sh_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc, } break; } + else if (IS_JSR (inst)) + { + /* We have found a jsr that has been scheduled into the prologue. + If we continue the scan and return a pc someplace after this, + then setting a breakpoint on this function will cause it to + appear to be called after the function it is calling via the + jsr, which will be very confusing. Most likely the next + instruction is going to be IS_MOV_SP_FP in the delay slot. If + so, note that before returning the current pc. */ + inst = read_memory_integer (pc + 2, 2); + if (IS_MOV_SP_FP (inst)) + cache->uses_fp = 1; + break; + } #if 0 /* This used to just stop when it found an instruction that was not considered part of the prologue. Now, we just keep going looking for likely instructions. */