From: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Add mips_software_single_step
Date: Thu, 05 Jul 2001 16:10:00 -0000 [thread overview]
Message-ID: <20010705161039.A15664@nevyn.them.org> (raw)
In-Reply-To: <3B44EF32.8010009@cygnus.com>
On Thu, Jul 05, 2001 at 06:50:26PM -0400, Andrew Cagney wrote:
> > On Thu, Jul 05, 2001 at 05:50:14PM -0400, Andrew Cagney wrote:
> >
> >> > This function's pretty straightforward; the Linux port uses it. Ok to
> >> > commit?
> >
> >>
> >>
> >> How does the linux port use it? As a tweek to the multi-arch vector or
> >> as a macro/function? If the former then it should be static, if the
> >> latter than a declaration in mips-tdep.h or tm-mips.h (?) is needed.
> >
> >
> > As a macro:
> >
> > #define SOFTWARE_SINGLE_STEP_P() 1
> > extern void mips_software_single_step (unsigned int, int);
> > #define SOFTWARE_SINGLE_STEP(sig,bp_p) mips_software_single_step (sig, bp_p)
>
>
> The macro definition appearing in config/mips/tm-linux.h but the
> function declaration appearing in config/mips/tm-mips.h? The function
> declaration is in tm-mips.h so that mips-tdep.c always sees it.
Right. My source right now has the declaration in tm-linux.h, but
tm-mips.h is more appropriate; I'll move it before I commit.
> > I'm sensing that this belongs in the multi-arch vector, though. I'll
> > change that.
>
>
> For the moment the above is ok.
OK, then. Is the style-corrected version below OK?
> We're getting into the relm of theory :-) No one has so far tried to do
> this. (Well, ok I think Eli is setting himself up for the challenge on
> IRIX.)
I guess I'll revisit this along with Eli once I get the port settled in
some basic state, then.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
2001-07-04 Daniel Jacobowitz <drow@mvista.com>
* mips-tdep.c (mips_software_single_step): New function.
* config/mips/tm-mips.h: Add prototype for
mips_software_single_step.
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.20
diff -u -r1.20 tm-mips.h
--- tm-mips.h 2001/06/15 23:10:55 1.20
+++ tm-mips.h 2001/07/05 23:00:08
@@ -502,3 +502,6 @@
/* MIPS sign extends addresses */
#define POINTER_TO_ADDRESS(TYPE,BUF) (signed_pointer_to_address (TYPE, BUF))
#define ADDRESS_TO_POINTER(TYPE,BUF,ADDR) (address_to_signed_pointer (TYPE, BUF, ADDR))
+
+/* Single step based on where the current instruction will take us. */
+extern void mips_software_single_step (enum target_signal, int);
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.54
diff -u -r1.54 mips-tdep.c
--- mips-tdep.c 2001/06/16 20:00:24 1.54
+++ mips-tdep.c 2001/07/05 23:00:09
@@ -1379,6 +1392,33 @@
return addr;
}
+/* mips_software_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 (MIPS on Linux for example). We find
+ the target of the coming instruction and breakpoint it.
+
+ single_step is also called just after the inferior stops. If we had
+ set up a simulated single-step, we undo our damage. */
+
+void
+mips_software_single_step (enum target_signal sig, int insert_breakpoints_p)
+{
+ static CORE_ADDR next_pc;
+ typedef char binsn_quantum[BREAKPOINT_MAX];
+ static binsn_quantum break_mem;
+ CORE_ADDR pc;
+
+ if (insert_breakpoints_p)
+ {
+ pc = read_register (PC_REGNUM);
+ next_pc = mips_next_pc (pc);
+
+ target_insert_breakpoint (next_pc, break_mem);
+ }
+ else
+ target_remove_breakpoint (next_pc, break_mem);
+}
+
static void
mips_init_frame_pc_first (int fromleaf, struct frame_info *prev)
{
next prev parent reply other threads:[~2001-07-05 16:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-04 11:56 Daniel Jacobowitz
2001-07-05 14:50 ` Andrew Cagney
2001-07-05 15:05 ` Daniel Jacobowitz
2001-07-05 15:50 ` Andrew Cagney
2001-07-05 16:10 ` Daniel Jacobowitz [this message]
2001-07-05 16:24 ` Andrew Cagney
2001-07-05 16:31 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010705161039.A15664@nevyn.them.org \
--to=dmj+@andrew.cmu.edu \
--cc=ac131313@cygnus.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox