From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7503 invoked by alias); 9 Jan 2002 09:13:58 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 7461 invoked from network); 9 Jan 2002 09:13:56 -0000 Received: from unknown (HELO cerbere.u-strasbg.fr) (130.79.112.7) by sources.redhat.com with SMTP; 9 Jan 2002 09:13:56 -0000 Received: from laocoon (laocoon.u-strasbg.fr [130.79.112.72]) by cerbere.u-strasbg.fr (8.9.3/8.8.7) with ESMTP id KAA18347 for ; Wed, 9 Jan 2002 10:13:55 +0100 Message-Id: <4.2.0.58.20020109091949.00a49380@ics.u-strasbg.fr> X-Sender: muller@ics.u-strasbg.fr X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58 Date: Wed, 09 Jan 2002 01:13:00 -0000 To: gdb-patches@sources.redhat.com From: Pierre Muller Subject: [RFA/RFC] Add i386_cleanup_dregs at program exit. Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-SW-Source: 2002-01/txt/msg00162.txt.bz2 A rather long thread started by my description of a failure to catch hardware watchpoints on the second run of a linux i386 executable when debugging with 5.1 version. See http://sources.redhat.com/ml/gdb-patches/2001-11/msg00613.html that contains a description of how to reproduce this bug. The following patch does fix the problem and has the further advantage of being multi-target, so it might well fix the same bug on FreeBSD for example (I didn't test if this bug is also present in FreeBSD). But it isn't multi-arch yet. The patch simply calls i386_cleanup_dregs in breakpoint_init_inferior if context is inf_exited. I have no idea if other processor might need a similar cleanup of debug registers, but if there are, simply setting the HARDWARE_REGISTER_CLEANUP macro should be enough. Andrew, how can this be multi-arched ?? Should I add something like #ifndef HARDWARE_REGISTER_CLEANUP_P #define HARDWARE_REGISTER_CLEANUP_P 0 #endif #ifndef HARDWARE_REGISTER_CLEANUP #define HARDWARE_REGISTER_CLEANUP {} #endif and replace the patch in breakpoint.c by if (HARDWARE_REGISTER_CLEANUP_P && (context == inf_exited)) HARDWARE_REGISTER_CLEANUP; This removes the #ifdef but full multi-arch probably will require to add two new fields to the gdbarch vector ? 2002-01-09 Pierre Muller * breakpoint.c (breakpoint_init_inferior): Call HARDWARE_REGISTER_CLEANUP macro if defined if context is inf_exited. * config/i386/nm-i386.h: Define HARDWARE_REGISTER_CLEANUP macro to call i386_cleanup_dregs(). Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.57 diff -u -r1.57 breakpoint.c --- breakpoint.c 2001/11/11 16:39:59 1.57 +++ breakpoint.c 2002/01/08 23:44:00 @@ -1487,6 +1487,10 @@ warning ("You must reinsert them explicitly."); warning_needed = 0; } +#ifdef HARDWARE_REGISTER_CLEANUP + if (context == inf_exited) + HARDWARE_REGISTER_CLEANUP; +#endif } /* breakpoint_here_p (PC) returns non-zero if an enabled breakpoint Index: config/i386/nm-i386.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-i386.h,v retrieving revision 1.2 diff -u -r1.2 nm-i386.h --- nm-i386.h 2001/03/23 16:17:45 1.2 +++ nm-i386.h 2002/01/08 23:44:01 @@ -115,6 +115,8 @@ #define DECR_PC_AFTER_HW_BREAK 0 +#define HARDWARE_REGISTER_CLEANUP i386_cleanup_dregs () + #endif /* I386_USE_GENERIC_WATCHPOINTS */ #endif /* NM_I386_H */ Pierre Muller Institut Charles Sadron 6,rue Boussingault F 67083 STRASBOURG CEDEX (France) mailto:muller@ics.u-strasbg.fr Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99