From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20611 invoked by alias); 7 Dec 2008 18:23:52 -0000 Received: (qmail 20603 invoked by uid 22791); 7 Dec 2008 18:23:52 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate2.de.ibm.com (HELO mtagate2.de.ibm.com) (195.212.17.162) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 07 Dec 2008 18:23:09 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.1/8.13.1) with ESMTP id mB7IN6mZ017233 for ; Sun, 7 Dec 2008 18:23:06 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mB7IN6Y93338320 for ; Sun, 7 Dec 2008 19:23:06 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mB7IN6Ni005728 for ; Sun, 7 Dec 2008 19:23:06 +0100 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id mB7IN6TL005725; Sun, 7 Dec 2008 19:23:06 +0100 Message-Id: <200812071823.mB7IN6TL005725@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Sun, 7 Dec 2008 19:23:06 +0100 Subject: Re: [rfc] [2/7] infrun cleanup: miscellaneous cleanups To: pedro@codesourcery.com (Pedro Alves) Date: Sun, 07 Dec 2008 18:23:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <200812071719.24947.pedro@codesourcery.com> from "Pedro Alves" at Dec 07, 2008 05:19:24 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 2008-12/txt/msg00134.txt.bz2 Pedro Alves: > On Sunday 07 December 2008 01:23:40, Pedro Alves wrote: > > On Sunday 07 December 2008 00:17:36, Ulrich Weigand wrote: > > > if (!ecs->wait_some_more) > > > { > > > - struct inferior *inf =3D find_inferior_pid (ptid_get_pid (ecs->p= > tid)); > > > +=20=20=20=20=20=20 > > Please change this bit to: > >=20 > > - =A0 =A0 =A0struct inferior *inf =3D find_inferior_pid (ptid_get_pid (ec= > s->ptid)); > > + =A0 =A0 =A0struct inferior *inf =3D find_inferior_pid (ptid_get_pid (in= > ferior_ptid)); > > Looking again, it would be more correct (and safest as it doesn't change cu= > rrent > behaviour) to leave it as ptid_get_pid(ecs->ptid) in this patch, and change= > it > to ptid_get_pid (ptid) in the last patch (the event ptid). Well, I was concerned about the cases where today handle_inferior_event *modifies* the ecs->ptid it gets as input (e.g. thread-hopping or switching back to the single-stepped thread). I'm not sure if that can today actually ever cause it switch to a different *inferior*, but it appears it could. Using simply the caller's ptid means we will miss that switch. Using inferior_ptid should catch it, however, as handle_inferior_event will have done a switch_to_thread in addition to changing ecs->ptid. Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com