From owner-freebsd-current Sun Jun 24 11:37:38 2001 Delivered-To: freebsd-current@freebsd.org Received: from saturn.bsdhome.com (unknown [24.25.2.193]) by hub.freebsd.org (Postfix) with ESMTP id 772D337B405; Sun, 24 Jun 2001 11:37:32 -0700 (PDT) (envelope-from bsd@bsdhome.com) Received: from neutrino.bsdhome.com (jupiter [192.168.220.13]) by saturn.bsdhome.com (8.11.3/8.11.3) with ESMTP id f5OIbVC06079; Sun, 24 Jun 2001 14:37:31 -0400 (EDT) Received: (from bsd@localhost) by neutrino.bsdhome.com (8.11.4/8.11.4) id f5OIbQS42821; Sun, 24 Jun 2001 14:37:26 -0400 (EDT) (envelope-from bsd) Date: Sun, 24 Jun 2001 14:37:26 -0400 From: Brian Dean 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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