* Rename remote-es1800.c to remote-es.c
[deliverable/binutils-gdb.git] / gdb / sparc-tdep.c
index 3bafd6a420608dbe1f0605ac2a16be8b08334502..5799c4ee7356abdaa117e2105be29dc25ba1a688 100644 (file)
@@ -1,5 +1,5 @@
 /* Target-dependent code for the SPARC for GDB, the GNU debugger.
-   Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -24,10 +24,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "target.h"
 #include "ieee-float.h"
 
+#include "symfile.h" /* for objfiles.h */
+#include "objfiles.h" /* for find_pc_section */
+
 #ifdef USE_PROC_FS
 #include <sys/procfs.h>
-#else
-#include <sys/ptrace.h>
 #endif
 
 #include "gdbcore.h"
@@ -35,6 +36,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* From infrun.c */
 extern int stop_after_trap;
 
+/* We don't store all registers immediately when requested, since they
+   get sent over in large chunks anyway.  Instead, we accumulate most
+   of the changes and send them over once.  "deferred_stores" keeps
+   track of which sets of registers we have locally-changed copies of,
+   so we only need send the groups that have changed.  */
+
+int deferred_stores = 0;       /* Cumulates stores we want to do eventually. */
+
 typedef enum
 {
   Error, not_branch, bicc, bicca, ba, baa, ticc, ta
@@ -183,15 +192,21 @@ frame_saved_pc (frame)
  * difficulty. 
  */
 FRAME
-setup_arbitrary_frame (frame, stack)
-     FRAME_ADDR frame, stack;
+setup_arbitrary_frame (argc, argv)
+     int argc;
+     FRAME_ADDR *argv;
 {
-  FRAME fid = create_new_frame (frame, 0);
+  FRAME fid;
+
+  if (argc != 2)
+    error ("Sparc frame specifications require two arguments: fp and sp");
+
+  fid = create_new_frame (argv[0], 0);
 
   if (!fid)
     fatal ("internal: create_new_frame returned invalid frame id");
   
-  fid->bottom = stack;
+  fid->bottom = argv[1];
   fid->pc = FRAME_SAVED_PC (fid);
   return fid;
 }
@@ -220,14 +235,14 @@ setup_arbitrary_frame (frame, stack)
  * original contents of g1.  A * indicates that the actual value of
  * the instruction is modified below.
  */
-static int save_insn_opcodes[] = {
+static unsigned int save_insn_opcodes[] = {
   0x03000000, 0x82007ee0, 0x9de38001, 0x03000000,
   0x82007ee0, 0x91d02001, 0x01000000 };
 
 /* Neither do_save_insn or do_restore_insn save stack configuration
    (current_frame, etc),
    since the stack is in an indeterminate state through the call to
-   each of them.  That responsibility of the routine which calls them.  */
+   each of them.  That is the responsibility of the routine which calls them.  */
 
 static void
 do_save_insn (size)
@@ -271,7 +286,8 @@ do_save_insn (size)
        t %g0,1
        sethi %hi(0),%g0        */
 
-static int restore_insn_opcodes[] = { 0x81e80000, 0x91d02001, 0x01000000 };
+static unsigned int restore_insn_opcodes[] = {
+  0x81e80000, 0x91d02001, 0x01000000 };
 
 static void
 do_restore_insn ()
@@ -464,7 +480,7 @@ sparc_frame_find_saved_regs (fi, saved_regs_addr)
   if (!fid)
     fatal ("Bad frame info struct in FRAME_FIND_SAVED_REGS");
 
-  (void) memset (saved_regs_addr, 0, sizeof (*saved_regs_addr));
+  memset (saved_regs_addr, 0, sizeof (*saved_regs_addr));
 
   /* Old test.
   if (fi->pc >= frame - CALL_DUMMY_LENGTH - 0x140
@@ -692,13 +708,13 @@ void
 supply_gregset (gregsetp)
 prgregset_t *gregsetp;
 {
-  register int regno;
+  register int regi;
   register prgreg_t *regp = (prgreg_t *) gregsetp;
 
   /* GDB register numbers for Gn, On, Ln, In all match /proc reg numbers.  */
-  for (regno = G0_REGNUM ; regno <= I7_REGNUM ; regno++)
+  for (regi = G0_REGNUM ; regi <= I7_REGNUM ; regi++)
     {
-      supply_register (regno, (char *) (regp + regno));
+      supply_register (regi, (char *) (regp + regi));
     }
 
   /* These require a bit more care.  */
@@ -721,7 +737,7 @@ int regno;
     {
       if ((regno == -1) || (regno == regi))
        {
-         *(regp + regno) = *(int *) &registers[REGISTER_BYTE (regi)];
+         *(regp + regi) = *(int *) &registers[REGISTER_BYTE (regi)];
        }
     }
   if ((regno == -1) || (regno == PS_REGNUM))
@@ -784,7 +800,7 @@ int regno;
        {
          from = (char *) &registers[REGISTER_BYTE (regi)];
          to = (char *) &fpregsetp->pr_fr.pr_regs[regi-FP0_REGNUM];
-         bcopy (from, to, REGISTER_RAW_SIZE (regno));
+         memcpy (to, from, REGISTER_RAW_SIZE (regi));
        }
     }
   if ((regno == -1) || (regno == FPS_REGNUM))
@@ -823,3 +839,24 @@ get_longjmp_target(pc)
   return 1;
 }
 #endif /* GET_LONGJMP_TARGET */
+
+/* So far used only for sparc solaris.  In sparc solaris, we recognize
+   a trampoline by it's section name.  That is, if the pc is in a
+   section named ".plt" then we are in a trampline.  */
+
+int
+in_solib_trampoline(pc, name)
+     CORE_ADDR pc;
+     char *name;
+{
+  sec_ptr s;
+  int retval = 0;
+  
+  s = find_pc_section(pc);
+  
+  retval = (s != NULL
+           && s->sec_ptr->name != NULL
+           && STREQ (s->sec_ptr->name, ".plt"));
+  return(retval);
+}
+
This page took 0.024912 seconds and 4 git commands to generate.