Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <alves.ped@gmail.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch 2/2] Fix watchpoints for multi-inferior
Date: Mon, 02 Jan 2012 19:14:00 -0000	[thread overview]
Message-ID: <4F02020F.5090906@gmail.com> (raw)
In-Reply-To: <20120102164652.GB10231@host2.jankratochvil.net>

On 01/02/2012 04:46 PM, Jan Kratochvil wrote:
> Hi,
>
> this is a new post of:
> 	[patch 4/4] hw watchpoints made multi-inferior
> 	http://sourceware.org/ml/gdb-patches/2010-12/msg00045.html
>
> Currently watchpoints somehow apply to all the inferiors but they do not work
> that way anyway.  I believe watchpoints should be specific for each inferior.

Yeah.

>   /* Get data specific for INFERIOR_PTID LWP.  Return special data area
>      for processes being detached.  */
>
>   static struct i386_inferior_data *
>   i386_inferior_data_get (void)
>   {
> -  /* Intermediate patch stub.  */
> -  static struct i386_inferior_data inf_data_local;
>     struct inferior *inf = current_inferior ();
> -  struct i386_inferior_data *inf_data =&inf_data_local;
> +  struct i386_inferior_data *inf_data;
> +
> +  inf_data = inferior_data (inf, i386_inferior_data);
> +  if (inf_data == NULL)
> +    {
> +      inf_data = xzalloc (sizeof (*inf_data));
> +      set_inferior_data (current_inferior (), i386_inferior_data, inf_data);
> +    }

Do we clear inf_data or inf_data's contents anywhere on inferior
exit or startup, so to not leave debug registers stale across runs?
(The cleanup only runs when the inferior is deleted.)


> --- /dev/null
> +++ b/gdb/testsuite/gdb.multi/watchpoint-multi.c
> @@ -0,0 +1,51 @@
> +/* This testcase is part of GDB, the GNU debugger.
> +
> +   Copyright 2012 Free Software Foundation, Inc.
> +
> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 3 of the License, or
> +   (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program.  If not, see<http://www.gnu.org/licenses/>.  */
> +
> +#include<pthread.h>
> +#include<assert.h>
> +
> +static volatile int a, b, c;
> +
> +static void
> +marker_exit (void)
> +{
> +  a = 1;
> +}
> +
> +static void *
> +start (void *arg)
> +{
> +  b = 2;
> +  c = 3;
> +
> +  return NULL;
> +}
> +
> +int
> +main (void)
> +{
> +  pthread_t thread;
> +  int i;
> +
> +  i = pthread_create (&thread, NULL, start, NULL);
> +  assert (i == 0);
> +  i = pthread_join (thread, NULL);
> +  assert (i == 0);
> +
> +  marker_exit ();
> +  return 0;
> +}
> --- /dev/null
> +++ b/gdb/testsuite/gdb.multi/watchpoint-multi.exp
> @@ -0,0 +1,92 @@
> +# Copyright 2012 Free Software Foundation, Inc.
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see<http://www.gnu.org/licenses/>.
> +
> +if [is_remote target] {
> +    # It is KFAIL.
> +    continue

Did you mean to turn this into a real kfail?  What are the
gdbserver problems, btw?

> +
> +# Simulate non-stop+target-async which also uses breakpoint always-inserted.
> +gdb_test_no_output "set breakpoint always-inserted on"
> +# displaced-stepping is also needed as other GDB sometimes still removes the
> +# breakpoints, even with always-inserted on.
> +gdb_test_no_output "set displaced-stepping on"

'if ![support_displaced_stepping] bail' missing, as well as the usual
hw watchpoints support checks.

Otherwise looks okay.

-- 
Pedro Alves


  reply	other threads:[~2012-01-02 19:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-02 16:47 Jan Kratochvil
2012-01-02 19:14 ` Pedro Alves [this message]
2012-01-20 21:34   ` [patch 2/2] Fix watchpoints for multi-inferior #2 Jan Kratochvil
2012-01-24 13:40     ` Pedro Alves
2012-01-24 14:20       ` [commit] " Jan Kratochvil
2012-01-25 15:57       ` Jan Kratochvil
2012-01-25 17:54         ` Pedro Alves
2012-01-25 18:22           ` Pedro Alves
2012-01-25 20:08             ` Pedro Alves
2012-01-26 21:56               ` [patch] protocol doc vs. gdbserver on H and pPID.-1 etc. [Re: [patch 2/2] Fix watchpoints for multi-inferior #2] Jan Kratochvil
2012-01-27 11:53                 ` Pedro Alves
2012-01-27 12:02                 ` Pedro Alves
2012-03-16 20:11               ` [patch 2/2] Fix watchpoints for multi-inferior #2 Pedro Alves
2012-03-16 20:14                 ` Jan Kratochvil

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=4F02020F.5090906@gmail.com \
    --to=alves.ped@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.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