From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 823FE3959C9D for ; Wed, 13 May 2020 20:53:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 823FE3959C9D Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-455-3AL28Iq-OvWuXWEA56yptw-1; Wed, 13 May 2020 16:53:42 -0400 X-MC-Unique: 3AL28Iq-OvWuXWEA56yptw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B97BA107ACCA for ; Wed, 13 May 2020 20:53:41 +0000 (UTC) Received: from cascais.Home (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AB256154C for ; Wed, 13 May 2020 20:53:41 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v8 2/6] gdb/infrun: move a 'regcache_read_pc' call down to first use Date: Wed, 13 May 2020 21:53:34 +0100 Message-Id: <20200513205338.14233-3-palves@redhat.com> In-Reply-To: <20200513205338.14233-1-palves@redhat.com> References: <20200513205338.14233-1-palves@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-17.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2020 20:53:45 -0000 From: Tankut Baris Aktemur In infrun.c's resume_1 function, move the definition of the local variable PC down to its first use. This is useful if the thread we want to resume is already gone with a pending exit event, because we avoid the error we would see otherwise when trying to read the PC. gdb/ChangeLog: 2020-04-03 Tankut Baris Aktemur * infrun.c (resume_1): Move a 'regcache_read_pc' call down to first use. --- gdb/infrun.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 5e01336ab09..db88a1eef15 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2279,7 +2279,6 @@ resume_1 (enum gdb_signal sig) struct regcache *regcache = get_current_regcache (); struct gdbarch *gdbarch = regcache->arch (); struct thread_info *tp = inferior_thread (); - CORE_ADDR pc = regcache_read_pc (regcache); const address_space *aspace = regcache->aspace (); ptid_t resume_ptid; /* This represents the user's step vs continue request. When @@ -2358,6 +2357,8 @@ resume_1 (enum gdb_signal sig) step = 0; } + CORE_ADDR pc = regcache_read_pc (regcache); + if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: resume (step=%d, signal=%s), " -- 2.14.5