This is the mail archive of the gdb-patches@sources.redhat.com 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]

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


> Date: Fri, 11 Jan 2002 13:00:44 +0100
> From: Pierre Muller <muller@cerbere.u-strasbg.fr>
> 
>    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.

Thanks.  I like this approach much better, especially because I never
understood why does GDB do certain cleanups when the debuggee exits,
but doesn't do other, similar cleanups.

> 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.

Why is this a problem?  Once the active bit is off, the corresponding
debug register is inactive, and its value is not important.

>          * breakpoint.c (REMOVE_HARDWARE_BREAKPOINT_AT_EXIT): 
>          Define to 0 if not defined.
>          (REMOVE_HARDWARE_WATCHPOINT_AT_EXIT): 
>          Define to 0 if not defined.

Why do we need these macros at all?  Why not remove the breakpoints
and watchpoints unconditionally?  Does anyone see any problem?

> --- go32-nat.c	2001/12/06 08:15:37	1.26
> +++ go32-nat.c	2002/01/11 11:34:08
> @@ -670,7 +670,7 @@ go32_mourn_inferior (void)
>       be nice if GDB itself would take care to remove all breakpoints
>       at all times, but it doesn't, probably under an assumption that
>       the OS cleans up when the debuggee exits.  */
> -  i386_cleanup_dregs ();
> +  // i386_cleanup_dregs ();

Please don't make such changes.  If you want to remove some code, just
remove it, don't comment it away: it looks ad-hoc and not clean.


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