* stabsread.c (get_substring): Declare second arg as int.
[deliverable/binutils-gdb.git] / gdb / rs6000-tdep.c
index 30702c62cee1c7493aad0f2105b607bef44c69c0..e89390af4389358931daa300e8a14094abba6fd9 100644 (file)
@@ -1,5 +1,5 @@
 /* Target-dependent code for GDB, the GNU debugger.
-   Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995
+   Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996
    Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -54,6 +54,8 @@ static CORE_ADDR branch_dest PARAMS ((int opcode, int instr, CORE_ADDR pc,
 static void frame_get_cache_fsr PARAMS ((struct frame_info *fi,
                                         struct rs6000_framedata *fdatap));
 
+static void pop_dummy_frame PARAMS ((void));
+
 /* Calculate the destination of a branch/jump.  Return -1 if not a branch.  */
 
 static CORE_ADDR
@@ -63,7 +65,6 @@ branch_dest (opcode, instr, pc, safety)
      CORE_ADDR pc;
      CORE_ADDR safety;
 {
-  register long offset;
   CORE_ADDR dest;
   int immediate;
   int absolute;
@@ -118,7 +119,7 @@ branch_dest (opcode, instr, pc, safety)
 
 void
 single_step (signal)
-     int signal;
+     enum target_signal signal;
 {
 #define        INSNLEN(OPCODE)  4
 
@@ -339,9 +340,9 @@ skip_prologue (pc, fdata)
 
       /* store parameters in stack via frame pointer */
       } else if (framep &&
-                (op & 0xfc1f0000) == 0x901f0000 ||     /* st rx,NUM(r1) */
+                ((op & 0xfc1f0000) == 0x901f0000 ||    /* st rx,NUM(r1) */
                 (op & 0xfc1f0000) == 0xd81f0000 ||     /* stfd Rx,NUM(r1) */
-                (op & 0xfc1f0000) == 0xfc1f0000) {     /* frsp, fp?,NUM(r1) */
+                (op & 0xfc1f0000) == 0xfc1f0000)) {    /* frsp, fp?,NUM(r1) */
        continue;
 
       /* Set up frame pointer */
@@ -534,6 +535,7 @@ saved SP register!  There should *not* be a separate stack in the
 GDB process that keeps track of these dummy frames!  -- gnu@cygnus.com Aug92
  */
    
+static void
 pop_dummy_frame ()
 {
   CORE_ADDR sp, pc;
@@ -690,14 +692,16 @@ push_arguments (nargs, args, sp, struct_return, struct_addr)
      int struct_return;
      CORE_ADDR struct_addr;
 {
-  int ii, len;
+  int ii;
+  int len = 0;
   int argno;                                   /* current argument number */
   int argbytes;                                        /* current argument byte */
   char tmp_buffer [50];
-  value_ptr arg;
   int f_argno = 0;                             /* current floating point argno */
+  value_ptr arg = 0;
+  struct type *type;
 
-  CORE_ADDR saved_sp, pc;
+  CORE_ADDR saved_sp;
 
   if ( dummy_frame_count <= 0)
     printf_unfiltered ("FATAL ERROR -push_arguments()! frame not found!!\n");
@@ -715,9 +719,10 @@ push_arguments (nargs, args, sp, struct_return, struct_addr)
   for (argno=0, argbytes=0; argno < nargs && ii<8; ++ii) {
 
     arg = args[argno];
-    len = TYPE_LENGTH (VALUE_TYPE (arg));
+    type = check_typedef (VALUE_TYPE (arg));
+    len = TYPE_LENGTH (type);
 
-    if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FLT) {
+    if (TYPE_CODE (type) == TYPE_CODE_FLT) {
 
       /* floating point arguments are passed in fpr's, as well as gpr's.
          There are 13 fpr's reserved for passing parameters. At this point
@@ -769,7 +774,6 @@ ran_out_of_registers_for_arguments:
 
   if ((argno < nargs) || argbytes) {
     int space = 0, jj;
-    value_ptr val;
 
     if (argbytes) {
       space += ((len - argbytes + 3) & -4);
@@ -779,7 +783,7 @@ ran_out_of_registers_for_arguments:
       jj = argno;
 
     for (; jj < nargs; ++jj) {
-      val = args[jj];
+      value_ptr val = args[jj];
       space += ((TYPE_LENGTH (VALUE_TYPE (val))) + 3) & -4;
     }
 
@@ -808,11 +812,12 @@ ran_out_of_registers_for_arguments:
     for (; argno < nargs; ++argno) {
 
       arg = args[argno];
-      len = TYPE_LENGTH (VALUE_TYPE (arg));
+      type = check_typedef (VALUE_TYPE (arg));
+      len = TYPE_LENGTH (type);
 
 
       /* float types should be passed in fpr's, as well as in the stack. */
-      if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FLT && f_argno < 13) {
+      if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13) {
 
         if (len > 8)
           printf_unfiltered (
@@ -966,7 +971,6 @@ frame_saved_pc (fi)
 {
   CORE_ADDR func_start;
   struct rs6000_framedata fdata;
-  int frameless;
 
   if (fi->signal_handler_caller)
     return read_memory_integer (fi->frame + SIG_FRAME_PC_OFFSET, 4);
@@ -1167,6 +1171,7 @@ xcoff_init_loadinfo ()
 
 
 /* FIXME -- this is never called!  */
+#if 0
 void
 free_loadinfo ()
 {
@@ -1177,6 +1182,7 @@ free_loadinfo ()
   loadinfotocindex = 0;
   loadinfotextindex = 0;
 }
+#endif
 
 /* this is called from xcoffread.c */
 
@@ -1266,6 +1272,22 @@ gdb_print_insn_powerpc (memaddr, info)
 void
 _initialize_rs6000_tdep ()
 {
+#ifndef ELF_OBJECT_FORMAT
+  {
+    extern void (*xcoff_add_toc_to_loadinfo_hook) PARAMS ((unsigned long));
+    extern void (*xcoff_init_loadinfo_hook) PARAMS ((void));
+
+    /* Initialize hook in xcoffread for recording the toc offset value
+       of a symbol table into the ldinfo structure, for native rs6000
+       config. */
+    xcoff_add_toc_to_loadinfo_hook = &xcoff_add_toc_to_loadinfo;
+
+    /* Initialize hook in xcoffread for calling xcoff_init_loadinfo in
+       a native rs6000 config. */
+    xcoff_init_loadinfo_hook = &xcoff_init_loadinfo;
+  }
+#endif /* ELF_OBJECT_FORMAT */
+
   /* FIXME, this should not be decided via ifdef. */
 #ifdef GDB_TARGET_POWERPC
   tm_print_insn = gdb_print_insn_powerpc;
This page took 0.025414 seconds and 4 git commands to generate.