From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14115 invoked by alias); 2 Jan 2012 19:14:47 -0000 Received: (qmail 14107 invoked by uid 22791); 2 Jan 2012 19:14:46 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_XZ X-Spam-Check-By: sourceware.org Received: from mail-wi0-f169.google.com (HELO mail-wi0-f169.google.com) (209.85.212.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Jan 2012 19:14:27 +0000 Received: by wibhq12 with SMTP id hq12so11567335wib.0 for ; Mon, 02 Jan 2012 11:14:26 -0800 (PST) Received: by 10.180.88.10 with SMTP id bc10mr108712716wib.13.1325531666297; Mon, 02 Jan 2012 11:14:26 -0800 (PST) Received: from [192.168.0.103] (bl16-31-110.dsl.telepac.pt. [188.81.31.110]) by mx.google.com with ESMTPS id ga4sm35977057wbb.4.2012.01.02.11.14.24 (version=SSLv3 cipher=OTHER); Mon, 02 Jan 2012 11:14:25 -0800 (PST) Message-ID: <4F02020F.5090906@gmail.com> Date: Mon, 02 Jan 2012 19:14:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Jan Kratochvil CC: gdb-patches@sourceware.org Subject: Re: [patch 2/2] Fix watchpoints for multi-inferior References: <20120102164652.GB10231@host2.jankratochvil.net> In-Reply-To: <20120102164652.GB10231@host2.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00059.txt.bz2 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. */ > + > +#include > +#include > + > +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. > + > +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