]> Git Repo - binutils.git/blobdiff - gdb/mips-tdep.c
* core.c (dis_asm_read_memory): drop fourth arg which conflicts with
[binutils.git] / gdb / mips-tdep.c
index 3e6c7a4fc5c40fb97389a0d191aebd6e5519a76a..d68fbc29b8bce8377d5e1b0fc17602a462f36683 100644 (file)
@@ -123,6 +123,11 @@ mips_frame_saved_pc(frame)
 static struct mips_extra_func_info temp_proc_desc;
 static struct frame_saved_regs temp_saved_regs;
 
+/* This fencepost looks highly suspicious to me.  Removing it also
+   seems suspicious as it could affect remote debugging across serial
+   lines.  At the very least, this needs a warning message.
+   [email protected] 12mar93. */
+
 static CORE_ADDR
 heuristic_proc_start(pc)
     CORE_ADDR pc;
@@ -135,7 +140,11 @@ heuristic_proc_start(pc)
 
     /* search back for previous return */
     for (start_pc -= 4; ; start_pc -= 4)
-       if (start_pc < fence) return 0; 
+       if (start_pc < fence)
+         {
+           warning("Cannot find enclosing function for pc 0x%x", pc);
+           return 0; 
+         }
        else if (ABOUT_TO_RETURN(start_pc))
            break;
 
@@ -493,8 +502,8 @@ mips_push_dummy_frame()
        write_memory (save_address, (char *)&buffer, sizeof(REGISTER_TYPE));
        save_address -= 4;
       }
-  /* save floating-points registers */
-  save_address = sp + PROC_FREG_OFFSET(proc_desc);
+  /* save floating-points registers starting with high order word */
+  save_address = sp + PROC_FREG_OFFSET(proc_desc) + 4;
   for (ireg = 32; --ireg >= 0; )
     if (PROC_FREG_MASK(proc_desc) & (1 << ireg))
       {
@@ -704,9 +713,10 @@ isa_NAN(p, len)
   else return 1;
 }
 \f
-/* To skip prologues, I use this predicate. Returns either PC
-   itself if the code at PC does not look like a function prologue,
-   PC+4 if it does (our caller does not need anything more fancy). */
+/* To skip prologues, I use this predicate.  Returns either PC
+   itself if the code at PC does not look like a function prologue;
+   otherwise returns an address that (if we're lucky) follows
+   the prologue. */
 
 CORE_ADDR
 mips_skip_prologue(pc)
@@ -716,6 +726,7 @@ mips_skip_prologue(pc)
     struct block *b;
     unsigned long inst;
     int offset;
+    int seen_sp_adjust = 0;
 
     /* For -g modules and most functions anyways the
        first instruction adjusts the stack.
@@ -724,10 +735,14 @@ mips_skip_prologue(pc)
     for (offset = 0; offset < 100; offset += 4) {
        inst = read_memory_integer(pc + offset, 4);
        if ((inst & 0xffff0000) == 0x27bd0000) /* addiu $sp,$sp,offset */
-           return pc + offset + 4;
-       if ((inst & 0xFFE00000) != 0xAFA00000) /* sw reg,n($sp) */
-           break;
+           seen_sp_adjust = 1;
+       else if ((inst & 0xFFE00000) == 0xAFA00000) /* sw reg,n($sp) */
+           continue;
+       else
+         break;
     }
+    if (seen_sp_adjust)
+      return pc + offset;
 
     /* Well, it looks like a frameless. Let's make sure.
        Note that we are not called on the current PC,
@@ -757,7 +772,7 @@ void
 _initialize_mips_tdep ()
 {
   add_show_from_set
-    (add_set_cmd ("mips_fpu", class_support, var_boolean,
+    (add_set_cmd ("mipsfpu", class_support, var_boolean,
                  (char *) &mips_fpu,
                  "Set use of floating point coprocessor.\n\
 Turn off to avoid using floating point instructions when calling functions\n\
This page took 0.024554 seconds and 4 git commands to generate.