aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/config/sparc/tm-sparc.h12
-rw-r--r--gdb/config/sparc/tm-sparclynx.h8
-rw-r--r--gdb/lynx-nat.c21
-rw-r--r--gdb/sparc-tdep.c5
5 files changed, 37 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 705b3bf..1e615d1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+Sat Jan 22 00:34:47 1994 Stu Grossman (grossman at cygnus.com)
+
+ * sparc-tdep.c, lynx-nat.c, config/sparc/tm-sparc.h,
+ config/sparc/tm-sparclynx.h: Move defs of FRAME_SAVED_I0/L0 to
+ tm-sparc.h so they can be overridden if necessary.
+
Fri Jan 21 17:49:28 1994 Stu Grossman (grossman at cygnus.com)
* lynx-nat.c: Add Sparc support.
diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h
index b71f7f2..69899b8 100644
--- a/gdb/config/sparc/tm-sparc.h
+++ b/gdb/config/sparc/tm-sparc.h
@@ -346,10 +346,18 @@ CORE_ADDR sparc_frame_chain ();
#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
(FRAMELESS) = frameless_look_for_prologue(FI)
+/* The location of I0 w.r.t SP. This is actually dependent on how the system's
+ window overflow/underflow routines are written. Most vendors save the L regs
+ followed by the I regs (at the higher address). Some vendors get it wrong.
+ */
+
+#define FRAME_SAVED_L0 0
+#define FRAME_SAVED_I0 (8 * REGISTER_RAW_SIZE (L0_REGNUM))
+
/* Where is the PC for a specific frame */
-#define FRAME_SAVED_PC(FRAME) frame_saved_pc (FRAME)
-CORE_ADDR frame_saved_pc ();
+#define FRAME_SAVED_PC(FRAME) sparc_frame_saved_pc (FRAME)
+CORE_ADDR sparc_frame_saved_pc ();
/* If the argument is on the stack, it will be here. */
#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
diff --git a/gdb/config/sparc/tm-sparclynx.h b/gdb/config/sparc/tm-sparclynx.h
index 525eeb4..8a0ea72 100644
--- a/gdb/config/sparc/tm-sparclynx.h
+++ b/gdb/config/sparc/tm-sparclynx.h
@@ -25,4 +25,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Use generic Sparc definitions. */
#include "sparc/tm-sparc.h"
+/* Lynx does this backwards from everybody else */
+
+#undef FRAME_SAVED_I0
+#undef FRAME_SAVED_L0
+
+#define FRAME_SAVED_I0 0
+#define FRAME_SAVED_L0 (8 * REGISTER_RAW_SIZE (I0_REGNUM))
+
#endif /* TM_SPARCLYNX_H */
diff --git a/gdb/lynx-nat.c b/gdb/lynx-nat.c
index 4510972..66e0d25 100644
--- a/gdb/lynx-nat.c
+++ b/gdb/lynx-nat.c
@@ -235,14 +235,14 @@ fetch_inferior_registers (regno)
sp = read_register (SP_REGNUM);
- target_xfer_memory (sp, &registers[REGISTER_BYTE(I0_REGNUM)],
+ target_xfer_memory (sp + FRAME_SAVED_I0,
+ &registers[REGISTER_BYTE(I0_REGNUM)],
8 * REGISTER_RAW_SIZE (I0_REGNUM), 0);
for (i = I0_REGNUM; i <= I7_REGNUM; i++)
register_valid[i] = 1;
- sp += 8 * REGISTER_RAW_SIZE (I0_REGNUM);
-
- target_xfer_memory (sp, &registers[REGISTER_BYTE(L0_REGNUM)],
+ target_xfer_memory (sp + FRAME_SAVED_L0,
+ &registers[REGISTER_BYTE(L0_REGNUM)],
8 * REGISTER_RAW_SIZE (L0_REGNUM), 0);
for (i = L0_REGNUM; i <= L0_REGNUM + 7; i++)
register_valid[i] = 1;
@@ -329,10 +329,12 @@ store_inferior_registers (regno)
{
if (!register_valid[L0_REGNUM+5])
abort();
- target_xfer_memory (sp, &registers[REGISTER_BYTE (I0_REGNUM)],
+ target_xfer_memory (sp + FRAME_SAVED_I0,
+ &registers[REGISTER_BYTE (I0_REGNUM)],
8 * REGISTER_RAW_SIZE (I0_REGNUM), 1);
- sp += 8 * REGISTER_RAW_SIZE (I0_REGNUM);
- target_xfer_memory (sp, &registers[REGISTER_BYTE (L0_REGNUM)],
+
+ target_xfer_memory (sp + FRAME_SAVED_L0,
+ &registers[REGISTER_BYTE (L0_REGNUM)],
8 * REGISTER_RAW_SIZE (L0_REGNUM), 1);
}
else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
@@ -341,9 +343,10 @@ store_inferior_registers (regno)
abort();
if (regno >= L0_REGNUM && regno <= L0_REGNUM + 7)
regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM)
- + 8 * REGISTER_RAW_SIZE (I0_REGNUM);
+ + FRAME_SAVED_L0;
else
- regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (I0_REGNUM);
+ regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (I0_REGNUM)
+ + FRAME_SAVED_I0;
target_xfer_memory (sp + regoffset, &registers[REGISTER_BYTE (regno)],
REGISTER_RAW_SIZE (regno), 1);
}
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index dc7b191..da7fd2c 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -131,9 +131,6 @@ single_step (ignore)
}
}
-#define FRAME_SAVED_L0 0 /* Byte offset from SP */
-#define FRAME_SAVED_I0 (8 * REGISTER_RAW_SIZE (0)) /* Byte offset from SP */
-
CORE_ADDR
sparc_frame_chain (thisframe)
FRAME thisframe;
@@ -161,7 +158,7 @@ sparc_extract_struct_value_address (regbuf)
/* Find the pc saved in frame FRAME. */
CORE_ADDR
-frame_saved_pc (frame)
+sparc_frame_saved_pc (frame)
FRAME frame;
{
char buf[MAX_REGISTER_RAW_SIZE];