linux-mips
[Top] [All Lists]

Re: Single stepping in mips

To: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Subject: Re: Single stepping in mips
From: Daniel Jacobowitz <dan@debian.org>
Date: Wed, 4 Jun 2003 10:25:48 -0400
Cc: Ralf Baechle <ralf@linux-mips.org>, "Krishnakumar. R" <krishnakumar@naturesoft.net>, linux-mips@linux-mips.org
In-reply-to: <Pine.GSO.3.96.1030604161038.18707C-100000@delta.ds2.pg.gda.pl>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20030604055319.GB8778@linux-mips.org> <Pine.GSO.3.96.1030604161038.18707C-100000@delta.ds2.pg.gda.pl>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.1i
On Wed, Jun 04, 2003 at 04:16:48PM +0200, Maciej W. Rozycki wrote:
> On Wed, 4 Jun 2003, Ralf Baechle wrote:
> 
> > > But the need is to raise an exception after instr1 (at addr1) is executed.
> > > One solution is using a break at instr2 (at addr2).
> > > But suppose instr1 is a jmp then there is no point
> > > in keeping a break at addr2.
> > > (inorder to raise an exception after instr1 is executed).
> > 
> > You understood correctly.  Now jumps and even more so the conditional
> > branches are sort of the ugly part of the whole thing.  The easiest
> > method is probably inserting a branch at the jump's destination address
> > or in case of a branch at the branch target and the instruction following
> > it's delay slot.  So that's a lot of inserting and removing of
> > breakpoints ...
> 
>  In a more finegrained but also more complicated example, you probably
> want to insert a breakpoint in the delay slot first and at the second step
> evaluate the branch's condition and put a breakpoint at the next
> instruction to be executed.  I'm not sure if the current version of gdb
> does the first step, but it inserts a single breakpoint in the second one
> only.  For branch likely instructions adjust the two steps as necessary. 

Does that actually work reliably across MIPS processors?  I don't
believe that it will.  I suppose you could re-execute the branch to get
the delay slot executed...

GDB simply executes the branch and its delay slot as a unit.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

<Prev in Thread] Current Thread [Next in Thread>