From patchwork Mon Mar 20 21:51:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 19678 Received: (qmail 96716 invoked by alias); 20 Mar 2017 21:52:20 -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 96575 invoked by uid 89); 20 Mar 2017 21:52:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.2 spammy=2036 X-HELO: sesbmg22.ericsson.net Received: from sesbmg22.ericsson.net (HELO sesbmg22.ericsson.net) (193.180.251.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Mar 2017 21:52:10 +0000 Received: from ESESSHC014.ericsson.se (Unknown_Domain [153.88.183.60]) by (Symantec Mail Security) with SMTP id 1A.E8.25230.80F40D85; Mon, 20 Mar 2017 22:52:09 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.60) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 20 Mar 2017 22:52:27 +0100 Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=ericsson.com; Received: from elxcz23q12-y4.ca.am.ericsson.se (192.75.88.130) by DB5PR07MB1718.eurprd07.prod.outlook.com (2603:10a6:0:12::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.4; Mon, 20 Mar 2017 21:52:05 +0000 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH v2 2/3] spu: Use ptid from regcache instead of inferior_ptid Date: Mon, 20 Mar 2017 17:51:47 -0400 Message-ID: <20170320215147.25887-1-simon.marchi@ericsson.com> In-Reply-To: References: MIME-Version: 1.0 X-ClientProxiedBy: CY4PR12CA0031.namprd12.prod.outlook.com (2603:10b6:903:129::17) To DB5PR07MB1718.eurprd07.prod.outlook.com (2603:10a6:0:12::23) X-MS-Office365-Filtering-Correlation-Id: 4bc37cbe-587d-4ff9-f7f1-08d46fdb59cc X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DB5PR07MB1718; X-Microsoft-Exchange-Diagnostics: 1; DB5PR07MB1718; 3:tnDdp9IaB4ThSyFubbvPCoPX3nDzbRiSGV+wxRp+V1hPHJRsAElu8FdkuyW+KGBLgQNn6tZLusEByZGN/Pw9wSrNkXVM+h22ys4cP3CLlaDIdt2WHJh8n3WzCPAwhYx0QIDFmYxj+v1szelSUA7431e4nKFnmAp/Ag/jeKjo+K7+HP5R2avUtKIr3/8DF1x6I6A6BX43sbGXQCOOZFQPE6dPtHzLtSeSdG+mOTh0RB/igaBqkBBEaFFGImWtdEpqWx4+HvyMdRfxoLxeg1dMew==; 25:JFzQe5jDz655jeHo2W42Q2J7x7dOHsyZjREJhJReqr+3CFcjYVD45NWn81TIZmtGNpAokWA1M5Csv1lXGu9sxNXuUBSYlulrSE+InLhQj16g4ka2IqlB4D6upAt8zfGgOjS1KdfSS1hYZK3yqRcyQPNMQ/iGS6+btQlxgBD8oIo3hQVDRIQtTrZK1R/SIkzm6I0TVxE7ugInFA5/pL7lpSSSRuya9ApTlRLL9WdcQDRwXl/Prg8zleAOzUr19iakul491S0SSKXwUw46Rbw6U23ZHuzblT2gtEZqhZ76Dlc5Xpbg8r8FP4eihJeqm5j/a+PtS2f3gCWaIyCX5K3tQHeKO51lImm1CWS6d0kbunVhUFlX6HRgnbEp+EuXFuqbJ9E1Cbn+mRhMnzdn8xtwKUUk5wisrUWYl8n/4BtLlYNjqiDyL8DqPUPdwE9Ktweb18Z1ErtGWlT8+1fxfqaPsg== X-Microsoft-Exchange-Diagnostics: 1; DB5PR07MB1718; 31:q68UXctHjMg4wmUWpQjWefUHeD3gfrpC5Cu32hIWB3dLsO3TJ5LfZOnsg2m2Ummg8CVS5zaba53nQ0zF2ApcJvov88i8ZxogGoz6Idqw3qnDW1mCaOyGjz3UYJa+/vtVZCH2xWjraKRvrLxgF2bMoaPMhqL/W2K9njf1MnqDhk0WQaqaIHKQSGmbNDDz8Dk4lEKeetI80GJDtrI2dWw8D6zig4caLvKmfYm3lkFo48clzOdXBawCPb5ufYoP6Hjy2Hi7YSDFuA8mFPq5Juz5Jw==; 20:GHcnkfMdIxROmh3Cxwmg4n+spCDNsbFO+XlbAGDfQTcRah/L7yPeCV8yZzaQUFOum7OfyHxcJ//8XqsRj/RBZHsDtGhHjLzvJCuShYuZ8NssOkwb5E/uEosoXY9sU8TDzSNIOva6dre+y5UjYdBruOIaikWwQAwQhopUTC/TL+LXGMIRJgqPxK2+aR0csBokYblDMBEzRNXaiSycixf8QLK0rLt5kdHbJeEfE9p9J2x3y72YuDXngw52n8dvHlJi8k8cJuzgiSRIMPdOelPoPI2kHp9se/UU4ARvuQGGX4o7jCsUMxPyjQ+2wYr2r9dJU3om3RnrR342jTEIBzxRWBEkeMq7Uy9zabXKOUE3mUnPFOXBS9bT776+LqSv1dOuAAnZ1UA5V7ryvZVwKPcydryp7oGjjiVQEZeXn7/VZ8E2Z6RrvWY9R7lLMKcLXJ5nkousd4ruPaQzJjmlABswK7WrlwzpW5W4Pw9un769gxBiPqhjt7cDSdSqixm44ybB X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123558025)(20161123560025)(20161123564025)(20161123562025)(20161123555025)(6072148); SRVR:DB5PR07MB1718; BCL:0; PCL:0; RULEID:; SRVR:DB5PR07MB1718; X-Microsoft-Exchange-Diagnostics: 1; DB5PR07MB1718; 4:nDWnAmTapUIUTG18pd1PQzTvDztKpV65L1nc83menewXMNl8RiaFXJ96tlSxZEN8536tozakPt9ybV/cywNx9HukgRUJiVL/1b24hXnlaQglorVES/UeUXqWwJumfX+6bAow2GKuuNkl+sL6EE+jPGYRBILOh3EbfJx5vUnvWp15cYUgL4nFkR+hzb9XZP0XOhCw27/OrnU8EZnSPsSFpRVFzxcn8dFsEhc5c480lGN1K1pDLD/3je370Ke+4CWr3c9+593Tzez/Nt5zTe2TlnsOrBJMv45ErPU+V0pG0ftIXZJCdZ+vByHKgrvLl5QD/azdvSRwpLSSp/MSTtvKsaEufXGuxCut/J28v9qBtTM220RcaGGt+OVdAhok6wKiKByGzc7uL0xHlkqTfoPeOM+125WQMoQaTHxBMdZclRLFF/KentkRUiAhgcSspE9W2FFiRwDzpCe/QnKP9ZOgMROMAi2zqOoxDUMx6yUJ81GVhAZPIxPRvI9yMGLDquPRFOhXu3fbMpxJV+B7fJtRnctw14BhnrGvemKbhXWA1AF4DQkSvheQjr6cxPQf30xSWXWlHIPMEzmGbp0zqdPpBDBeIB31+lv0r5YBsKJVt6M= X-Forefront-PRVS: 02524402D6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(42186005)(76176999)(50986999)(6116002)(3846002)(6666003)(6916009)(6486002)(6506006)(5003940100001)(66066001)(2950100002)(36756003)(8676002)(81166006)(1076002)(47776003)(7736002)(6512007)(5660300001)(33646002)(305945005)(50466002)(2906002)(48376002)(38730400002)(110136004)(53936002)(189998001)(86362001)(2351001)(50226002)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR07MB1718; H:elxcz23q12-y4.ca.am.ericsson.se; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB5PR07MB1718; 23:4Zt16RwLfbk3oH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D58UTSvkJdg3plpkFqupl8sUZsp2ECF/E0rAUI09KOWVpxuyFYlNeHxzcE7FimjlfskGkDB1cxPmoxCUeJBIFT/aAqc5rQIWMRYDZSPLuKJtvwPWqGEtxFtiH6XvWsxaNotzqCnuxCjrywjzOGGFdTJc6iaAAVPfntN9CCt7dci/4LaAOagBhY6nLhVXsbk9NrhCZco6cp+MLpWxpOQUTEhC9mM+gGqwRqEIGj8JFn8/y6cYodqYfu12k2ig+LUtqZQxpyu1fU4Xw==; 5:71zEttYTVe44D1h+LKO+g2tk8l9kXVBuAqOEsZSuPk2Zi+eI899hS7JWevxsj4kaZElK+7STXmto/PMc8DEISFBkxf+qNVZixe030DU0qAI9Yvqq9u/LTmammTPPhEvPW0Qshbo3CDCozSKuUZU2og==; 24:dgHovdkk0fcoyiRyaaQIW6iYfSOSOKfeOdTCcv0haXFWASgZHYKKYy1BnAQHZ33GlwuqhbUveXjzXwky2VRLRVfEHCHt8dPxc+X59t3QsuA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB5PR07MB1718; 7:iCMTQ6KJLkpeEQSbdCX4MP/odBPPsS4D8lDfRtZWSAM3fbncnBuvRUgRfQuC2E3nK57CtgzITe7QF61eAPxM7sVerB80NxpDOf05chljKM1nu9wDrDaBr3l3Kabnm2CMSySq71eBmGLV14mpsjnubxZ1nzqU09+sMLbFkTYHC3ZMtCyP5wGpt903OHynixM0afpfrKGTmgiEmN+uyse5efC884cTHpXSYuRDdZjPmGGkDLQrVStO9ICK7AXbjn572s3s5OSmyWCXaUVutqSCVFK+7UTKDme4HOqEVON3jf8xe9myUfv6rC8xYy2UgX6G+0N6asc3iwcUMft5dJFMww== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2017 21:52:05.4489 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR07MB1718 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes From: Simon Marchi New in v2: use scoped_restore to save/restore inferior_ptid. The implementations of to_fetch_regiters/to_store_registers in the spu code use some functions that rely on inferior_ptid. It's simpler for now to set/restore inferior_ptid. * spu-linux-nat.c (spu_fetch_inferior_registers, spu_store_inferior_registers): Use ptid from regcache, set and restore inferior_ptid. * spu-multiarch.c (spu_fetch_registers, spu_store_registers): Likewise. --- gdb/spu-linux-nat.c | 10 ++++++++++ gdb/spu-multiarch.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c index c5b91222c1..19552fc1fe 100644 --- a/gdb/spu-linux-nat.c +++ b/gdb/spu-linux-nat.c @@ -492,6 +492,11 @@ spu_fetch_inferior_registers (struct target_ops *ops, int fd; ULONGEST addr; + /* Since we use functions that rely on inferior_ptid, we need to set and + restore it. */ + scoped_restore save_ptid + = make_scoped_restore (&inferior_ptid, regcache_get_ptid (regcache)); + /* We must be stopped on a spu_run system call. */ if (!parse_spufs_run (&fd, &addr)) return; @@ -539,6 +544,11 @@ spu_store_inferior_registers (struct target_ops *ops, int fd; ULONGEST addr; + /* Since we use functions that rely on inferior_ptid, we need to set and + restore it. */ + scoped_restore save_ptid + = make_scoped_restore (&inferior_ptid, regcache_get_ptid (regcache)); + /* We must be stopped on a spu_run system call. */ if (!parse_spufs_run (&fd, &addr)) return; diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c index b99a1a3de3..abc46535cf 100644 --- a/gdb/spu-multiarch.c +++ b/gdb/spu-multiarch.c @@ -149,6 +149,11 @@ spu_fetch_registers (struct target_ops *ops, int spufs_fd; CORE_ADDR spufs_addr; + /* Since we use functions that rely on inferior_ptid, we need to set and + restore it. */ + scoped_restore save_ptid + = make_scoped_restore (&inferior_ptid, regcache_get_ptid (regcache)); + /* This version applies only if we're currently in spu_run. */ if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) { @@ -203,6 +208,11 @@ spu_store_registers (struct target_ops *ops, int spufs_fd; CORE_ADDR spufs_addr; + /* Since we use functions that rely on inferior_ptid, we need to set and + restore it. */ + scoped_restore save_ptid + = make_scoped_restore (&inferior_ptid, regcache_get_ptid (regcache)); + /* This version applies only if we're currently in spu_run. */ if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) {