After looking into function compute_return_epc(regs), we find that it can
just skip an instruction.
But the instruction that cause exceptions should not be skipped.
----- Original Message -----
From: "Kevin D. Kissell" <firstname.lastname@example.org>
To: "Nigel Stephens" <email@example.com>; "colin" <firstname.lastname@example.org>
Sent: Wednesday, March 29, 2006 10:32 PM
Subject: Re: Using hardware watchpoint for applications debugging
> > colin wrote:.
> > > 2. When an exception happens and we find that it's not touching
> > > address, we will discard it. However, exception will happen again
> > > the former instruction will be re-executed when the exception is
> > >
> > You'll need to single-step over the instruction which generated the
> > unwanted watchpoint exception, with the watchpoint disabled. Then after
> > handling the single step reenable the watchpoint and resume normal
> > execution.
> There's actually a simpler and more efficient approach in Linux. The code
> already exists in the MIPS Linux kernel to "skip" the instruction
> for the current exception, because the situation also arises for emulated
> instructions. In do_watch(), in the cases where you want to ignore the
> watchpoint, you should be able to just invoke compute_return_epc(regs)
> and return. There should be no need to handle single-step exceptions
> or disable/reenable the watchpoint.
> Kevin K.