Debug registers on FreeBSD

John Baldwin jhb at freebsd.org
Thu Feb 18 15:24:05 UTC 2010


On Thursday 18 February 2010 10:12:39 am Kostik Belousov wrote:
> On Thu, Feb 18, 2010 at 09:44:24AM -0500, John Baldwin wrote:
> > On Wednesday 17 February 2010 11:07:36 pm Anderson Eduardo wrote:
> > > 
> > > Hello Folks,
> > > 
> > > First, I'm starting in the world of the debugging FreeBSD Kernel and, I 
> > don't know to use kgdb and ddb properly and, I need set breakpoints using 
> > debug register. Those breakpoints in the all tasks.
> > 
> > This last might be tricky to accomplish because cpu_switch() will swap out
> > the debug registers if a thread is using them.  However, you can easily
> > manage hardware breakpoints from ddb using the 'hwatch' command.  It is 
> > documented in ddb(4).  kgdb doesn't support setting hardware watch points
> > it seems.  Note that you can try to use 'db_md_set_watchpoint()' from your
> > kernel module (with DDB compiled into your kernel) if you want to set the
> > address progammatically rather than via the 'hwatch' command in ddb.
> 
> I remember that ddb only sets %dr on the CPU it happens to execute.

Yes, same with the db_md_* callbacks.

-- 
John Baldwin


More information about the freebsd-hackers mailing list