1999-01-19 Fernando Nasser <fnasser@totem.to.cygnus.com>
[deliverable/binutils-gdb.git] / gdb / d10v-tdep.c
index 95b1ef55560f8f402d1079a3246b85c19c8c661e..f4b52f62295bb13dd6115dacbffad9fb195c1e21 100644 (file)
@@ -36,6 +36,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 void d10v_frame_find_saved_regs PARAMS ((struct frame_info *fi,
                                         struct frame_saved_regs *fsr));
 
+int
+d10v_frame_chain_valid (chain, frame)
+     CORE_ADDR chain;
+     struct frame_info *frame;      /* not used here */
+{
+  return ((chain) != 0 && (frame) != 0 && (frame)->pc > IMEM_START);
+}
+
+
+/* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of
+   EXTRACT_RETURN_VALUE?  GCC_P is true if compiled with gcc
+   and TYPE is the type (which is known to be struct, union or array).
+
+   The d10v returns anything less than 8 bytes in size in
+   registers. */
+
+int
+d10v_use_struct_convention (gcc_p, type)
+     int gcc_p;
+     struct type *type;
+{
+  return (TYPE_LENGTH (type) > 8);
+}
+
+
 /* Discard from the stack the innermost frame, restoring all saved
    registers.  */
 
@@ -414,7 +439,7 @@ show_regs (args, from_tty)
      char *args;
      int from_tty;
 {
-  LONGEST num1, num2;
+  int a;
   printf_filtered ("PC=%04x (0x%x) PSW=%04x RPT_S=%04x RPT_E=%04x RPT_C=%04x\n",
                    read_register (PC_REGNUM), D10V_MAKE_IADDR (read_register (PC_REGNUM)),
                    read_register (PSW_REGNUM),
@@ -443,9 +468,19 @@ show_regs (args, from_tty)
                    read_register (IMAP0_REGNUM),
                    read_register (IMAP1_REGNUM),
                    read_register (DMAP_REGNUM));
-  read_register_gen (A0_REGNUM, (char *)&num1);
-  read_register_gen (A0_REGNUM+1, (char *)&num2);
-  printf_filtered ("A0-A1  %010llx %010llx\n",num1, num2);
+  printf_filtered ("A0-A1");
+  for (a = A0_REGNUM; a <= A0_REGNUM + 1; a++)
+    {
+      char num[MAX_REGISTER_RAW_SIZE];
+      int i;
+      printf_filtered ("  ");
+      read_register_gen (a, (char *)&num);
+      for (i = 0; i < MAX_REGISTER_RAW_SIZE; i++)
+       {
+         printf_filtered ("%02x", (num[i] & 0xff));
+       }
+    }
+  printf_filtered ("\n");
 }
 
 CORE_ADDR
@@ -644,8 +679,17 @@ d10v_extract_return_value (type, regbuf, valbuf)
          unsigned short c = extract_unsigned_integer (regbuf + REGISTER_BYTE (RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM));
          store_unsigned_integer (valbuf, 1, c);
        }
-      else
+      else if ((len & 1) == 0)
        memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM), len);
+      else
+       {
+         /* For return values of odd size, the first byte is in the
+             least significant part of the first register.  The
+             remaining bytes in remaining registers. Interestingly,
+             when such values are passed in, the last byte is in the
+             most significant byte of that same register - wierd. */
+         memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM) + 1, len);
+       }
     }
 }
 
This page took 0.025329 seconds and 4 git commands to generate.