From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25681 invoked by alias); 13 Jun 2002 07:20:00 -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 25655 invoked from network); 13 Jun 2002 07:19:58 -0000 Received: from unknown (HELO isis.u-strasbg.fr) (130.79.200.1) by sources.redhat.com with SMTP; 13 Jun 2002 07:19:58 -0000 Received: from cerbere.u-strasbg.fr (cerbere.u-strasbg.fr [130.79.112.7]) by isis.u-strasbg.fr (8.12.3/jtpda-5.4) with ESMTP id g5D7JjpU091496 ; Thu, 13 Jun 2002 09:19:46 +0200 (CEST) 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 JAA22666; Thu, 13 Jun 2002 09:19:24 +0200 Message-Id: <4.2.0.58.20020613091046.01957c70@ics.u-strasbg.fr> X-Sender: muller@ics.u-strasbg.fr Date: Thu, 13 Jun 2002 00:20:00 -0000 To: gdb-patches@sources.redhat.com From: Pierre Muller Subject: Resend: [RFA] Fix problem with i386 watchpoints after restarting Cc: msnyder@redhat.com, jimb@redhat.com, ac131313@redhat.com, kettenis@gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-SW-Source: 2002-06/txt/msg00210.txt.bz2 I sent this message 9 days ago, but didn't get any answer, maybe the error was to forget to CC to breakpoint maintainers? So I added Michael Synder, Jim Blandy and Andrew Cagney, together with Mark Kettenis (as i386 target maintainer) on CC. <> After much efforts to find a reasonable solution for the bug that I already explained several times, I think that I found an easy solution. See http://sources.redhat.com/ml/gdb-patches/2001-11/msg00613.html and all related threads. In short, most i386 targets using the common hardware watchpoint code do not call i386_cleanup_dregs and this leads to big troubles because on a second run of a debugged program the watchpoint is not inserted correctly. This patch does call i386_cleanup_dregs for all i386 targets that define I386_USE_GENERIC_WATCHPOINTS by simply defining a custom child_post_startup_inferior function in the part of i386-nat.c code that depends on the I386_USE_GENERIC_WATCHPOINTS conditional. Only drawback of that is that this function does not seem to be multi-arch compatible, but does it make sense to have native code multi-arched? ChangeLog entry: 2002-06-04 Pierre Muller * i386-nat.c (child_post_startup_inferior): New function calling i386_cleanup_dregs if I386_USE_GENERIC_WATCHPOINTS is defined. * config/i386/nm-i386.h: define CHILD_POST_STARTUP_INFERIOR conditional to acknowledge that i386-nat.c has its own child_post_startup_inferior function. Index: i386-nat.c =================================================================== RCS file: /cvs/src/src/gdb/i386-nat.c,v retrieving revision 1.4 diff -u -p -r1.4 i386-nat.c --- i386-nat.c 21 Sep 2001 07:16:03 -0000 1.4 +++ i386-nat.c 4 Jun 2002 10:58:17 -0000 @@ -230,6 +230,12 @@ i386_cleanup_dregs (void) dr_status_mirror = 0; } +void +child_post_startup_inferior (ptid_t ptid) +{ + i386_cleanup_dregs (); +} + /* Print the values of the mirrored debug registers. This is called when maint_show_dr is non-zero. To set that up, type "maint show-debug-regs" at GDB's prompt. */ Index: config/i386/nm-i386.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-i386.h,v retrieving revision 1.2 diff -u -p -r1.2 nm-i386.h --- config/i386/nm-i386.h 23 Mar 2001 16:17:45 -0000 1.2 +++ config/i386/nm-i386.h 4 Jun 2002 10:58:18 -0000 @@ -30,6 +30,9 @@ #define TARGET_HAS_HARDWARE_WATCHPOINTS #endif +/* Use child_post_startup_inferior to reset all debug registers */ +#define CHILD_POST_STARTUP_INFERIOR + /* Clear the reference counts and forget everything we knew about DRi. */ extern void i386_cleanup_dregs (void); 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