public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: pedromfc@linux.ibm.com (Pedro Franco de Carvalho)
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/3] [PowerPC] Fix debug register issues in ppc-linux-nat
Date: Fri, 09 Aug 2019 11:04:00 -0000	[thread overview]
Message-ID: <20190809110434.C48D2D80277@oc3748833570.ibm.com> (raw)
In-Reply-To: <875zn7iery.fsf@linux.ibm.com> from "Pedro Franco de Carvalho" at Aug 08, 2019 05:27:29 PM

Pedro Franco de Carvalho wrote:
> "Ulrich Weigand" <uweigand@de.ibm.com> writes:
> 
> > This looks generally good to me, just two questions:
> >
> > - As mentioned in the 1/3 patch, why do you need the low_new_clone
> >   callback?  As I understand it, you'll get low_new_thread called
> >   immediatedly afterwards, which will mark the thread as "stale",
> >   and once it is scheduled again, all debug regs will be set up
> >   from scratch anyway ...
> 
> The reason I did this is so that we have the lwp object of the parent
> thread, so that we can copy the correct debug register state.  The
> arguments for low_new_thread don't include the parent.  I think other
> targets always know how to clear all the debug registers without keeping
> track of anything, but we need to know which slots might already be
> installed in a new thread.

I may still be missing something, but why exactly *do* we need to know
which slots might already be installed?  I'd have assumed that when we
get to low_prepare_to_resume, and the lwp is marked stale, we just throw
away everything and install the complete desired state.

> Another reason is that add_lwp (and therefore low_new_thread) is also
> called in cases other than a ptrace clone event.

Well, yes, but those cases *also* need to be handled, right?  This is
e.g. when you attach to an already multi-threaded process while there
are already watchpoints set up.  In that case, you'll need to install
those watchpoints into all those threads.

> > - We currently do not support hardware watchpoints in gdbserver,
> >   even though we really should.  Ideally, the low-level code to
> >   handle debug regs should be shared between gdb and gdbserver,
> >   as is done e.g. on x86.  Now, I'm not saying that handling
> >   gdbserver is a pre-req for this patch (fixing GDB first is of
> >   course fine!), but I'm wondering if it would make sense, given
> >   that you're refactoring a lot of this code anyway, to think
> >   about whether this setup would help or hinder a future merge
> >   with gdbserver.
> 
> Ok, I'll review this and see if this can be easily ported to gdbserver.

Thanks!

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

  reply	other threads:[~2019-08-09 11:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26 12:50 [PATCH 0/3] low_new_clone in linux-nat.c and powerpc watchpoint fixes Pedro Franco de Carvalho
2019-07-26 12:50 ` [PATCH 1/3] Add low_new_clone method to linux_nat_target Pedro Franco de Carvalho
2019-08-08 14:05   ` Ulrich Weigand
2019-07-26 12:50 ` [PATCH 2/3] [PowerPC] Move up some register access routines Pedro Franco de Carvalho
2019-08-08 16:25   ` Ulrich Weigand
2019-07-26 12:50 ` [PATCH 3/3] [PowerPC] Fix debug register issues in ppc-linux-nat Pedro Franco de Carvalho
2019-08-08 16:24   ` Ulrich Weigand
2019-08-08 20:27     ` Pedro Franco de Carvalho
2019-08-09 11:04       ` Ulrich Weigand [this message]
2019-08-09 15:04         ` Pedro Franco de Carvalho
2019-08-09 15:28           ` Ulrich Weigand
2019-08-09 15:53             ` Pedro Franco de Carvalho
2019-08-13 13:50             ` Pedro Franco de Carvalho
2019-08-21 15:31               ` Ulrich Weigand
2019-08-21 17:45                 ` Pedro Franco de Carvalho
2019-08-22 10:27                   ` 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=20190809110434.C48D2D80277@oc3748833570.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedromfc@linux.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).