This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/RFC 2] Remove hardware break and watchpoints at program exit.

At 10:20 09/01/2002 , vous avez écrit:

>On Wed, 9 Jan 2002, Pierre Muller wrote:
> > The patch simply calls i386_cleanup_dregs
> > in breakpoint_init_inferior if context is inf_exited.

  I finally change completely my patch to 
another (more correct, in my opinion) strategy.

   In breakpoint_init_inferior
I added code that conditionally removes hardware watch and breakpoint 
if the context is inf_exited, i.e. at exit of the debugged program.

  This leads to a much cleaner removal of the watchpoints.
I still kept the call to a generic hardware removal function
and testing the i386 case, I could see that even though the dr_mirror
array is zeored out, the dr_control_mirror and
dr_status_mirror still aren't set to zero.
For dr_control_register, this is due to an error in the I386_DR_DISABLE
because that macro only resets the active bit, but not the size and type bits 
associated to that debug register.

I suspect that before this patch,
the hardware watchpoint code that was in s390-nat.c
didn't reset the area_base to nil when a program was exited.
Could DJ Barrow please test this and see if the patch below does
fix this.
(I can't test this as I ave no acces to s390 machine,
but it appears to me that this might cause certain 
watchpoints to still show up after removal, if
the debuggee was run several times).
After the patch, probably no HARDWARE_REGISTER_RESET 
function is needed anymore, but I didn't inspect the code entirely.

I have a little doubt about the default value of the
What should be used as a no-op default ?

2002-01-09  Pierre Muller <>

         * breakpoint.c (REMOVE_HARDWARE_BREAKPOINT_AT_EXIT): 
         Define to 0 if not defined.
         Define to 0 if not defined.
         (HARDWARE_REGISTER_RESET): Default to no-op.
         (breakpoint_init_inferior): Use REMOVE_HARDWARE_BREAKPOINT_AT_EXIT
         and REMOVE_HARDWARE_WATCHPOINT_AT_EXIT to conditionally
         remove hardware break and watchpoints at exit.
         Call HARDWARE_REGISTER_RESET macro if defined at exit.

         * config/i386/nm-i386.h: Define HARDWARE_REGISTER_RESET
         macro to call i386_cleanup_dregs().

         * go32-nat.c (go32_mourn_inferior): Remove call to i386_cleanup_dregs
         as this is done in breakpoint_init_inferior().

Attachment: dregs.diffs
Description: Text document

Pierre Muller
Institut Charles Sadron
6,rue Boussingault
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]