From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by sourceware.org (Postfix) with ESMTPS id DADB33946C34 for ; Mon, 6 Apr 2020 15:46:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DADB33946C34 IronPort-SDR: BrxHdTANsqpaTENc7MtR5MVYN61rKtyBrCmqY1eEyYueUB653GijAKORPlPINuYR617N1L2RDs cbwpE2A8a/5Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2020 08:46:14 -0700 IronPort-SDR: E/ne4k40xV9DULYG8KwbBIxt0+q5aUC23JBj+0ImyNZczBKRwsOBWtLvO8LQgR05I0rYYP6tyR PDQbvl2BJeBg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,351,1580803200"; d="scan'208";a="239655253" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga007.jf.intel.com with ESMTP; 06 Apr 2020 08:46:13 -0700 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 036FkCnk006944; Mon, 6 Apr 2020 16:46:12 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id 036FkCvj021073; Mon, 6 Apr 2020 17:46:12 +0200 Received: (from taktemur@localhost) by ulvlx001.iul.intel.com with LOCAL id 036FkCeM021069; Mon, 6 Apr 2020 17:46:12 +0200 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Cc: palves@redhat.com, tdevries@suse.de Subject: [PATCH v5 2/5] gdb/infrun: move a 'regcache_read_pc' call down to first use Date: Mon, 6 Apr 2020 17:45:48 +0200 Message-Id: <48a722182b3cc68d5d2ebffa7161857087e417e1.1586187408.git.tankut.baris.aktemur@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: In-Reply-To: References: X-Spam-Status: No, score=-25.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, 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: Mon, 06 Apr 2020 15:46:17 -0000 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 d6265c6df51..f5d3b79e0d0 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2271,7 +2271,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 @@ -2350,6 +2349,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.17.1