Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: "'Ulrich Weigand'" <uweigand@de.ibm.com>
Cc: <gdb-patches@sourceware.org>,
	"'Pedro Alves'" <pedro@codesourcery.com>,
	        "'Eli Zaretskii'" <eliz@gnu.org>
Subject: RE: [RFC] Remove i386 low level debug register function from nm- header file.
Date: Tue, 12 May 2009 14:37:00 -0000	[thread overview]
Message-ID: <003701c9d30f$1cea0a00$56be1e00$@u-strasbg.fr> (raw)
In-Reply-To: <200905121300.n4CD0vMQ003287@d12av02.megacenter.de.ibm.com>

Thanks for the feedback.

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Ulrich Weigand
> Envoyé : Tuesday, May 12, 2009 3:01 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org; 'Pedro Alves'; 'Eli Zaretskii'
> Objet : Re: [RFC] Remove i386 low level debug register function from
> nm- header file.
> 
> Pierre Muller wrote:
> 
> > Following my first RFC
> > http://sourceware.org/ml/gdb-patches/2009-03/msg00197.html
> >
> > and the following answers, I resubmit
> > a new version where all i386 low level debug register
> > is contained in a single struct defined in the
> > new i386-nat.h header (to comply with DOS file name restrictions
> > as asked for by Eli).
> 
> This looks good to me.  However, now that you've moved the
> prototypes to i386-nat.h, there is no longer any need for
> the config/i386/nm-i386.h file -- please get rid of that file
> (by removing the places where it is included into other nm-
> files).

  OK, but how do I commit a file deletion?
I never did this before!

> Also, it seems to me that now there is no need any more for
> the I386_USE_GENERIC_WATCHPOINTS define -- targets that use
> watchpoints call the i386_use_watchpoints routines, those
> that don't, do not.

  Seems reasonable indeed!
 
> I think you should provide everything in i386-nat.c (and
> the new i386-nat.h) unconditionally, and eliminate the
> various definitions of I386_USE_GENERIC_WATCHPOINTS in the
> nm- header files.

  The only drawback is that "maint show-debug--regs" command
will then also appear on target that do not support
debug registers... Anyhow, it will just be a no-op in that case.
Is that a problem?

> Note that in combination with removing nm-i386.h, this
> actually makes several nm- files completely empty, so they
> should be removed as well.
> 
> > 2009-05-10  Pierre Muller  <muller.u-strasbg.fr>
> >
> > 	Remove all i386 debug register low level macros in config tm
> files.
> 
> Should read "nm" files, not tm.

Yes of course, thanks for catching this!

> > +/* Targets should define this to use the generic x86 watchpoint
> support.
> > */
> > +#ifdef I386_USE_GENERIC_WATCHPOINTS
> 
> As mentioned above, please get rid of this conditional ...
> 
> > +
> > +/* Add watchpoint methods to the provided target_ops.
> > +   Targets defining I386_USE_GENERIC_WATCHPOINTS should call
> > +   this.  */
> 
> ... as well as the second sentence of the comment.
> 
> >  /* Support for 8-byte wide hw watchpoints.  */
> >  #ifndef TARGET_HAS_DR_LEN_8
> > -#define TARGET_HAS_DR_LEN_8	0
> > +#define TARGET_HAS_DR_LEN_8 (i386_dr_low.debug_register_length == 8)
> >  #endif
> 
> Nobody should be defining this any more, so please eliminate
> the #ifndef ... conditional.

  OK, will do.
 
> > Index: src/gdb/i386fbsd-nat.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/i386fbsd-nat.c,v
> > retrieving revision 1.18
> > @@ -126,7 +127,19 @@ _initialize_i386fbsd_nat (void)
> >
> >    /* Add some extra features to the common *BSD/i386 target.  */
> >    t = i386bsd_target ();
> > +
> > +#ifdef I386_USE_GENERIC_WATCHPOINTS
> > +
> >    i386_use_watchpoints (t);
> > +
> > +  i386_dr_low.set_control = i386bsd_dr_set_control;
> > +  i386_dr_low.set_addr = i386bsd_dr_set_addr;
> > +  i386_dr_low.reset_addr = i386bsd_dr_reset_addr;
> > +  i386_dr_low.get_status = i386bsd_dr_get_status;
> > +  i386_set_debug_register_length (4);
> > +#endif /* I386_USE_GENERIC_WATCHPOINTS */
> 
> 
> In this case, because the header file currently conditionally defines
> I386_USE_GENERIC_WATCHPOINTS:
> 
> #ifdef HAVE_PT_GETDBREGS
> #define I386_USE_GENERIC_WATCHPOINTS
> #endif
> 
> you should move that condition to the i386fbsd-nat.c file:
> 
> #ifdef HAVE_PT_GETDBREGS
>    i386_use_watchpoints (t);
> 
>    ...
> #endif

  So freebsd with old kernels (not supporting PT_GETDBREGS), 
will typically have the non-operational "maint show-debug-reg" command.
 
> > diff -u -p -r1.189 windows-nat.c
> > --- windows-nat.c	17 Apr 2009 15:44:28 -0000	1.189
> > +++ windows-nat.c	8 May 2009 14:02:25 -0000
> > @@ -2166,8 +2171,22 @@ init_windows_ops (void)
> >    windows_ops.to_has_execution = 1;
> >    windows_ops.to_pid_to_exec_file = windows_pid_to_exec_file;
> >    windows_ops.to_get_ada_task_ptid = windows_get_ada_task_ptid;
> > +
> > +#ifdef I386_USE_GENERIC_WATCHPOINTS
> > +
> >    i386_use_watchpoints (&windows_ops);
> >
> > +  i386_dr_low.set_control = cygwin_set_dr7;
> > +  i386_dr_low.set_addr = cygwin_set_dr;
> > +  i386_dr_low.reset_addr = NULL;
> > +  i386_dr_low.get_status = cygwin_get_dr6;
> 
> Here, it seems every user of windows-nat.c unconditionally
> defines I386_USE_GENERIC_WATCHPOINTS, so there's no point in
> adding the #ifdef's to this file ...

  I don't know here, the problem is that windows-nat is full of i386
specific code that should be moved to i386-windows-nat and/or
amd64-windows-nat
so that supporting other processors will be easier.

Thanks Ulrich,
I will try to submit a new version promptly.

Pierre


  reply	other threads:[~2009-05-12 14:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-10 14:54 Pierre Muller
2009-05-10 17:37 ` Eli Zaretskii
2009-05-12 13:02 ` Ulrich Weigand
2009-05-12 14:37   ` Pierre Muller [this message]
2009-05-12 15:00     ` Ulrich Weigand
2009-05-12 15:17       ` Eli Zaretskii
2009-05-12 15:45         ` Pierre Muller
2009-05-12 16:06           ` Ulrich Weigand
2009-05-12 16:19             ` Pedro Alves
2009-05-12 21:28     ` [RFC-v2] " Pierre Muller
2009-05-13 15:33       ` Ulrich Weigand
2009-05-13 18:09         ` Eli Zaretskii
2009-05-13 18:35           ` Ulrich Weigand
2009-05-13 18:25         ` Doug Evans
2009-05-13 18:38           ` Ulrich Weigand
2009-05-13 22:21           ` Pierre Muller
2009-05-13 23:16             ` Doug Evans
2009-05-13 23:39         ` [RFA-v3] " Pierre Muller
2009-05-14  9:06           ` Ulrich Weigand
2009-05-14  9:10             ` Joel Brobecker
2009-05-14  9:40             ` Pierre Muller
2009-05-14 15:32             ` Macros in config files Pierre Muller
2009-05-14 18:31               ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003701c9d30f$1cea0a00$56be1e00$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox