Debugger watchpoints in UNIX ?

Guy Harris guy at auspex.auspex.com
Fri Mar 9 05:28:08 AEST 1990


>At least System5.2 and beyond do watchpoints.

Yes, but so does "dbx".  That wasn't what he was asking:

> Has anybody heard of an efficient implementation of watchpoints, i.e. 
> breakpoints activated whenever an arbitrary position in memory (e.g. a 
> field of a dynamically allocated structure) changes value ?
> Both dbx and saber can do something similar, but with horrendous 
> performance penalty ("stop address" commands).

and, since the "sdb" manual says:

>	       Since this command is done by software, it can be very slow.

that doesn't fit his criteria.  In fact, the "sdb" version is slow for
the same reason the "dbx" one is slow - they both basically single-step
the program and check the variable after each instruction.

The VMS scheme, to which he alluded, is to set the page containing the
variable non-writeable, and catch the protection faults (actually, it
may made it inaccessible, due to problems in, say, the 11/750's handling
of protection faults that prevents it from being able to restart the
instruction that faulted).  Current UNIX systems generally don't let you
do this.

Some processors (e.g., the 80386) have hardware to watch some (generally
small) number of locations; some debuggers on UNIX for those processors
may use them. 



More information about the Comp.unix.questions mailing list