Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jun 2001 14:37:26 -0400
From:      Brian Dean <bsd@bsdhome.com>
To:        freebsd-arch@freebsd.org
Cc:        freebsd-current@freebsd.org
Subject:   patch for using hardware debug registers for kernel debugging
Message-ID:  <20010624143726.B41098@neutrino.bsdhome.com>

next in thread | raw e-mail | index | archive | help
Hi,

I've worked up a simple patch to allow the use of the hardware debug
registers within the kernel debugger.  Support is very rudimentary at
this stage: you have to set the actual register values yourself.  I've
included a handy little program to help with that, though.
  
This patch will allow you to set a hardware watchpoint to watch up to
16 bytes of data (up to 4 watchpoints of up to 4 bytes each) and
generate a debug trap when that data is read or written (depends on
the type of the watchpoint specified, "wo", or "rw").

If you suspect a memory overwrite bug and know the address being
overwritten, using these registers can find it for you fast.  While
the watch is in effect, unlike with a software watch point, the CPU
runs at full speed.  This is the primary benefit of the hardware debug
support and can make debug sessions take only minutes that otherwise
literally take days.
  
An execution breakpoint may also be specified (type "ex"), but this is
probably only useful if you are debugging code in ROM.
  
Please see:
  
        http://people.freebsd.org/~bsd/ddb/
  
Please review and comment.  This support, while very low level at this
point, but can be real handy.
  
-Brian
--
Brian Dean
bsd@FreeBSD.org
bsd@bsdhome.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010624143726.B41098>