diff options
author | Fred Fish <fnf@specifix.com> | 2004-02-19 23:05:07 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 2004-02-19 23:05:07 +0000 |
commit | 5f883eddb2b471afa50855a210b5fefb4d76695b (patch) | |
tree | 569a318419a826497161d2c298cde8dfe9167a4c | |
parent | 441abf5c92debdd4501e95a0cd8cc170f893ff3b (diff) | |
download | gdb-5f883eddb2b471afa50855a210b5fefb4d76695b.zip gdb-5f883eddb2b471afa50855a210b5fefb4d76695b.tar.gz gdb-5f883eddb2b471afa50855a210b5fefb4d76695b.tar.bz2 |
Reviewed and approved by ezannoni@redhat.com
2004-02-19 Fred Fish <fnf@redhat.com>
Fix for PR breakpoint/1558.
* sh-tdep.c (IS_JSR): New macro.
(sh_analyze_prologue): Use IS_JSR to terminate prologue scan.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/sh-tdep.c | 17 |
2 files changed, 23 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a6c6f96..114cd44 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2004-02-19 Fred Fish <fnf@redhat.com> + + 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 <jimb@redhat.com> * findvar.c (value_from_register): Doc fix. 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. */ |