2003-06-08 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / h8300-tdep.c
index 52f91c0056dbb11bc56a21b0f408f237ac6bf3a7..43ecf50a519d5b34b9e32624197b70c7fa1ef6bb 100644 (file)
@@ -1,7 +1,7 @@
 /* Target-machine dependent code for Hitachi H8/300, for GDB.
 
    Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
 /* Target-machine dependent code for Hitachi H8/300, for GDB.
 
    Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
-   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 
    This file is part of GDB.
 
@@ -34,6 +34,7 @@
 #include "gdbcore.h"
 #include "objfiles.h"
 #include "gdbcmd.h"
 #include "gdbcore.h"
 #include "objfiles.h"
 #include "gdbcmd.h"
+#include "gdb_assert.h"
 
 /* Extra info which is saved in each frame_info. */
 struct frame_extra_info
 
 /* Extra info which is saved in each frame_info. */
 struct frame_extra_info
@@ -269,7 +270,9 @@ gdb_print_insn_h8300 (bfd_vma memaddr, disassemble_info * info)
    of the instruction. */
 
 static CORE_ADDR
    of the instruction. */
 
 static CORE_ADDR
-h8300_next_prologue_insn (CORE_ADDR addr, CORE_ADDR lim, unsigned short* pword1)
+h8300_next_prologue_insn (CORE_ADDR addr, 
+                         CORE_ADDR lim, 
+                         unsigned short* pword1)
 {
   char buf[2];
   if (addr < lim + 8)
 {
   char buf[2];
   if (addr < lim + 8)
@@ -412,10 +415,10 @@ h8300_examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit,
 
       if (IS_PUSH (insn_word))
        {
 
       if (IS_PUSH (insn_word))
        {
+         auto_depth += 2 + adjust;
+         fsr[insn_word & 0x7] = after_prolog_fp - auto_depth;
          ip = next_ip;
          next_ip = h8300_next_prologue_insn (ip, limit, &insn_word);
          ip = next_ip;
          next_ip = h8300_next_prologue_insn (ip, limit, &insn_word);
-         fsr[r] = after_prolog_fp + auto_depth;
-         auto_depth += 2 + adjust;
          continue;
        }
 
          continue;
        }
 
@@ -429,21 +432,21 @@ h8300_examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit,
          next_ip = h8300_next_prologue_insn (ip, limit, &insn_word);
          start = insn_word & 0x7;
 
          next_ip = h8300_next_prologue_insn (ip, limit, &insn_word);
          start = insn_word & 0x7;
 
-         for (i = start; i <= start + count; i++)
+         for (i = start; i < start + count; i++)
            {
            {
-             fsr[i] = after_prolog_fp + auto_depth;
              auto_depth += 4;
              auto_depth += 4;
+             fsr[i] = after_prolog_fp - auto_depth;
            }
        }
       break;
     }
 
   /* The args are always reffed based from the stack pointer */
            }
        }
       break;
     }
 
   /* The args are always reffed based from the stack pointer */
-  fi->extra_info->args_pointer = after_prolog_fp;
+  get_frame_extra_info (fi)->args_pointer = after_prolog_fp;
   /* Locals are always reffed based from the fp */
   /* Locals are always reffed based from the fp */
-  fi->extra_info->locals_pointer = after_prolog_fp;
+  get_frame_extra_info (fi)->locals_pointer = after_prolog_fp;
   /* The PC is at a known place */
   /* The PC is at a known place */
-  fi->extra_info->from_pc =
+  get_frame_extra_info (fi)->from_pc =
     read_memory_unsigned_integer (after_prolog_fp + BINWORD, BINWORD);
 
   /* Rememeber any others too */
     read_memory_unsigned_integer (after_prolog_fp + BINWORD, BINWORD);
 
   /* Rememeber any others too */
@@ -451,7 +454,8 @@ h8300_examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit,
 
   if (have_fp)
     /* We keep the old FP in the SP spot */
 
   if (have_fp)
     /* We keep the old FP in the SP spot */
-    fsr[E_SP_REGNUM] = read_memory_unsigned_integer (fsr[E_FP_REGNUM], BINWORD);
+    fsr[E_SP_REGNUM] = read_memory_unsigned_integer (fsr[E_FP_REGNUM], 
+                                                    BINWORD);
   else
     fsr[E_SP_REGNUM] = after_prolog_fp + auto_depth;
 
   else
     fsr[E_SP_REGNUM] = after_prolog_fp + auto_depth;
 
@@ -463,42 +467,50 @@ h8300_frame_init_saved_regs (struct frame_info *fi)
 {
   CORE_ADDR func_addr, func_end;
 
 {
   CORE_ADDR func_addr, func_end;
 
-  if (!fi->saved_regs)
+  if (!get_frame_saved_regs (fi))
     {
       frame_saved_regs_zalloc (fi);
 
       /* Find the beginning of this function, so we can analyze its
         prologue. */
     {
       frame_saved_regs_zalloc (fi);
 
       /* Find the beginning of this function, so we can analyze its
         prologue. */
-      if (find_pc_partial_function (fi->pc, NULL, &func_addr, &func_end))
+      if (find_pc_partial_function (get_frame_pc (fi), NULL, 
+                                   &func_addr, &func_end))
         {
          struct symtab_and_line sal = find_pc_line (func_addr, 0);
         {
          struct symtab_and_line sal = find_pc_line (func_addr, 0);
-         CORE_ADDR limit = (sal.end && sal.end < fi->pc) ? sal.end : fi->pc;
+         CORE_ADDR limit = (sal.end && sal.end < get_frame_pc (fi)) 
+           ? sal.end : get_frame_pc (fi);
          /* This will fill in fields in fi. */
          /* This will fill in fields in fi. */
-         h8300_examine_prologue (func_addr, limit, fi->frame, fi->saved_regs, fi);
+         h8300_examine_prologue (func_addr, limit, get_frame_base (fi),
+                                 get_frame_saved_regs (fi), fi);
        }
       /* Else we're out of luck (can't debug completely stripped code). 
         FIXME. */
     }
 }
 
        }
       /* Else we're out of luck (can't debug completely stripped code). 
         FIXME. */
     }
 }
 
-/* Given a GDB frame, determine the address of the calling function's frame.
-   This will be used to create a new GDB frame struct, and then
-   INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
+/* Given a GDB frame, determine the address of the calling function's
+   frame.  This will be used to create a new GDB frame struct, and
+   then DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC
+   will be called for the new frame.
 
    For us, the frame address is its stack pointer value, so we look up
 
    For us, the frame address is its stack pointer value, so we look up
-   the function prologue to determine the caller's sp value, and return it.  */
+   the function prologue to determine the caller's sp value, and
+   return it.  */
 
 static CORE_ADDR
 h8300_frame_chain (struct frame_info *thisframe)
 {
 
 static CORE_ADDR
 h8300_frame_chain (struct frame_info *thisframe)
 {
-  if (PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (thisframe),
+                                  get_frame_base (thisframe),
+                                  get_frame_base (thisframe)))
     {                          /* initialize the from_pc now */
     {                          /* initialize the from_pc now */
-      thisframe->extra_info->from_pc =
-       deprecated_read_register_dummy (thisframe->pc, thisframe->frame,
+      get_frame_extra_info (thisframe)->from_pc =
+       deprecated_read_register_dummy (get_frame_pc (thisframe),
+                                       get_frame_base (thisframe),
                                        E_PC_REGNUM);
                                        E_PC_REGNUM);
-      return thisframe->frame;
+      return get_frame_base (thisframe);
     }
     }
-  return thisframe->saved_regs[E_SP_REGNUM];
+  return get_frame_saved_regs (thisframe)[E_SP_REGNUM];
 }
 
 /* Return the saved PC from this frame.
 }
 
 /* Return the saved PC from this frame.
@@ -509,28 +521,30 @@ h8300_frame_chain (struct frame_info *thisframe)
 static CORE_ADDR
 h8300_frame_saved_pc (struct frame_info *frame)
 {
 static CORE_ADDR
 h8300_frame_saved_pc (struct frame_info *frame)
 {
-  if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
-    return deprecated_read_register_dummy (frame->pc, frame->frame,
+  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
+                                  get_frame_base (frame),
+                                  get_frame_base (frame)))
+    return deprecated_read_register_dummy (get_frame_pc (frame),
+                                          get_frame_base (frame),
                                           E_PC_REGNUM);
   else
                                           E_PC_REGNUM);
   else
-    return frame->extra_info->from_pc;
+    return get_frame_extra_info (frame)->from_pc;
 }
 
 static void
 h8300_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 {
 }
 
 static void
 h8300_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 {
-  if (!fi->extra_info)
+  if (!get_frame_extra_info (fi))
     {
     {
-      fi->extra_info = (struct frame_extra_info *)
-        frame_obstack_alloc (sizeof (struct frame_extra_info));
-      fi->extra_info->from_pc = 0;
-      fi->extra_info->args_pointer = 0;                /* Unknown */
-      fi->extra_info->locals_pointer = 0;      /* Unknown */
+      frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
+      get_frame_extra_info (fi)->from_pc = 0;
+      get_frame_extra_info (fi)->args_pointer = 0;     /* Unknown */
+      get_frame_extra_info (fi)->locals_pointer = 0;   /* Unknown */
       
       
-      if (!fi->pc)
+      if (!get_frame_pc (fi))
         {
         {
-         if (fi->next)
-           fi->pc = h8300_frame_saved_pc (fi->next);
+         if (get_next_frame (fi))
+           deprecated_update_frame_pc_hack (fi, h8300_frame_saved_pc (get_next_frame (fi)));
        }
       h8300_frame_init_saved_regs (fi);
     }
        }
       h8300_frame_init_saved_regs (fi);
     }
@@ -539,9 +553,10 @@ h8300_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 static CORE_ADDR
 h8300_frame_locals_address (struct frame_info *fi)
 {
 static CORE_ADDR
 h8300_frame_locals_address (struct frame_info *fi)
 {
-  if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
+                                  get_frame_base (fi)))
     return (CORE_ADDR) 0;      /* Not sure what else to do... */
     return (CORE_ADDR) 0;      /* Not sure what else to do... */
-  return fi->extra_info->locals_pointer;
+  return get_frame_extra_info (fi)->locals_pointer;
 }
 
 /* Return the address of the argument block for the frame
 }
 
 /* Return the address of the argument block for the frame
@@ -550,9 +565,10 @@ h8300_frame_locals_address (struct frame_info *fi)
 static CORE_ADDR
 h8300_frame_args_address (struct frame_info *fi)
 {
 static CORE_ADDR
 h8300_frame_args_address (struct frame_info *fi)
 {
-  if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
+                                  get_frame_base (fi)))
     return (CORE_ADDR) 0;      /* Not sure what else to do... */
     return (CORE_ADDR) 0;      /* Not sure what else to do... */
-  return fi->extra_info->args_pointer;
+  return get_frame_extra_info (fi)->args_pointer;
 }
 
 /* Round N up or down to the nearest multiple of UNIT.
 }
 
 /* Round N up or down to the nearest multiple of UNIT.
@@ -696,7 +712,8 @@ h8300_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
 
               for (offset = 0; offset < padded_len; offset += wordsize)
                 {
 
               for (offset = 0; offset < padded_len; offset += wordsize)
                 {
-                  ULONGEST word = extract_address (padded + offset, wordsize);
+                  ULONGEST word = extract_unsigned_integer (padded + offset, 
+                                                           wordsize);
                   write_register (reg++, word);
                 }
             }
                   write_register (reg++, word);
                 }
             }
@@ -745,7 +762,9 @@ h8300_pop_frame (void)
   unsigned regno;
   struct frame_info *frame = get_current_frame ();
 
   unsigned regno;
   struct frame_info *frame = get_current_frame ();
 
-  if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
+                                  get_frame_base (frame),
+                                  get_frame_base (frame)))
     {
       generic_pop_dummy_frame ();
     }
     {
       generic_pop_dummy_frame ();
     }
@@ -755,16 +774,16 @@ h8300_pop_frame (void)
        {
          /* Don't forget E_SP_REGNUM is a frame_saved_regs struct is the
             actual value we want, not the address of the value we want.  */
        {
          /* Don't forget E_SP_REGNUM is a frame_saved_regs struct is the
             actual value we want, not the address of the value we want.  */
-         if (frame->saved_regs[regno] && regno != E_SP_REGNUM)
+         if (get_frame_saved_regs (frame)[regno] && regno != E_SP_REGNUM)
            write_register (regno,
            write_register (regno,
-                           read_memory_integer (frame->saved_regs[regno],
-                                                BINWORD));
-         else if (frame->saved_regs[regno] && regno == E_SP_REGNUM)
-           write_register (regno, frame->frame + 2 * BINWORD);
+                           read_memory_integer 
+                           (get_frame_saved_regs (frame)[regno], BINWORD));
+         else if (get_frame_saved_regs (frame)[regno] && regno == E_SP_REGNUM)
+           write_register (regno, get_frame_base (frame) + 2 * BINWORD);
        }
 
       /* Don't forget to update the PC too!  */
        }
 
       /* Don't forget to update the PC too!  */
-      write_register (E_PC_REGNUM, frame->extra_info->from_pc);
+      write_register (E_PC_REGNUM, get_frame_extra_info (frame)->from_pc);
     }
   flush_cached_frames ();
 }
     }
   flush_cached_frames ();
 }
@@ -796,8 +815,9 @@ h8300_extract_return_value (struct type *type, char *regbuf, char *valbuf)
          memcpy (valbuf + 2, regbuf + REGISTER_BYTE (1), 2);
        }
       break;
          memcpy (valbuf + 2, regbuf + REGISTER_BYTE (1), 2);
        }
       break;
-    case 8:                    /* (double) (doesn't seem to happen, which is good,
-                                  because this almost certainly isn't right.  */
+    case 8:            /* (double) (doesn't seem to happen, which is good,
+                          because this almost certainly isn't right.  
+                          FIXME: it will happen for h8sx...  */
       error ("I don't know how a double is returned.");
       break;
     }
       error ("I don't know how a double is returned.");
       break;
     }
@@ -818,11 +838,11 @@ h8300_store_return_value (struct type *type, char *valbuf)
     {
     case 1:                    /* char */
     case 2:                    /* short, int */
     {
     case 1:                    /* char */
     case 2:                    /* short, int */
-      regval = extract_address (valbuf, len);
+      regval = extract_unsigned_integer (valbuf, len);
       write_register (0, regval);
       break;
     case 4:                    /* long, float */
       write_register (0, regval);
       break;
     case 4:                    /* long, float */
-      regval = extract_address (valbuf, len);
+      regval = extract_unsigned_integer (valbuf, len);
       if (wordsize == 4)
        {
          write_register (0, regval);
       if (wordsize == 4)
        {
          write_register (0, regval);
@@ -833,7 +853,7 @@ h8300_store_return_value (struct type *type, char *valbuf)
          write_register (1, regval & 0xffff);
        }
       break;
          write_register (1, regval & 0xffff);
        }
       break;
-    case 8:                    /* presumeably double, but doesn't seem to happen */
+    case 8:            /* presumeably double, but doesn't seem to happen */
       error ("I don't know how to return a double.");
       break;
     }
       error ("I don't know how to return a double.");
       break;
     }
@@ -864,28 +884,38 @@ h8300_register_name (int regno)
 }
 
 static void
 }
 
 static void
-h8300_print_register (int regno)
+h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file,
+                     struct frame_info *frame, int regno)
 {
 {
-  long val = read_register (regno);
+  ULONGEST rval;
+  long val;
   const char *name = h8300_register_name (regno);
 
   if (!name || !*name)
     return;
 
   const char *name = h8300_register_name (regno);
 
   if (!name || !*name)
     return;
 
-  printf_filtered ("%-14s ", name);
+  /* FIXME: cagney/2002-10-22: The code below assumes that VAL is at
+     least 4 bytes (32 bits) in size and hence is large enough to hold
+     the largest h8300 register.  Should instead be using ULONGEST and
+     the phex() functions.  */
+  gdb_assert (sizeof (val) >= 4);
+  frame_read_unsigned_register (frame, regno, &rval);
+  val = rval;
+
+  fprintf_filtered (file, "%-14s ", name);
   if (h8300hmode)
     {
       if (val)
   if (h8300hmode)
     {
       if (val)
-       printf_filtered ("0x%08lx   %-8ld", val, val);
+       fprintf_filtered (file, "0x%08lx   %-8ld", val, val);
       else
       else
-       printf_filtered ("0x%-8lx   %-8ld", val, val);
+       fprintf_filtered (file, "0x%-8lx   %-8ld", val, val);
     }
   else
     {
       if (val)
     }
   else
     {
       if (val)
-       printf_filtered ("0x%04lx   %-4ld", val, val);
+       fprintf_filtered (file, "0x%04lx   %-4ld", val, val);
       else
       else
-       printf_filtered ("0x%-4lx   %-4ld", val, val);
+       fprintf_filtered (file, "0x%-4lx   %-4ld", val, val);
     }
   if (regno == E_CCR_REGNUM)
     {
     }
   if (regno == E_CCR_REGNUM)
     {
@@ -893,66 +923,67 @@ h8300_print_register (int regno)
       int C, Z, N, V;
       unsigned char b[h8300h_reg_size];
       unsigned char l;
       int C, Z, N, V;
       unsigned char b[h8300h_reg_size];
       unsigned char l;
-      frame_register_read (selected_frame, regno, b);
+      frame_register_read (deprecated_selected_frame, regno, b);
       l = b[REGISTER_VIRTUAL_SIZE (E_CCR_REGNUM) - 1];
       l = b[REGISTER_VIRTUAL_SIZE (E_CCR_REGNUM) - 1];
-      printf_unfiltered ("\t");
-      printf_unfiltered ("I-%d ", (l & 0x80) != 0);
-      printf_unfiltered ("UI-%d ", (l & 0x40) != 0);
-      printf_unfiltered ("H-%d ", (l & 0x20) != 0);
-      printf_unfiltered ("U-%d ", (l & 0x10) != 0);
+      fprintf_filtered (file, "\t");
+      fprintf_filtered (file, "I-%d ", (l & 0x80) != 0);
+      fprintf_filtered (file, "UI-%d ", (l & 0x40) != 0);
+      fprintf_filtered (file, "H-%d ", (l & 0x20) != 0);
+      fprintf_filtered (file, "U-%d ", (l & 0x10) != 0);
       N = (l & 0x8) != 0;
       Z = (l & 0x4) != 0;
       V = (l & 0x2) != 0;
       C = (l & 0x1) != 0;
       N = (l & 0x8) != 0;
       Z = (l & 0x4) != 0;
       V = (l & 0x2) != 0;
       C = (l & 0x1) != 0;
-      printf_unfiltered ("N-%d ", N);
-      printf_unfiltered ("Z-%d ", Z);
-      printf_unfiltered ("V-%d ", V);
-      printf_unfiltered ("C-%d ", C);
+      fprintf_filtered (file, "N-%d ", N);
+      fprintf_filtered (file, "Z-%d ", Z);
+      fprintf_filtered (file, "V-%d ", V);
+      fprintf_filtered (file, "C-%d ", C);
       if ((C | Z) == 0)
       if ((C | Z) == 0)
-       printf_unfiltered ("u> ");
+       fprintf_filtered (file, "u> ");
       if ((C | Z) == 1)
       if ((C | Z) == 1)
-       printf_unfiltered ("u<= ");
+       fprintf_filtered (file, "u<= ");
       if ((C == 0))
       if ((C == 0))
-       printf_unfiltered ("u>= ");
+       fprintf_filtered (file, "u>= ");
       if (C == 1)
       if (C == 1)
-       printf_unfiltered ("u< ");
+       fprintf_filtered (file, "u< ");
       if (Z == 0)
       if (Z == 0)
-       printf_unfiltered ("!= ");
+       fprintf_filtered (file, "!= ");
       if (Z == 1)
       if (Z == 1)
-       printf_unfiltered ("== ");
+       fprintf_filtered (file, "== ");
       if ((N ^ V) == 0)
       if ((N ^ V) == 0)
-       printf_unfiltered (">= ");
+       fprintf_filtered (file, ">= ");
       if ((N ^ V) == 1)
       if ((N ^ V) == 1)
-       printf_unfiltered ("< ");
+       fprintf_filtered (file, "< ");
       if ((Z | (N ^ V)) == 0)
       if ((Z | (N ^ V)) == 0)
-       printf_unfiltered ("> ");
+       fprintf_filtered (file, "> ");
       if ((Z | (N ^ V)) == 1)
       if ((Z | (N ^ V)) == 1)
-       printf_unfiltered ("<= ");
+       fprintf_filtered (file, "<= ");
     }
   else if (regno == E_EXR_REGNUM && h8300smode)
     {
       /* EXR register */
       unsigned char b[h8300h_reg_size];
       unsigned char l;
     }
   else if (regno == E_EXR_REGNUM && h8300smode)
     {
       /* EXR register */
       unsigned char b[h8300h_reg_size];
       unsigned char l;
-      frame_register_read (selected_frame, regno, b);
+      frame_register_read (deprecated_selected_frame, regno, b);
       l = b[REGISTER_VIRTUAL_SIZE (E_EXR_REGNUM) - 1];
       l = b[REGISTER_VIRTUAL_SIZE (E_EXR_REGNUM) - 1];
-      printf_unfiltered ("\t");
-      printf_unfiltered ("T-%d - - - ", (l & 0x80) != 0);
-      printf_unfiltered ("I2-%d ", (l & 4) != 0);
-      printf_unfiltered ("I1-%d ", (l & 2) != 0);
-      printf_unfiltered ("I0-%d", (l & 1) != 0);
+      fprintf_filtered (file, "\t");
+      fprintf_filtered (file, "T-%d - - - ", (l & 0x80) != 0);
+      fprintf_filtered (file, "I2-%d ", (l & 4) != 0);
+      fprintf_filtered (file, "I1-%d ", (l & 2) != 0);
+      fprintf_filtered (file, "I0-%d", (l & 1) != 0);
     }
     }
-  printf_filtered ("\n");
+  fprintf_filtered (file, "\n");
 }
 
 static void
 }
 
 static void
-h8300_do_registers_info (int regno, int cpregs)
+h8300_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
+                           struct frame_info *frame, int regno, int cpregs)
 {
   if (regno < 0)
     for (regno = 0; regno < E_NUM_REGS; ++regno)
 {
   if (regno < 0)
     for (regno = 0; regno < E_NUM_REGS; ++regno)
-      h8300_print_register (regno);
+      h8300_print_register (gdbarch, file, frame, regno);
   else
   else
-    h8300_print_register (regno);
+    h8300_print_register (gdbarch, file, frame, regno);
 }
 
 static CORE_ADDR
 }
 
 static CORE_ADDR
@@ -1009,8 +1040,9 @@ h8300_use_struct_convention (int gcc_p, struct type *type)
 static CORE_ADDR
 h8300_extract_struct_value_address (char *regbuf)
 {
 static CORE_ADDR
 h8300_extract_struct_value_address (char *regbuf)
 {
-  return extract_address (regbuf + h8300_register_byte (E_ARG0_REGNUM),
-                         h8300_register_raw_size (E_ARG0_REGNUM));
+  return 
+    extract_unsigned_integer (regbuf + h8300_register_byte (E_ARG0_REGNUM),
+                             h8300_register_raw_size (E_ARG0_REGNUM));
 }
 
 const static unsigned char *
 }
 
 const static unsigned char *
@@ -1051,22 +1083,36 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   switch (info.bfd_arch_info->mach)
     {
 
   switch (info.bfd_arch_info->mach)
     {
-      case bfd_mach_h8300:
-       h8300smode = 0;
-       h8300hmode = 0;
-       break;
-      case bfd_mach_h8300h:
-       h8300smode = 0;
-       h8300hmode = 1;
-       break;
-      case bfd_mach_h8300s:
-       h8300smode = 1;
-       h8300hmode = 1;
-       break;
+    case bfd_mach_h8300:
+      h8300sxmode = 0;
+      h8300smode = 0;
+      h8300hmode = 0;
+      break;
+    case bfd_mach_h8300h:
+    case bfd_mach_h8300hn:
+      h8300sxmode = 0;
+      h8300smode = 0;
+      h8300hmode = 1;
+      break;
+    case bfd_mach_h8300s:
+    case bfd_mach_h8300sn:
+      h8300sxmode = 0;
+      h8300smode = 1;
+      h8300hmode = 1;
+      break;
+    case bfd_mach_h8300sx:
+      h8300sxmode = 1;
+      h8300smode = 1;
+      h8300hmode = 1;
+      break;
     }
 
   gdbarch = gdbarch_alloc (&info, 0);
 
     }
 
   gdbarch = gdbarch_alloc (&info, 0);
 
+  /* NOTE: cagney/2002-12-06: This can be deleted when this arch is
+     ready to unwind the PC first (see frame.c:get_prev_frame()).  */
+  set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
+
   /*
    * Basic register fields and methods.
    */
   /*
    * Basic register fields and methods.
    */
@@ -1074,31 +1120,32 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_num_regs (gdbarch, E_NUM_REGS);
   set_gdbarch_num_pseudo_regs (gdbarch, 0);
   set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
   set_gdbarch_num_regs (gdbarch, E_NUM_REGS);
   set_gdbarch_num_pseudo_regs (gdbarch, 0);
   set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
-  set_gdbarch_fp_regnum (gdbarch, E_FP_REGNUM);
+  set_gdbarch_deprecated_fp_regnum (gdbarch, E_FP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
   set_gdbarch_register_name (gdbarch, h8300_register_name);
   set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
   set_gdbarch_register_name (gdbarch, h8300_register_name);
-  set_gdbarch_register_size (gdbarch, BINWORD);
-  set_gdbarch_register_bytes (gdbarch, E_NUM_REGS * BINWORD);
+  set_gdbarch_deprecated_register_size (gdbarch, BINWORD);
+  set_gdbarch_deprecated_register_bytes (gdbarch, E_NUM_REGS * BINWORD);
   set_gdbarch_register_byte (gdbarch, h8300_register_byte);
   set_gdbarch_register_raw_size (gdbarch, h8300_register_raw_size);
   set_gdbarch_register_byte (gdbarch, h8300_register_byte);
   set_gdbarch_register_raw_size (gdbarch, h8300_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, h8300h_reg_size);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, h8300h_reg_size);
   set_gdbarch_register_virtual_size (gdbarch, h8300_register_raw_size);
   set_gdbarch_register_virtual_size (gdbarch, h8300_register_raw_size);
-  set_gdbarch_max_register_virtual_size (gdbarch, h8300h_reg_size);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, h8300h_reg_size);
   set_gdbarch_register_virtual_type (gdbarch, h8300_register_virtual_type);
   set_gdbarch_register_virtual_type (gdbarch, h8300_register_virtual_type);
-  set_gdbarch_do_registers_info (gdbarch, h8300_do_registers_info);
+  set_gdbarch_print_registers_info (gdbarch, h8300_print_registers_info);
   set_gdbarch_print_float_info (gdbarch, h8300_print_float_info);
 
   /*
    * Frame Info
    */
   set_gdbarch_print_float_info (gdbarch, h8300_print_float_info);
 
   /*
    * Frame Info
    */
-  set_gdbarch_init_extra_frame_info (gdbarch, h8300_init_extra_frame_info);
-  set_gdbarch_frame_init_saved_regs (gdbarch, h8300_frame_init_saved_regs);
-  set_gdbarch_frame_chain (gdbarch, h8300_frame_chain);
-  set_gdbarch_get_saved_register (gdbarch, generic_unwind_get_saved_register);
-  set_gdbarch_saved_pc_after_call (gdbarch, h8300_saved_pc_after_call);
-  set_gdbarch_frame_saved_pc (gdbarch, h8300_frame_saved_pc);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, 
+                                               h8300_frame_init_saved_regs);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, 
+                                               h8300_init_extra_frame_info);
+  set_gdbarch_deprecated_frame_chain (gdbarch, h8300_frame_chain);
+  set_gdbarch_deprecated_saved_pc_after_call (gdbarch, 
+                                             h8300_saved_pc_after_call);
+  set_gdbarch_deprecated_frame_saved_pc (gdbarch, h8300_frame_saved_pc);
   set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue);
   set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue);
-  set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
   set_gdbarch_frame_args_address (gdbarch, h8300_frame_args_address);
   set_gdbarch_frame_locals_address (gdbarch, h8300_frame_locals_address);
 
   set_gdbarch_frame_args_address (gdbarch, h8300_frame_args_address);
   set_gdbarch_frame_locals_address (gdbarch, h8300_frame_locals_address);
 
@@ -1119,36 +1166,25 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frameless_function_invocation (gdbarch,
                                             frameless_look_for_prologue);
 
   set_gdbarch_frameless_function_invocation (gdbarch,
                                             frameless_look_for_prologue);
 
-  /* W/o prototype, coerce float args to double. */
-  /* set_gdbarch_coerce_float_to_double (gdbarch, standard_coerce_float_to_double); */
-
   /*
    * Call Dummies
    * 
    * These values and methods are used when gdb calls a target function.  */
   /*
    * Call Dummies
    * 
    * These values and methods are used when gdb calls a target function.  */
-  set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
-  set_gdbarch_push_return_address (gdbarch, h8300_push_return_address);
-  set_gdbarch_deprecated_extract_return_value (gdbarch, h8300_extract_return_value);
-  set_gdbarch_push_arguments (gdbarch, h8300_push_arguments);
-  set_gdbarch_pop_frame (gdbarch, h8300_pop_frame);
-  set_gdbarch_store_struct_return (gdbarch, h8300_store_struct_return);
-  set_gdbarch_deprecated_store_return_value (gdbarch, h8300_store_return_value);
-  set_gdbarch_deprecated_extract_struct_value_address (gdbarch, h8300_extract_struct_value_address);
+  set_gdbarch_deprecated_push_return_address (gdbarch, 
+                                             h8300_push_return_address);
+  set_gdbarch_deprecated_extract_return_value (gdbarch, 
+                                              h8300_extract_return_value);
+  set_gdbarch_deprecated_push_arguments (gdbarch, h8300_push_arguments);
+  set_gdbarch_deprecated_pop_frame (gdbarch, h8300_pop_frame);
+  set_gdbarch_deprecated_store_struct_return (gdbarch, 
+                                             h8300_store_struct_return);
+  set_gdbarch_deprecated_store_return_value (gdbarch, 
+                                            h8300_store_return_value);
+  set_gdbarch_deprecated_extract_struct_value_address 
+    (gdbarch, h8300_extract_struct_value_address);
   set_gdbarch_use_struct_convention (gdbarch, h8300_use_struct_convention);
   set_gdbarch_use_struct_convention (gdbarch, h8300_use_struct_convention);
-  set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
-  set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
-  set_gdbarch_call_dummy_start_offset (gdbarch, 0);
-  set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
-  set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
-  set_gdbarch_call_dummy_length (gdbarch, 0);
-  set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy);
-  set_gdbarch_call_dummy_p (gdbarch, 1);
-  set_gdbarch_call_dummy_words (gdbarch, call_dummy_words);
-  set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
-  set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
-  /* set_gdbarch_call_dummy_stack_adjust */
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
+  set_gdbarch_deprecated_call_dummy_words (gdbarch, call_dummy_words);
+  set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, 0);
   set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc);
 
   set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
   set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc);
 
   set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
@@ -1157,15 +1193,17 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_addr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT);
 
   /* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */
   set_gdbarch_addr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT);
 
   /* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */
-  set_gdbarch_extra_stack_alignment_needed (gdbarch, 0);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
+  /* Should be using push_dummy_call.  */
+  set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
+
   return gdbarch;
 }
 
 void
 _initialize_h8300_tdep (void)
 {
   return gdbarch;
 }
 
 void
 _initialize_h8300_tdep (void)
 {
-  tm_print_insn = gdb_print_insn_h8300;
+  deprecated_tm_print_insn = gdb_print_insn_h8300;
   register_gdbarch_init (bfd_arch_h8300, h8300_gdbarch_init);
 }
   register_gdbarch_init (bfd_arch_h8300, h8300_gdbarch_init);
 }
This page took 0.032458 seconds and 4 git commands to generate.