Fix PR tdep/1291.
authorCorinna Vinschen <corinna@vinschen.de>
Mon, 8 Mar 2004 10:15:33 +0000 (10:15 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Mon, 8 Mar 2004 10:15:33 +0000 (10:15 +0000)
* sh-tdep.c (sh_analyze_prologue): Align PC relative addressing
to official SH documentation.

gdb/ChangeLog
gdb/sh-tdep.c

index 4683f060642d18f0a60f884a3337c530f62bad4e..814c2f3cfcb91be22dc45b06cd8d71284675681d 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-08  Corinna Vinschen  <vinschen@redhat.com>
+
+       Fix PR tdep/1291.
+       * sh-tdep.c (sh_analyze_prologue): Align PC relative addressing
+       to official SH documentation.
+
 2004-03-07  Andrew Cagney  <cagney@redhat.com>
 
        * ppc-linux-nat.c (ppc_ptrace_cannot_fetch_store_register): Delete
index 9cb5278c4d49a4c1917cc28023b8fa4ebb561ead..d1e5f597ae00624542fcaf1e96672f57f5c584d4 100644 (file)
@@ -440,9 +440,9 @@ sh_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
              if (reg < 14)
                {
                  sav_reg = reg;
-                 offset = (((inst & 0xff) ^ 0x80) - 0x80) << 1;
+                 offset = (inst & 0xff) << 1;
                  sav_offset =
-                   read_memory_integer (((pc + 4) & ~3) + offset, 2);
+                   read_memory_integer ((pc + 4) + offset, 2);
                }
            }
        }
@@ -450,13 +450,13 @@ sh_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
        {
          if (sav_reg < 0)
            {
-             reg = (inst & 0x0f00) >> 8;
+             reg = GET_TARGET_REG (inst);
              if (reg < 14)
                {
                  sav_reg = reg;
-                 offset = (((inst & 0xff) ^ 0x80) - 0x80) << 1;
+                 offset = (inst & 0xff) << 2;
                  sav_offset =
-                   read_memory_integer (((pc + 4) & ~3) + offset, 4);
+                   read_memory_integer (((pc & 0xfffffffc) + 4) + offset, 4);
                }
            }
        }