Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: "Pierre Muller" <muller@ics.u-strasbg.fr>
Subject: Re: [RFC] Set I386_USE_GENERIC_WATCHPOINTS in configure
Date: Fri, 13 Mar 2009 01:21:00 -0000	[thread overview]
Message-ID: <200903130102.50004.pedro@codesourcery.com> (raw)
In-Reply-To: <000901c9a372$89647070$9c2d5150$@u-strasbg.fr>

On Friday 13 March 2009 00:27:47, Pierre Muller wrote:
>   To get fully functional multi-arch,
> we should try to remove all nm files.

We need to make everything that is target dependent selectable
at runtime.  Things that affect native debugging only can stay here
without any prejudice.  E.g., not having watchpoints in the target
vector was something that was problematic for multi-target support,
hence the slow moving towards making I386_WATCHPOINTS_IN_TARGET_VECTOR
the default.  A define that only affects the native target
is not problematic, since there's only ever one native
target configured in.

>   
>   I tried to write a patch that completely removes
> the need of 
> I386_USE_GENERIC_WATCHPOINTS in config/i386/nm-*.h
> headers.
>   Instead 
> I386_USE_GENERIC_WATCHPOINTS and TARGET_HAS_DR_LEN_8
> are set in configure.

Why do we need I386_USE_GENERIC_WATCHPOINTS at all?

The right way to do this is to only add i386-nat.o to
NATDEPFILES in configurations that want to use it.  For fbsd,
you can guard the call to i386_use_watchpoints with
HAVE_PT_GETDBREGS, and completely get rid of
I386_USE_GENERIC_WATCHPOINTS.

I suggest we first eliminate I386_WATCHPOINTS_IN_TARGET_VECTOR
as a separate step, independently of the I386_USE_GENERIC_WATCHPOINTS
changes.

> 
>   This allows to almost completely empty
> the config/i386/nm*.h files.
> 
>   I used four function variables to replace
> the I386_DR_LOW_* macros, and set those variables
> close to where i386_use_watchpoints function
> is called.
>   I am not sure that this is the best solution,
> but I was afraid of the idea of implementing the 
> same function in different sources, with a possible
> conflict if two of these native files get compiled into
> the same executable. 

Not likely to happen anytime soon, if ever (cough).  GDB can
only be configured for one native target.

> 
> I am not really confident in the configure.ac part,
> as this is the first time I try to modify this
> file and I have no knowledge of autoconf :(
> 
> All remarks are welcome.
> 

I guess a new structure holding function pointers
would be cleaner.  Say,

struct i386_watchpoint_ops
{
   void (*dr_low_set_control) (unsigned);
   void (*dr_low_set_addr) (int, CORE_ADDR);
   void (*dr_low_reset_addr) (int);
   unsigned (*dr_low_get_status) (void);
   int dr_size;
};

This removes the need for any configure.ac change, I believe.


One thing that could be investigated is if exposing the
i386 debug registers through the register cache (exposed
as process wide registers, not per-thread registers) could
be a good interface for remote watchpoint support, thus making
remote targets benefit from the reference counting done on the
GDB side instead of implementing Z watchpoint packets.  Not
sure yet how feasible or efficient that is.

-- 
Pedro Alves


  reply	other threads:[~2009-03-13  1:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-13  0:30 Pierre Muller
2009-03-13  1:21 ` Pedro Alves [this message]
2009-03-13  8:50   ` Pierre Muller
2009-03-13 10:34     ` Mark Kettenis
2009-03-13 10:08 ` Eli Zaretskii

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=200903130102.50004.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=muller@ics.u-strasbg.fr \
    /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