aboutsummaryrefslogtreecommitdiff
path: root/gdb/sparc-tdep.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-05-30 08:52:52 +0000
committerJohn Gilmore <gnu@cygnus>1991-05-30 08:52:52 +0000
commitd11c44f1ee9650339d5c874d3227611f82e3f104 (patch)
tree23487e3405f8e4c1202d95d6c3e3fa4fe67ac2fb /gdb/sparc-tdep.c
parent924bbb3815705cba6e369cbea2dff86884e9265a (diff)
downloadgdb-d11c44f1ee9650339d5c874d3227611f82e3f104.zip
gdb-d11c44f1ee9650339d5c874d3227611f82e3f104.tar.gz
gdb-d11c44f1ee9650339d5c874d3227611f82e3f104.tar.bz2
Roll in Tiemann changes for gcc -ansi. Fix assorted bugs. See ChangeLog.
Diffstat (limited to 'gdb/sparc-tdep.c')
-rw-r--r--gdb/sparc-tdep.c58
1 files changed, 39 insertions, 19 deletions
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 5118fc3..a59986d 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -29,19 +29,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "target.h"
#include "ieee-float.h"
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <sys/user.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-
#include <sys/ptrace.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/core.h>
-
#include "gdbcore.h"
/* From infrun.c */
@@ -69,9 +58,16 @@ static binsn_quantum break_mem[3];
int one_stepped;
+/* single_step() is called just before we want to resume the inferior,
+ if we want to single-step it but there is no hardware or kernel single-step
+ support (as on all SPARCs). We find all the possible targets of the
+ coming instruction and breakpoint them.
+
+ single_step is also called just after the inferior stops. If we had
+ set up a simulated single-step, we undo our damage. */
+
void
-single_step (signal)
- int signal;
+single_step ()
{
branch_type br, isannulled();
CORE_ADDR pc;
@@ -107,8 +103,7 @@ single_step (signal)
target_insert_breakpoint (target, break_mem[2]);
}
- /* Let it go */
- ptrace (7, inferior_pid, 1, signal);
+ /* We are ready to let it go */
one_stepped = 1;
return;
}
@@ -127,6 +122,28 @@ single_step (signal)
}
}
+CORE_ADDR
+sparc_frame_chain (thisframe)
+ FRAME thisframe;
+{
+ CORE_ADDR retval;
+ read_memory ((CORE_ADDR)&(((struct rwindow *)(thisframe->frame))->rw_in[6]),
+ &retval,
+ sizeof (CORE_ADDR));
+ return retval;
+}
+
+CORE_ADDR
+sparc_extract_struct_value_address (regbuf)
+ char regbuf[REGISTER_BYTES];
+{
+ CORE_ADDR retval;
+ read_memory (((int *)(regbuf))[SP_REGNUM]+(16*4),
+ &retval,
+ sizeof (CORE_ADDR));
+ return retval;
+}
+
/*
* Find the pc saved in frame FRAME.
*/
@@ -138,11 +155,14 @@ frame_saved_pc (frame)
/* If it's at the bottom, the return value's stored in i7/rp */
if (get_current_frame () == frame)
- prev_pc = GET_RWINDOW_REG (read_register (SP_REGNUM), rw_in[7]);
+ read_memory ((CORE_ADDR)&((struct rwindow *)
+ (read_register (SP_REGNUM)))->rw_in[7],
+ &prev_pc, sizeof (CORE_ADDR));
else
- /* Wouldn't this always work? This would allow this routine to
- be completely a macro. */
- prev_pc = GET_RWINDOW_REG (frame->bottom, rw_in[7]);
+ /* Wouldn't this always work? */
+ read_memory ((CORE_ADDR)&((struct rwindow *)(frame->bottom))->rw_in[7],
+ &prev_pc,
+ sizeof (CORE_ADDR));
return PC_ADJUST (prev_pc);
}