Hardware watchpoint support for MIPS?

David Daney ddaney@avtrex.com
Thu Mar 20 20:57:00 GMT 2008


Paul Koning wrote:
>>>>>> "David" == David Daney <ddaney@avtrex.com> writes:
> 
>  David> Paul Koning wrote:
>  >>>>>>> "David" == David Daney <ddaney@avtrex.com> writes:
>  >>
>  David> GDB has had support for i386 debug registers on linux for
>  David> quite some time now.
>  >>
>  David> I was wondering if anyone has worked on similar support for
>  David> the hardware debug support available in some MIPS processors?
>  >>  Yes, I have it on MIPS/sb1.
>  >> 
> 
>  David> Great!
> 
>  David> Could you be more specific?  Like where are the kernel patches
>  David> to expose the debugs registers to ptrace and the gdb patches
>  David> to take advantage of them?
> 
> As Daniel pointed out, the kernel and ptrace changes are really the
> issue here.
> 
> We modified a NetBSD 1.6.2 kernel, adding watchpoint primitives to its
> gdb stub (for kernel debug) and also to its ptrace.  The ptrace stuff
> was a bit hairy because you have to context switch that state.  
> 
> I don't think I had to change gdb at all, except perhaps for setting
> the #define symbols to turn the feature on and describe its behavior
> correctly with respect to single stepping.
> 
> Well, there was a bug at least in the earlier 6.x gdb releases where
> the code to sort out breakpoints and watchpoints would come up with
> the wrong answer if you hit a watchpoint while a breakpoint was also
> active (even at some entirely different address).
> 
> And yes, the notion of watchpoint is in the MIPS architecture but the
> specifics vary among implementations.  I have seen several, and they
> are close enough that a single gdb talking the same remote protocol
> works with all of them, but the target end does change somewhat from
> one MIPS flavor to the next.
> 

OK, thanks.  I mistakenly thought that you already had it working on 
mips[el]-linux and I might just be able to drop it in (It's OK to dream 
isn't it?).

David Daney



More information about the Gdb mailing list