From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29043 invoked by alias); 6 Dec 2010 12:51:12 -0000 Received: (qmail 29022 invoked by uid 22791); 6 Dec 2010 12:51:11 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Dec 2010 12:51:04 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id oB6Cokh8027935; Mon, 6 Dec 2010 13:50:46 +0100 (CET) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id oB6Coi38017384; Mon, 6 Dec 2010 13:50:44 +0100 (CET) Date: Mon, 06 Dec 2010 12:51:00 -0000 Message-Id: <201012061250.oB6Coi38017384@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: jan.kratochvil@redhat.com CC: gdb-patches@sourceware.org In-reply-to: <20101206111206.GB27176@host0.dyn.jankratochvil.net> (message from Jan Kratochvil on Mon, 6 Dec 2010 12:12:07 +0100) Subject: Re: [patch 1/4] hw watchpoints code cleanups References: <20101206111206.GB27176@host0.dyn.jankratochvil.net> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-12/txt/msg00046.txt.bz2 > Date: Mon, 6 Dec 2010 12:12:07 +0100 > From: Jan Kratochvil > > Hi, > > this is just some mechanical moving of code around to make the real code > changes later better visible. > > static void > amd64_linux_dr_set_control (unsigned long control) > { > - struct lwp_info *lp; > - ptid_t ptid; > - > amd64_linux_dr[DR_CONTROL] = control; > - ALL_LWPS (lp, ptid) > - amd64_linux_dr_set (ptid, DR_CONTROL, control); > + > + iterate_over_lwps (minus_one_ptid, amd64_linux_dr_set_control_callback, > + (void *) control); It really is bad style to assume you can cast an integer to (void *), even if you know the pointer has the same width as the integer. If you really want to go that route, pass &control, and adjust amd64_linux_dr_set_control_callback accordingly. There are morecases like this in this diff. Please fix them all. > --- a/gdb/i386-nat.c > +++ b/gdb/i386-nat.c > @@ -25,6 +25,7 @@ > #include "gdbcmd.h" > #include "target.h" > #include "gdb_assert.h" > +#include "inferior.h" > > /* Support for hardware watchpoints and breakpoints using the i386 > debug registers. > @@ -104,6 +105,19 @@ struct i386_dr_low_type i386_dr_low; > FIXME: My Intel manual says we should use 0xF800, not 0xFC00. */ > #define DR_CONTROL_RESERVED (0xFC00) > > +/* Copy of hardware debug registers for performance reasons. */ > + > +struct dr_mirror struct i386_dr_mirror please. > + { > + /* Mirror the inferior's DRi registers. We keep the status and > + control registers separated because they don't hold addresses. */ > + CORE_ADDR addr[DR_NADDR]; > + unsigned long status, control; > + > + /* Reference counts for each debug register. */ > + int ref_count[DR_NADDR]; > + }; > + > /* Auxiliary helper macros. */ > > /* A value that masks all fields in DR7 that are reserved by Intel. */ > @@ -111,49 +125,60 @@ struct i386_dr_low_type i386_dr_low; > > /* The I'th debug register is vacant if its Local and Global Enable > bits are reset in the Debug Control register. */ > -#define I386_DR_VACANT(i) \ > - ((dr_control_mirror & (3 << (DR_ENABLE_SIZE * (i)))) == 0) > + > +static inline int > +dr_vacant (struct dr_mirror *dr_mirror, int i) > +{ > + return (dr_mirror->control & (3 << (DR_ENABLE_SIZE * i))) == 0; > +} Please keep the i386_ prefix in all these functions.