2002-06-06 Elena Zannoni <ezannoni@redhat.com>
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>
Thu, 6 Jun 2002 16:35:37 +0000 (16:35 +0000)
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>
Thu, 6 Jun 2002 16:35:37 +0000 (16:35 +0000)
        * d10v-tdep.c (d10v_read_sp, d10v_read_fp): Add prototype.
        (d10v_register_virtual_type): Make $fp and $sp be pointer to data.
        (d10v_integer_to_address): Rewrite.
        (d10v_frame_init_saved_regs): When reading fp and sp registers use
        the d10v specific functions which take care of converting to the
        correct space.

gdb/ChangeLog
gdb/d10v-tdep.c

index a2f5ea0cceb53d47aa0caa25e5428aae45500be6..f6fcdf99e1e5f85f299d9aa4310ad1c7e35d4806 100644 (file)
@@ -1,3 +1,12 @@
+2002-06-06  Elena Zannoni  <ezannoni@redhat.com>
+
+        * d10v-tdep.c (d10v_read_sp, d10v_read_fp): Add prototype.
+        (d10v_register_virtual_type): Make $fp and $sp be pointer to data.
+        (d10v_integer_to_address): Rewrite.
+        (d10v_frame_init_saved_regs): When reading fp and sp registers use
+        the d10v specific functions which take care of converting to the
+        correct space.
+
 2002-06-06  Elena Zannoni  <ezannoni@redhat.com>
 
        * config/djgpp/fnchange.lst: Add testsuite files altivec-abi.c,
index 9973ac98add57a16c0ef4c774b2eb7f90beca8b5..cb2ce4745d3025cbbeeed8cf40da8bfbcce9331a 100644 (file)
@@ -95,6 +95,10 @@ enum
 
 extern void _initialize_d10v_tdep (void);
 
+static CORE_ADDR d10v_read_sp (void);
+
+static CORE_ADDR d10v_read_fp (void);
+
 static void d10v_eva_prepare_to_trace (void);
 
 static void d10v_eva_get_trace_data (void);
@@ -366,6 +370,8 @@ d10v_register_virtual_type (int reg_nr)
 {
   if (reg_nr == PC_REGNUM)
     return builtin_type_void_func_ptr;
+  if (reg_nr == _SP_REGNUM || reg_nr == _FP_REGNUM)
+    return builtin_type_void_data_ptr;
   else if (reg_nr >= A0_REGNUM
       && reg_nr < (A0_REGNUM + NR_A_REGS))
     return builtin_type_int64;
@@ -444,20 +450,16 @@ d10v_pointer_to_address (struct type *type, void *buf)
     return d10v_make_daddr (addr);
 }
 
+/* Don't do anything if we have an integer, this way users can type 'x
+   <addr>' w/o having gdb outsmart them.  The internal gdb conversions
+   to the correct space are taken care of in the pointer_to_address
+   function.  If we don't do this, 'x $fp' wouldn't work.  */
 static CORE_ADDR
 d10v_integer_to_address (struct type *type, void *buf)
 {
   LONGEST val;
   val = unpack_long (type, buf);
-  if (TYPE_CODE (type) == TYPE_CODE_INT
-      && TYPE_LENGTH (type) <= TYPE_LENGTH (builtin_type_void_data_ptr))
-    /* Convert small integers that would would be directly copied into
-       a pointer variable into an address pointing into data space.  */
-    return d10v_make_daddr (val & 0xffff);
-  else
-    /* The value is too large to fit in a pointer.  Assume this was
-       intentional and that the user in fact specified a raw address.  */
-    return val;
+  return val;
 }
 
 /* Store the address of the place in which to copy the structure the
@@ -848,7 +850,7 @@ d10v_frame_init_saved_regs (struct frame_info *fi)
   fi->extra_info->size = -next_addr;
 
   if (!(fp & 0xffff))
-    fp = d10v_make_daddr (read_register (SP_REGNUM));
+    fp = d10v_read_sp ();
 
   for (i = 0; i < NUM_REGS - 1; i++)
     if (fi->saved_regs[i])
@@ -875,7 +877,7 @@ d10v_frame_init_saved_regs (struct frame_info *fi)
       /* otherwise, it isn't being used, so we use the SP instead */
       if (uses_frame)
        fi->saved_regs[SP_REGNUM] 
-         = read_register (FP_REGNUM) + fi->extra_info->size;
+         = d10v_read_fp () + fi->extra_info->size;
       else
        {
          fi->saved_regs[SP_REGNUM] = fp + fi->extra_info->size;
This page took 0.034794 seconds and 4 git commands to generate.