]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Reviewed and approved by ezannoni@redhat.com
authorFred Fish <fnf@specifix.com>
Thu, 19 Feb 2004 23:05:07 +0000 (23:05 +0000)
committerFred Fish <fnf@specifix.com>
Thu, 19 Feb 2004 23:05:07 +0000 (23:05 +0000)
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.

gdb/ChangeLog
gdb/sh-tdep.c

index a6c6f965ade53db2b9ec3394a779ba49f44cb98d..114cd44e7ea29c9a038190cf9cac1cc6b1302111 100644 (file)
@@ -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.
index 98706f6554b8b787e6e4a1c4096b7d5618897030..cca2a15462f2e1b5ce249b7c04d473be25c894c3 100644 (file)
@@ -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. */