2002-11-18 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / gdb / arm-tdep.c
index ba213ae6da4b2af3f8ace93b1a5b4d197e5e6440..a7f84ed023bfa1648a955e384a215cdce2d6e3a4 100644 (file)
@@ -225,10 +225,10 @@ arm_pc_is_thumb_dummy (CORE_ADDR memaddr)
 static CORE_ADDR
 arm_addr_bits_remove (CORE_ADDR val)
 {
-  if (arm_pc_is_thumb (val))
-    return (val & (arm_apcs_32 ? 0xfffffffe : 0x03fffffe));
+  if (arm_apcs_32)
+    return (val & (arm_pc_is_thumb (val) ? 0xfffffffe : 0xfffffffc));
   else
-    return (val & (arm_apcs_32 ? 0xfffffffc : 0x03fffffc));
+    return (val & 0x03fffffc);
 }
 
 /* When reading symbols, we need to zap the low bit of the address,
@@ -995,7 +995,7 @@ arm_find_callers_reg (struct frame_info *fi, int regnum)
       if (USE_GENERIC_DUMMY_FRAMES
          && PC_IN_CALL_DUMMY (fi->pc, 0, 0))
        {
-         return generic_read_register_dummy (fi->pc, fi->frame, regnum);
+         return deprecated_read_register_dummy (fi->pc, fi->frame, regnum);
        }
       else if (fi->saved_regs[regnum] != 0)
        {
@@ -1110,26 +1110,31 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi)
           && PC_IN_CALL_DUMMY (fi->next->pc, 0, 0))
     /* For generic dummy frames, pull the value direct from the frame.
        Having an unwind function to do this would be nice.  */
-    sp = generic_read_register_dummy (fi->next->pc, fi->next->frame,
-                                     ARM_SP_REGNUM);
+    sp = deprecated_read_register_dummy (fi->next->pc, fi->next->frame,
+                                        ARM_SP_REGNUM);
   else
     sp = (fi->next->frame - fi->next->extra_info->frameoffset
          + fi->next->extra_info->framesize);
 
   /* Determine whether or not we're in a sigtramp frame.
-     Unfortunately, it isn't sufficient to test
-     fi->signal_handler_caller because this value is sometimes set
-     after invoking INIT_EXTRA_FRAME_INFO.  So we test *both*
-     fi->signal_handler_caller and PC_IN_SIGTRAMP to determine if we
-     need to use the sigcontext addresses for the saved registers.
+     Unfortunately, it isn't sufficient to test (get_frame_type (fi)
+     == SIGTRAMP_FRAME) because this value is sometimes set after
+     invoking INIT_EXTRA_FRAME_INFO.  So we test *both*
+     (get_frame_type (fi) == SIGTRAMP_FRAME) and PC_IN_SIGTRAMP to
+     determine if we need to use the sigcontext addresses for the
+     saved registers.
 
      Note: If an ARM PC_IN_SIGTRAMP method ever needs to compare
      against the name of the function, the code below will have to be
      changed to first fetch the name of the function and then pass
      this name to PC_IN_SIGTRAMP.  */
 
+  /* FIXME: cagney/2002-11-18: This problem will go away once
+     frame.c:get_prev_frame() is modified to set the frame's type
+     before calling functions like this.  */
+
   if (SIGCONTEXT_REGISTER_ADDRESS_P () 
-      && (fi->signal_handler_caller || PC_IN_SIGTRAMP (fi->pc, (char *)0)))
+      && ((get_frame_type (fi) == SIGTRAMP_FRAME) || PC_IN_SIGTRAMP (fi->pc, (char *)0)))
     {
       for (reg = 0; reg < NUM_REGS; reg++)
        fi->saved_regs[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, fi->pc, reg);
@@ -1143,7 +1148,8 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi)
       fi->extra_info->frameoffset = 0;
 
     }
-  else if (PC_IN_CALL_DUMMY (fi->pc, sp, fi->frame))
+  else if (!USE_GENERIC_DUMMY_FRAMES
+          && PC_IN_CALL_DUMMY (fi->pc, sp, fi->frame))
     {
       CORE_ADDR rp;
       CORE_ADDR callers_sp;
@@ -1162,7 +1168,10 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 
       callers_sp = read_memory_integer (fi->saved_regs[ARM_SP_REGNUM],
                                         REGISTER_RAW_SIZE (ARM_SP_REGNUM));
-      fi->extra_info->framereg = ARM_FP_REGNUM;
+      if (arm_pc_is_thumb (fi->pc))
+       fi->extra_info->framereg = THUMB_FP_REGNUM;
+      else
+       fi->extra_info->framereg = ARM_FP_REGNUM;
       fi->extra_info->framesize = callers_sp - sp;
       fi->extra_info->frameoffset = fi->frame - sp;
     }
@@ -1217,7 +1226,7 @@ arm_frame_saved_pc (struct frame_info *fi)
   /* If a dummy frame, pull the PC out of the frame's register buffer.  */
   if (USE_GENERIC_DUMMY_FRAMES
       && PC_IN_CALL_DUMMY (fi->pc, 0, 0))
-    return generic_read_register_dummy (fi->pc, fi->frame, ARM_PC_REGNUM);
+    return deprecated_read_register_dummy (fi->pc, fi->frame, ARM_PC_REGNUM);
 
   if (PC_IN_CALL_DUMMY (fi->pc, fi->frame - fi->extra_info->frameoffset,
                        fi->frame))
@@ -1585,7 +1594,7 @@ print_fpu_flags (int flags)
    (if present) or emulator.  */
 static void
 arm_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
-                     struct frame_info *frame)
+                     struct frame_info *frame, const char *args)
 {
   register unsigned long status = read_register (ARM_FPS_REGNUM);
   int type;
@@ -2279,9 +2288,12 @@ arm_extract_return_value (struct type *type,
    the address in which a function should return its structure value.  */
 
 static CORE_ADDR
-arm_extract_struct_value_address (char *regbuf)
+arm_extract_struct_value_address (struct regcache *regcache)
 {
-  return extract_address (regbuf, REGISTER_RAW_SIZE(ARM_A1_REGNUM));
+  ULONGEST ret;
+
+  regcache_cooked_read_unsigned (regcache, ARM_A1_REGNUM, &ret);
+  return ret;
 }
 
 /* Will a function return an aggregate type in memory or in a
@@ -2394,13 +2406,14 @@ arm_store_return_value (struct type *type, char *valbuf)
        case ARM_FLOAT_FPA:
 
          convert_to_extended (valbuf, buf);
-         write_register_bytes (REGISTER_BYTE (ARM_F0_REGNUM), buf,
-                               FP_REGISTER_RAW_SIZE);
+         deprecated_write_register_bytes (REGISTER_BYTE (ARM_F0_REGNUM), buf,
+                                          FP_REGISTER_RAW_SIZE);
          break;
 
        case ARM_FLOAT_SOFT:
        case ARM_FLOAT_SOFT_VFP:
-         write_register_bytes (ARM_A1_REGNUM, valbuf, TYPE_LENGTH (type));
+         deprecated_write_register_bytes (ARM_A1_REGNUM, valbuf,
+                                          TYPE_LENGTH (type));
          break;
 
        default:
@@ -2411,7 +2424,8 @@ arm_store_return_value (struct type *type, char *valbuf)
        }
     }
   else
-    write_register_bytes (ARM_A1_REGNUM, valbuf, TYPE_LENGTH (type));
+    deprecated_write_register_bytes (ARM_A1_REGNUM, valbuf,
+                                    TYPE_LENGTH (type));
 }
 
 /* Store the address of the place in which to copy the structure the
@@ -2851,7 +2865,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_push_return_address (gdbarch, arm_push_return_address);
 #endif
 
-  set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
+  set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
   set_gdbarch_push_arguments (gdbarch, arm_push_arguments);
   set_gdbarch_coerce_float_to_double (gdbarch,
                                      standard_coerce_float_to_double);
@@ -2926,10 +2940,10 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Returning results.  */
   set_gdbarch_deprecated_extract_return_value (gdbarch, arm_extract_return_value);
-  set_gdbarch_store_return_value (gdbarch, arm_store_return_value);
+  set_gdbarch_deprecated_store_return_value (gdbarch, arm_store_return_value);
   set_gdbarch_store_struct_return (gdbarch, arm_store_struct_return);
   set_gdbarch_use_struct_convention (gdbarch, arm_use_struct_convention);
-  set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
+  set_gdbarch_extract_struct_value_address (gdbarch,
                                            arm_extract_struct_value_address);
 
   /* Single stepping.  */
This page took 0.026109 seconds and 4 git commands to generate.