luciano@canuck.Berkeley.EDU (Luciano Lavagno) (03/03/90)
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). I would like something similar to the VMS SET WATCH command... but I strongly suspect that the UNIX debugging paradigm inherently forbids such a feature. Thanks !
bogatko@lzga.ATT.COM (George Bogatko) (03/05/90)
At least System5.2 and beyond do watchpoints. From the manual: variable$m count address:m count Single step (as with s) until the specified location is modified with a new value. If count is omitted, it is effectively infinity. Variable must be accessible from the current procedure. Since this command is done by software, it can be very slow. GB
marc@stingray..austin.ibm.com (Marc J. Stephenson/140000;1C-22) (03/09/90)
In article <22567@pasteur.Berkeley.EDU> luciano@canuck.Berkeley.EDU (Luciano Lavagno) writes: > > >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). If a debugger has to perform this operation in software, then it will be extremely slow; if it has hardware assist, then it can be done reasonably quickly. If you are stuck doing with a software implementation, then you will be better off if you can narrow down the scope of the operation (trace expr at line, trace addr in procedure, etc...) to reduce the cost. If it's not possible to narrow the scope of the watch, then start it off and go get something to eat. Marc Stephenson (marc@stingray.austin.ibm.com) DISCLAIMER: The content of this posting is independent of official IBM position. External: uunet!cs.utexas.edu!ibmaus!auschs!stingray.austin.ibm.com!marc Internal: marc@stingray.austin.ibm.com VNET: MARC at AUSVM6 T/L: 793-3796
guy@auspex.auspex.com (Guy Harris) (03/09/90)
>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.
madd@world.std.com (jim frost) (03/09/90)
guy@auspex.auspex.com (Guy Harris) writes: >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. SunOS ptrace() for the Sun 386i supports this. Whether or not anyone actually makes use of it is another thing entirely.... jim frost saber software jimf@saber.com
meissner@osf.org (Michael Meissner) (03/10/90)
In article <3004@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes: | >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. If I remember correctly, Data General's DG/UX had it's xtrace system call which let the debugger map out the page, and get awoken when a page fault occured (the basic gist is to leave the page unmapped, and simulate the instruction the old slow way, and check the variable). I wonder if anybody on a real MACH system has modified the debugger to start the process with the external pager pointing to the debugger (under MACH user processes can handle page faults for other processes if granted permission). -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA Catproof is an oxymoron, Childproof is nearly so