From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16625 invoked by alias); 29 Apr 2009 12:33:14 -0000 Received: (qmail 16613 invoked by uid 22791); 29 Apr 2009 12:33:11 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtagate1.de.ibm.com (HELO mtagate1.de.ibm.com) (195.212.17.161) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Apr 2009 12:33:05 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate1.de.ibm.com (8.13.1/8.13.1) with ESMTP id n3TCX2TN003848 for ; Wed, 29 Apr 2009 12:33:02 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.2) with ESMTP id n3TCX2dJ3592232 for ; Wed, 29 Apr 2009 14:33:02 +0200 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 n3TCX00r016010 for ; Wed, 29 Apr 2009 14:33:01 +0200 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 n3TCWuSw015927; Wed, 29 Apr 2009 14:32:59 +0200 Message-Id: <200904291232.n3TCWuSw015927@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Wed, 29 Apr 2009 14:32:56 +0200 Subject: Re: [rfc] Do not call read_pc in startup_inferior To: drow@false.org (Daniel Jacobowitz) Date: Wed, 29 Apr 2009 12:33:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20090428192826.GA31724@caradoc.them.org> from "Daniel Jacobowitz" at Apr 28, 2009 03:28:26 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: 2009-04/txt/msg00787.txt.bz2 Daniel Jacobowitz wrote: > On Tue, Apr 28, 2009 at 06:37:12PM +0200, Ulrich Weigand wrote: > > Hello, > > > > a while ago, I committed a patch to avoid calling wait_for_inferior > > in startup_inferior, so as to avoid accessing inferior register state > > at a time where the target's actual register layout has not yet been > > determined (via target_find_description). > > > > However, startup_inferior still contains a read_pc call to retrieve > > the initial value of stop_pc -- this of course runs into the same > > problem. > > > > The patch below removes the read_pc call from startup_inferior, and > > instead determines the initial stop_pc value in post_create_inferior, > > after the register layout has been finalized. > > You're moving the call from a native "run" only routine, to an > all-targets routine. That made me curious so I went looking... what > relies on this setting? Anything? It doesn't seem a lot relies on it; the solib_create_inferior_hook might, but this is the case only for solib-sunos.c (which I guess could be changed to use regcache_read_pc). The only other potentially user-visible change seems to be that "info program" will report "Program stopped at ..." giving the proper entry point address. In any case, most create_inferior implementations either call startup_inferior, or otherwise set stop_pc e.g. by calling into wait_for_inferior (in the latter case it shouldn't hurt to set it again). There are some targets that currently do not appear to set stop_pc: the remote-extended mode, NTO, and some monitor targets. These would see a difference in "info program" output due to my patch (but the new behaviour should be preferable, I guess) ... Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com