2005-02-11 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / sh64-tdep.c
index ac080ac767e4decd05954ee77d3a262ff928bf58..16520974375074ca0a91fb0bbb3d2311a7d118fe 100644 (file)
@@ -1,6 +1,7 @@
 /* Target-dependent code for Renesas Super-H, for GDB.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   Free Software Foundation, Inc.
+
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+   2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -27,7 +28,7 @@
 #include "defs.h"
 #include "frame.h"
 #include "symtab.h"
-#include "symfile.h"
+#include "objfiles.h"
 #include "gdbtypes.h"
 #include "gdbcmd.h"
 #include "gdbcore.h"
@@ -735,12 +736,9 @@ translate_insn_rn (int rn, int media_mode)
 static CORE_ADDR
 sh64_frame_chain (struct frame_info *frame)
 {
-  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
-                                  get_frame_base (frame),
-                                  get_frame_base (frame)))
+  if (deprecated_pc_in_call_dummy (get_frame_pc (frame)))
     return get_frame_base (frame);    /* dummy frame same as caller's frame */
-  if (get_frame_pc (frame)
-      && !deprecated_inside_entry_file (get_frame_pc (frame)))
+  if (get_frame_pc (frame))
     {
       int media_mode = pc_is_isa32 (get_frame_pc (frame));
       int size;
@@ -764,8 +762,7 @@ sh64_get_saved_pr (struct frame_info *fi, int pr_regnum)
   int media_mode = 0;
 
   for (; fi; fi = get_next_frame (fi))
-    if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
-                                    get_frame_base (fi)))
+    if (deprecated_pc_in_call_dummy (get_frame_pc (fi)))
       /* When the caller requests PR from the dummy frame, we return
          PC because that's where the previous routine appears to have
          done a call from.  */
@@ -830,12 +827,6 @@ is_media_pseudo (int rn)
   return (rn >= DR0_REGNUM && rn <= FV_LAST_REGNUM);
 }
 
-static int
-sh64_get_gdb_regnum (int gcc_regnum, CORE_ADDR pc)
-{
-  return translate_insn_rn (gcc_regnum, pc_is_isa32 (pc));
-}
-
 static int
 sh64_media_reg_base_num (int reg_nr)
 {
@@ -1220,8 +1211,7 @@ sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi)
   if (get_next_frame (fi)) 
     deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
 
-  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
-                                  get_frame_base (fi)))
+  if (deprecated_pc_in_call_dummy (get_frame_pc (fi)))
     {
       /* We need to setup fi->frame here because call_function_by_hand
          gets it wrong by assuming it's always FP.  */
@@ -1229,7 +1219,7 @@ sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi)
       get_frame_extra_info (fi)->return_pc = 
        deprecated_read_register_dummy (get_frame_pc (fi),
                                        get_frame_base (fi), PC_REGNUM);
-      get_frame_extra_info (fi)->f_offset = -(DEPRECATED_CALL_DUMMY_LENGTH + 4);
+      get_frame_extra_info (fi)->f_offset = -4;
       get_frame_extra_info (fi)->leaf_function = 0;
       return;
     }
@@ -1278,9 +1268,7 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
 
   while (frame && ((frame = get_next_frame (frame)) != NULL))
     {
-      if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
-                                      get_frame_base (frame),
-                                      get_frame_base (frame)))
+      if (deprecated_pc_in_call_dummy (get_frame_pc (frame)))
        {
          if (lval)             /* found it in a CALL_DUMMY frame */
            *lval = not_lval;
@@ -1347,11 +1335,14 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
 }
 
 static CORE_ADDR
-sh64_extract_struct_value_address (char *regbuf)
+sh64_extract_struct_value_address (struct regcache *regcache)
 {
-  return (extract_unsigned_integer ((regbuf + DEPRECATED_REGISTER_BYTE (STRUCT_RETURN_REGNUM)), 
-                                   register_size (current_gdbarch, 
-                                                  STRUCT_RETURN_REGNUM)));
+  /* FIXME: cagney/2004-01-17: Does the ABI guarantee that the return
+     address regster is preserved across function calls?  Probably
+     not, making this function wrong.  */
+  ULONGEST val;
+  regcache_raw_read_unsigned (regcache, STRUCT_RETURN_REGNUM, &val);
+  return val;
 }
 
 static CORE_ADDR
@@ -1372,10 +1363,8 @@ sh64_pop_frame (void)
 
   int media_mode = pc_is_isa32 (get_frame_pc (frame));
 
-  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
-                                  get_frame_base (frame),
-                                  get_frame_base (frame)))
-    generic_pop_dummy_frame ();
+  if (deprecated_pc_in_call_dummy (get_frame_pc (frame)))
+    deprecated_pop_dummy_frame ();
   else
     {
       fp = get_frame_base (frame);
@@ -1505,7 +1494,7 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
 
   /* Now make sure there's space on the stack */
   for (argnum = 0, stack_alloc = 0; argnum < nargs; argnum++)
-    stack_alloc += ((TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 7) & ~7);
+    stack_alloc += ((TYPE_LENGTH (value_type (args[argnum])) + 7) & ~7);
   sp -= stack_alloc;           /* make room on stack for args */
 
   /* Now load as many as possible of the first arguments into
@@ -1518,7 +1507,7 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
 
   for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++)
     {
-      type = VALUE_TYPE (args[argnum]);
+      type = value_type (args[argnum]);
       len = TYPE_LENGTH (type);
       memset (valbuf, 0, sizeof (valbuf));
       
@@ -1531,14 +1520,14 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
              /* value gets right-justified in the register or stack word */
              if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
                memcpy (valbuf + argreg_size - len,
-                       (char *) VALUE_CONTENTS (args[argnum]), len);
+                       (char *) value_contents (args[argnum]), len);
              else
-               memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len);
+               memcpy (valbuf, (char *) value_contents (args[argnum]), len);
 
              val = valbuf;
            }
          else
-           val = (char *) VALUE_CONTENTS (args[argnum]);
+           val = (char *) value_contents (args[argnum]);
 
          while (len > 0)
            {
@@ -1568,7 +1557,7 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
        }
       else
        {
-         val = (char *) VALUE_CONTENTS (args[argnum]);
+         val = (char *) value_contents (args[argnum]);
          if (len == 4)
            {
              /* Where is it going to be stored? */
@@ -2549,7 +2538,7 @@ sh_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum)
   raw_buffer = (char *) alloca (register_size (gdbarch, FP0_REGNUM));
 
   /* Get the data in raw format.  */
-  if (!frame_register_read (get_selected_frame (), regnum, raw_buffer))
+  if (!frame_register_read (get_selected_frame (NULL), regnum, raw_buffer))
     error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
 
   /* Get the register as a number */ 
@@ -2585,7 +2574,7 @@ sh64_do_pseudo_register (int regnum)
   if (regnum < NUM_REGS 
       || regnum >= NUM_REGS + NUM_PSEUDO_REGS_SH_MEDIA + NUM_PSEUDO_REGS_SH_COMPACT)
     internal_error (__FILE__, __LINE__,
-                   "Invalid pseudo register number %d\n", regnum);
+                   _("Invalid pseudo register number %d\n"), regnum);
 
   else if ((regnum >= DR0_REGNUM
            && regnum <= DR_LAST_REGNUM))
@@ -2629,7 +2618,7 @@ sh_do_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum)
   print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), file);
 
   /* Get the data in raw format.  */
-  if (!frame_register_read (get_selected_frame (), regnum, raw_buffer))
+  if (!frame_register_read (get_selected_frame (NULL), regnum, raw_buffer))
     fprintf_filtered (file, "*value not available*\n");
       
   val_print (gdbarch_register_type (gdbarch, regnum), raw_buffer, 0, 0,
@@ -2645,7 +2634,7 @@ sh_print_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum)
 {
   if (regnum < 0 || regnum >= NUM_REGS + NUM_PSEUDO_REGS)
     internal_error (__FILE__, __LINE__,
-                   "Invalid register number %d\n", regnum);
+                   _("Invalid register number %d\n"), regnum);
 
   else if (regnum >= 0 && regnum < NUM_REGS)
     {
@@ -2747,8 +2736,6 @@ sh64_do_registers_info (int regnum, int fpregs)
    sh_compact_do_registers_info (regnum, fpregs);
 }
 
-#ifdef SVR4_SHARED_LIBS
-
 /* Fetch (and possibly build) an appropriate link_map_offsets structure
    for native i386 linux targets using the struct offsets defined in
    link.h (but without actual reference to that file).
@@ -2789,14 +2776,12 @@ sh_linux_svr4_fetch_link_map_offsets (void)
 
     return lmp;
 }
-#endif /* SVR4_SHARED_LIBS */
 
 gdbarch_init_ftype sh64_gdbarch_init;
 
 struct gdbarch *
 sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
-  static LONGEST sh64_call_dummy_words[] = {0};
   struct gdbarch *gdbarch;
   struct gdbarch_tdep *tdep;
 
@@ -2848,11 +2833,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
-  set_gdbarch_decr_pc_after_break (gdbarch, 0);
-  set_gdbarch_function_start_offset (gdbarch, 0);
 
-  set_gdbarch_frame_args_skip (gdbarch, 0);
-  set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
   set_gdbarch_deprecated_frame_saved_pc (gdbarch, sh_frame_saved_pc);
@@ -2866,9 +2847,6 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* The number of real registers is the same whether we are in 
      ISA16(compact) or ISA32(media).  */
   set_gdbarch_num_regs (gdbarch, SIM_SH64_NR_REGS);
-  set_gdbarch_deprecated_register_bytes (gdbarch,
-                                        ((SIM_SH64_NR_FP_REGS + 1) * 4)
-                                        + (SIM_SH64_NR_REGS - SIM_SH64_NR_FP_REGS -1) * 8);
 
   set_gdbarch_register_name (gdbarch, sh64_register_name);
   set_gdbarch_register_type (gdbarch, sh64_register_type);
@@ -2880,8 +2858,6 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_deprecated_do_registers_info (gdbarch, sh64_do_registers_info);
   set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs);
   set_gdbarch_breakpoint_from_pc (gdbarch, sh64_breakpoint_from_pc);
-  set_gdbarch_deprecated_call_dummy_words (gdbarch, sh64_call_dummy_words);
-  set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (sh64_call_dummy_words));
 
   set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info);
   set_gdbarch_deprecated_frame_chain (gdbarch, sh64_frame_chain);
@@ -2892,7 +2868,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
   set_gdbarch_deprecated_store_struct_return (gdbarch, sh64_store_struct_return);
   set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address);
-  set_gdbarch_use_struct_convention (gdbarch, sh64_use_struct_convention);
+  set_gdbarch_deprecated_use_struct_convention (gdbarch, sh64_use_struct_convention);
   set_gdbarch_deprecated_pop_frame (gdbarch, sh64_pop_frame);
   set_gdbarch_elf_make_msymbol_special (gdbarch,
                                        sh64_elf_make_msymbol_special);
This page took 0.027936 seconds and 4 git commands to generate.