]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Changes to skip_prologue for PPC architecture.
authorKevin Buettner <kevinb@redhat.com>
Sat, 26 Feb 2000 09:30:30 +0000 (09:30 +0000)
committerKevin Buettner <kevinb@redhat.com>
Sat, 26 Feb 2000 09:30:30 +0000 (09:30 +0000)
gdb/ChangeLog
gdb/rs6000-tdep.c

index b3b3c265d428cd9b3ea4031ad0523466cde73e33..36dc637b17a7a2ea2a9ee40c8e08fe60ba9d2557 100644 (file)
@@ -1,3 +1,16 @@
+2000-02-26  Kevin Buettner  <kevinb@redhat.com>
+
+       * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Add
+       comment explaining motivation behind this function and why
+       the generic facilities won't work for this platform.
+       * rs6000-tdep.c (skip_prologue): Always test to make sure
+       that an instruction is read successfully from the target's
+       memory.  Introduce notion of instructions which may appear in
+       the prologue, but may not end the prologue.  Added explicit
+       check for nop instruction.  Use memset() to zero the frame
+       data instead of assignment from a statically allocated,
+       uninitialized structure.
+
 Sat Feb 26 17:15:16 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * MAINTAINERS: Chris Faylor is responsible for all MS Windows
index ca094c74cf322af46537ad07a065a8d0afb66cb6..c3cd31b75e49dc5d4dd4639d8691eb3844755c39 100644 (file)
@@ -305,11 +305,10 @@ rs6000_software_single_step (signal, insert_breakpoints_p)
 #define GET_SRC_REG(x) (((x) >> 21) & 0x1f)
 
 CORE_ADDR
-skip_prologue (pc, fdata)
-     CORE_ADDR pc;
-     struct rs6000_framedata *fdata;
+skip_prologue (CORE_ADDR pc, struct rs6000_framedata *fdata)
 {
   CORE_ADDR orig_pc = pc;
+  CORE_ADDR last_prologue_pc;
   char buf[4];
   unsigned long op;
   long offset = 0;
@@ -318,24 +317,31 @@ skip_prologue (pc, fdata)
   int reg;
   int framep = 0;
   int minimal_toc_loaded = 0;
-  static struct rs6000_framedata zero_frame;
+  int prev_insn_was_prologue_insn = 1;
 
-  *fdata = zero_frame;
+  memset (fdata, 0, sizeof (struct rs6000_framedata));
   fdata->saved_gpr = -1;
   fdata->saved_fpr = -1;
   fdata->alloca_reg = -1;
   fdata->frameless = 1;
   fdata->nosavedpc = 1;
 
-  if (target_read_memory (pc, buf, 4))
-    return pc;                 /* Can't access it -- assume no prologue. */
-
-  /* Assume that subsequent fetches can fail with low probability.  */
   pc -= 4;
   for (;;)
     {
       pc += 4;
-      op = read_memory_integer (pc, 4);
+
+      /* Sometimes it isn't clear if an instruction is a prologue
+         instruction or not.  When we encounter one of these ambiguous
+        cases, we'll set prev_insn_was_prologue_insn to 0 (false).
+        Otherwise, we'll assume that it really is a prologue instruction. */
+      if (prev_insn_was_prologue_insn)
+       last_prologue_pc = pc;
+      prev_insn_was_prologue_insn = 1;
+
+      if (target_read_memory (pc, buf, 4))
+       break;
+      op = extract_signed_integer (buf, 4);
 
       if ((op & 0xfc1fffff) == 0x7c0802a6)
        {                       /* mflr Rx */
@@ -374,6 +380,16 @@ skip_prologue (pc, fdata)
            }
          continue;
 
+       }
+      else if ((op & 0xffff0000) == 0x60000000)
+        {
+                               /* nop */
+         /* Allow nops in the prologue, but do not consider them to
+            be part of the prologue unless followed by other prologue
+            instructions. */
+         prev_insn_was_prologue_insn = 0;
+         continue;
+
        }
       else if ((op & 0xffff0000) == 0x3c000000)
        {                       /* addis 0,0,NUM, used
@@ -564,7 +580,7 @@ skip_prologue (pc, fdata)
 #endif /* 0 */
 
   fdata->offset = -fdata->offset;
-  return pc;
+  return last_prologue_pc;
 }