From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Kettenis To: Eli Zaretskii Cc: gdb@sources.redhat.com Subject: Re: [RFC] Unified watchpoints for x86 platforms Date: Tue, 27 Feb 2001 03:28:00 -0000 Message-id: References: <200009070855.EAA00749@albacore> <200009071500.LAA07756@indy.delorie.com> <200009081529.e88FTjx15960@debye.wins.uva.nl> <200102101533.KAA10417@indy.delorie.com> <200102151146.NAA28431@is.elta.co.il> <1010215184135.ZM8866@ocotillo.lan> <200102152125.QAA15548@indy.delorie.com> <5melwzd0qr.fsf@jtc.redback.com> <1010216000953.ZM9629@ocotillo.lan> <200102241814.NAA00148@indy.delorie.com> X-SW-Source: 2001-02/msg00407.html Eli Zaretskii writes: > While writing the code for the x86 watchpoint support, a question > popped up regarding the Global Enable and Local Enable flags in the > DR7 (Debug Control) register. > > For those who might not remember what those flags are: Each > hardware-assisted breakpoint or watchpoint should be enabled by > setting bits in the DR7 register. A watchpoint can be enabled locally > or globally, depending on which bit in DR7 is set for that watchpoint. > A watchpoint that is enabled locally will only break if it is hit in > the current task. A watchpoint that is enabled globally will break in > any task. Makes me wonder if global watchpoints would really work if hardware task switching isn't used. Anyway, I guess most x86 OS'es wouldn't allow any real global watchpoints. For Linux it doesn't matter whether you set the local or the global bit. > Now, I understand that, by and large, x86 platforms enable watchpoints > locally, to avoid spurious traps triggered by other processes. If > that is true, should the code I write use the Local Enable flag > unconditionally? Or perhaps it would be useful to define an API that > enables a target to control whether the global or local enable flag is > used? In principle a GDB command to control whether to enable watchpoints locally or globally wouldn't be a bad idea. But I don't know any targets where this would be useful. So if it isn't useful for DJGPP either, I wouldn't bother. A comment about the issue at the right spot would be nice though. Mark