From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13787 invoked by alias); 28 Apr 2009 16:37:30 -0000 Received: (qmail 13731 invoked by uid 22791); 28 Apr 2009 16:37:24 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mtagate7.de.ibm.com (HELO mtagate7.de.ibm.com) (195.212.29.156) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Apr 2009 16:37:16 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate7.de.ibm.com (8.14.3/8.13.8) with ESMTP id n3SGbDxh547496 for ; Tue, 28 Apr 2009 16:37:13 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 n3SGbEBL3633370 for ; Tue, 28 Apr 2009 18:37:14 +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 n3SGbDCN009412 for ; Tue, 28 Apr 2009 18:37:14 +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 n3SGbClg009383 for ; Tue, 28 Apr 2009 18:37:12 +0200 Message-Id: <200904281637.n3SGbClg009383@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Tue, 28 Apr 2009 18:37:12 +0200 Subject: [rfc] Do not call read_pc in startup_inferior To: gdb-patches@sourceware.org Date: Tue, 28 Apr 2009 16:37:00 -0000 From: "Ulrich Weigand" 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/msg00760.txt.bz2 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. Tested on powerpc64-linux. Any comments or objections to this? Otherwise, I'm planning on committing this patch within the next couple of days. Bye, Ulrich ChangeLog: * fork-child.c (startup_inferior): Move setting stop_pc ... * infcmd.c (post_create_inferior): ... to here. Index: gdb-head/gdb/fork-child.c =================================================================== --- gdb-head.orig/gdb/fork-child.c +++ gdb-head/gdb/fork-child.c @@ -530,8 +530,6 @@ startup_inferior (int ntraps) /* Mark all threads non-executing. */ set_executing (pid_to_ptid (-1), 0); - - stop_pc = read_pc (); } /* Implement the "unset exec-wrapper" command. */ Index: gdb-head/gdb/infcmd.c =================================================================== --- gdb-head.orig/gdb/infcmd.c +++ gdb-head/gdb/infcmd.c @@ -391,6 +391,9 @@ post_create_inferior (struct target_ops don't need to. */ target_find_description (); + /* Now that we know the register layout, retrieve current PC. */ + stop_pc = read_pc (); + /* If the solist is global across processes, there's no need to refetch it here. */ if (exec_bfd && !gdbarch_has_global_solist (target_gdbarch)) -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com