From patchwork Fri Dec 20 17:50:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 37037 Received: (qmail 8828 invoked by alias); 20 Dec 2019 17:50:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 8820 invoked by uid 89); 20 Dec 2019 17:50:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1067 X-HELO: mail.efficios.com Received: from mail.efficios.com (HELO mail.efficios.com) (167.114.142.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Dec 2019 17:50:23 +0000 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 9031C68FE08 for ; Fri, 20 Dec 2019 12:50:21 -0500 (EST) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id KFYs3Q1vfQUZ; Fri, 20 Dec 2019 12:50:21 -0500 (EST) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 4582F68FE04; Fri, 20 Dec 2019 12:50:21 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 4582F68FE04 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1576864221; bh=atE80M6DI3fpR6dzsa2ZXvPdlsibHghSvj8doeHsMPY=; h=From:To:Date:Message-Id:MIME-Version; b=WNdcLd5Zufxx7YEV3/1uQzZ7Jt0cw1R7D8jsNqGn3LwPou71F3mQDsNgK7wq7gDaw cJgFD16lFOXz1WyBqFm2GYd9CP3366d7AK112ZDnatx4NG0Wl9DBnxi9AqWBl+PCSQ 3Ni4GhLBjJnNOt8PqoD8RM1k5exsjKyY1IKUcvf1lvbdTq5KQj+Vr4tqWE2MzSm3SV zMvMgRLwgpEZGUf/lAnm8pXQbH5f37oHc4IvqBsKlGz6mTdLUN94Wuf1S+0EODyX8G YUlhlZGteyFuk8M2Qp1SkYIdc8nlX3Vwaz2WUzmR0sbo1VwNM95uvyx9JObHIdoOUa jaExzby4YMjsg== Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id BCLTmmUbV_qR; Fri, 20 Dec 2019 12:50:21 -0500 (EST) Received: from smarchi-efficios.internal.efficios.com (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) by mail.efficios.com (Postfix) with ESMTPSA id 2014A68FDFE; Fri, 20 Dec 2019 12:50:21 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] Use get_thread_regcache instead of get_current_regcache in post_create_inferior Date: Fri, 20 Dec 2019 12:50:06 -0500 Message-Id: <20191220175006.23147-1-simon.marchi@efficios.com> MIME-Version: 1.0 In post_create_inferior, we get the current thread using the inferior_thread function and store it in `thr`. We then call get_current_regcache immediately after, which does: return get_thread_regcache (inferior_thread ()); This patch makes post_create_inferior use get_thread_regcache, passing `thr`, saving an unnecessary inferior_thread call. gdb/ChangeLog: * infcmd.c (post_create_inferior): Use get_thread_regcache instead of get_current_regcache. --- gdb/infcmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/infcmd.c b/gdb/infcmd.c index af66eaffd8a4..7aa1f77af005 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -441,7 +441,8 @@ post_create_inferior (struct target_ops *target, int from_tty) thr->suspend.stop_pc = 0; try { - thr->suspend.stop_pc = regcache_read_pc (get_current_regcache ()); + regcache *rc = get_thread_regcache (thr); + thr->suspend.stop_pc = regcache_read_pc (rc); } catch (const gdb_exception_error &ex) {