From 5f883eddb2b471afa50855a210b5fefb4d76695b Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Thu, 19 Feb 2004 23:05:07 +0000 Subject: 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. --- gdb/sh-tdep.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gdb/sh-tdep.c') diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 98706f6..cca2a15 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. */ -- cgit v1.1