Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/3] [PowerPC] Fix debug register issues in ppc-linux-nat
Date: Thu, 08 Aug 2019 20:27:00 -0000	[thread overview]
Message-ID: <875zn7iery.fsf@linux.ibm.com> (raw)
In-Reply-To: <20190808162423.C889CD802EF@oc3748833570.ibm.com>

"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.

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

One alternative solution is to use low_new_thread and iterate through
all the known lwps in the same thread group, and copy state of installed
slots (m_installed_hw_bps) from all threads to the state for the new
thread.  This should be sufficient for low_prepare_to_resume, since we
just delete every slot ignoring ENOENT errors there.  Wold something
like this make sense?  However, I'm not sure if this is robust enough to
work even when add_lwp is used in other cases.

> - 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!

--
Pedro Franco de Carvalho


  reply	other threads:[~2019-08-08 20:27 UTC|newest]

Thread overview: 15+ 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 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 [this message]
2019-08-09 11:04       ` Ulrich Weigand
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-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
     [not found] <87ftm56uqg.fsf@linux.ibm.com>
2019-08-21 15:31 ` [PATCH 3/3] [PowerPC] Fix debug register issues in ppc-linux-nat 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=875zn7iery.fsf@linux.ibm.com \
    --to=pedromfc@linux.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --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