From patchwork Wed Aug 21 15:58:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 34227 Received: (qmail 115105 invoked by alias); 21 Aug 2019 15:58:37 -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 115097 invoked by uid 89); 21 Aug 2019 15:58:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: EUR01-VE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr140077.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (40.107.14.77) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Aug 2019 15:58:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V9+GmjDCiwza0xPjkR0Op8lwZ4pWHxxy5OGLBgKh4FU=; b=HmE/1DxYgZpGH3LEbUh384OytVUgLLs8TktIiptvrKPSRmdvRbggaYWzzsxNymuDqSCjl6nHtnWs5UUosQMecd9Obk2/KfCSxT0dvjEm6DqP96I4+wVq+TIlOrdf+fhE/2zljngURkNjOkorRtQprIX4RwW7f7S01dv38rIJZok= Received: from VI1PR08CA0160.eurprd08.prod.outlook.com (2603:10a6:800:d1::14) by VE1PR08MB4959.eurprd08.prod.outlook.com (2603:10a6:803:110::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Wed, 21 Aug 2019 15:58:30 +0000 Received: from DB5EUR03FT015.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::200) by VI1PR08CA0160.outlook.office365.com (2603:10a6:800:d1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2199.14 via Frontend Transport; Wed, 21 Aug 2019 15:58:30 +0000 Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; sourceware.org; dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT015.mail.protection.outlook.com (10.152.20.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.16 via Frontend Transport; Wed, 21 Aug 2019 15:58:28 +0000 Received: ("Tessian outbound 220137ab7b0b:v26"); Wed, 21 Aug 2019 15:58:28 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f9b4ee9d7f034fb4 X-CR-MTA-TID: 64aa7808 Received: from 3efed9d41f37.1 (cr-mta-lb-1.cr-mta-net [104.47.4.50]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3F5CF5A8-2AE5-457F-80E6-A9042795BB11.1; Wed, 21 Aug 2019 15:58:23 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp2050.outbound.protection.outlook.com [104.47.4.50]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3efed9d41f37.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Wed, 21 Aug 2019 15:58:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YJbGE1gndbI1CscAiFgS6rNjUbbeDtNo6Jg5BrVOpHQGviiTs5le1btgdzTSWjwxLDZSlYbPs3tU4Nj/qow8BmmVUFWucZ9fgQ7iOyVnNMdWb2pU6d3wIi0RrSg61kxTagpoEWVzwu8z1DkUzqOz/8nYoxFKZOJ7x/+WTtiK7B3EZLUov2YirxqM6lOYi1Sl2baoWVTvU2voqErU32t84InuWzIZchtTHRYCyGKh6AaUF+n9uuyxCt7MgW3KzEIUF3uwDecJuB5pXyDfazpMIb4rAr4CKMAsPZzVD/tnvZ+Q8z/fvxN4KN2lC1BZW71UgEMYTwuHrLXDCwRw6OVlQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V9+GmjDCiwza0xPjkR0Op8lwZ4pWHxxy5OGLBgKh4FU=; b=SBH5lxstWDvOoTAZ8xap/liYQEiLXZ/glvq/VlQVbzd1rkjqCLynQ6u22xv4932rbPOHRnmwA55nKHLMrq/AxoodHnfYisxLuLaQpJ3ljSH8/d0cNmaRnC1pEPafc1xZUftedLyY5M/RJUSeXM+pxeLoIpgiEJoBNVyC7jIc0p86aKFZugEflnh7i+epxsg9RZOMh5meIz7CnzDFsvIFKS4047sBvB8Es8SwrqopWpPPjp+7kFCDIRDWmp85HDX6yFOljehSbMSH48CsIE7JzuGzcuFUBEN2uq2GOFvxL8uqNo/voxbwzzLJ68mtSmp1SqhrMS80nMUgIXfIfEKIyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V9+GmjDCiwza0xPjkR0Op8lwZ4pWHxxy5OGLBgKh4FU=; b=HmE/1DxYgZpGH3LEbUh384OytVUgLLs8TktIiptvrKPSRmdvRbggaYWzzsxNymuDqSCjl6nHtnWs5UUosQMecd9Obk2/KfCSxT0dvjEm6DqP96I4+wVq+TIlOrdf+fhE/2zljngURkNjOkorRtQprIX4RwW7f7S01dv38rIJZok= Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com (10.172.227.22) by DB6PR0802MB2344.eurprd08.prod.outlook.com (10.172.228.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.19; Wed, 21 Aug 2019 15:58:21 +0000 Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::8c83:15d:248f:3a]) by DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::8c83:15d:248f:3a%10]) with mapi id 15.20.2178.020; Wed, 21 Aug 2019 15:58:21 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd , Alan Hayward Subject: [PATCH v2 2/3] Use gdbarch for probe::get_argument_count Date: Wed, 21 Aug 2019 15:58:21 +0000 Message-ID: <20190821155816.45504-3-alan.hayward@arm.com> References: <20190821155816.45504-1-alan.hayward@arm.com> In-Reply-To: <20190821155816.45504-1-alan.hayward@arm.com> Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; X-Microsoft-Antispam-Untrusted: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DB6PR0802MB2344; x-ms-exchange-transport-forked: True x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:3276;OLM:3276; X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(346002)(396003)(136003)(39860400002)(189003)(199004)(54534003)(476003)(11346002)(486006)(2616005)(446003)(25786009)(478600001)(2501003)(86362001)(66066001)(1076003)(6486002)(14454004)(53936002)(5640700003)(81166006)(81156014)(8936002)(44832011)(8676002)(4326008)(5660300002)(50226002)(102836004)(36756003)(66946007)(76176011)(6512007)(6916009)(6436002)(386003)(6506007)(3846002)(2351001)(71190400001)(71200400001)(6116002)(52116002)(305945005)(186003)(256004)(316002)(7736002)(26005)(66476007)(99286004)(2906002)(66446008)(64756008)(66556008)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0802MB2344; H:DB6PR0802MB2133.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: 5NUzCNED6KEq1GNrawNmGOI45Abs7KWg4ialS+pJ+ZPpCslNHtmvUaiYEAN2aQNbKxhfNInScOAE1+T2Kg5XcbZMQqGCCngG7HygrMeHKJvJ3WkG20guwZoYF338qw7pT6eUmIt5ZYAtytCPUjpnRiz2OZ5nboeAlIyyWtATv3klZ0B7ZL+6cwxBDfcSF/6Uy/J7Z299sn3oqYBUkrIelFLmt7RXD4nTIW4nsSu/Tf1Tg/oaRbJrRRxhht3xSVmRH4oYFMhbUiy9+RiZY76k5/MO3V0pNxXQnq+fyAqHIIr8ffCN/zlL1skwDNEVZba4TQMQS8951xOJnw0kl4Nlq32Ot3wD1WRQrqEadPI9Ian/9d4i54fflMOTqLTBdStUAAJgMus2D9ZvoysOeztbP9Lox6DVCbTboyBvSwKzR/I= MIME-Version: 1.0 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; Return-Path: Alan.Hayward@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT015.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: ab118d6b-ebd0-4bd4-11af-08d72650642f X-IsSubscribed: yes The probe function get_argument_count does not need a frame, only the current gdbarch. Switch the code to pass gdbarch instead. No functional changes. gdb/ChangeLog: 2019-08-21 Alan Hayward * break-catch-throw.c (fetch_probe_arguments): Use gdbarch. * dtrace-probe.c (dtrace_probe::get_argument_count): Likewise. * probe.c (probe_safe_evaluate_at_pc) (compute_probe_arg) (compile_probe_arg): Likewise. * probe.h (get_argument_count): Likewise. * solib-svr4.c (solib_event_probe_action): Likewise. * stap-probe.c (stap_probe::get_argument_count): Likewise. --- gdb/break-catch-throw.c | 2 +- gdb/dtrace-probe.c | 4 ++-- gdb/probe.c | 7 +++---- gdb/probe.h | 2 +- gdb/solib-svr4.c | 2 +- gdb/stap-probe.c | 6 ++---- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c index 0677a55ee5..2c2a3b7d72 100644 --- a/gdb/break-catch-throw.c +++ b/gdb/break-catch-throw.c @@ -113,7 +113,7 @@ fetch_probe_arguments (struct value **arg0, struct value **arg1) && pc_probe.prob->get_name () != "rethrow")) error (_("not stopped at a C++ exception catchpoint")); - n_args = pc_probe.prob->get_argument_count (frame); + n_args = pc_probe.prob->get_argument_count (get_frame_arch (frame)); if (n_args < 2) error (_("C++ exception catchpoint has too few arguments")); diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c index 2d92edb11c..e9e71fd4c9 100644 --- a/gdb/dtrace-probe.c +++ b/gdb/dtrace-probe.c @@ -122,7 +122,7 @@ public: CORE_ADDR get_relocated_address (struct objfile *objfile) override; /* See probe.h. */ - unsigned get_argument_count (struct frame_info *frame) override; + unsigned get_argument_count (struct gdbarch *gdbarch) override; /* See probe.h. */ bool can_evaluate_arguments () const override; @@ -693,7 +693,7 @@ dtrace_probe::get_relocated_address (struct objfile *objfile) /* Implementation of the get_argument_count method. */ unsigned -dtrace_probe::get_argument_count (struct frame_info *frame) +dtrace_probe::get_argument_count (struct gdbarch *gdbarch) { return m_args.size (); } diff --git a/gdb/probe.c b/gdb/probe.c index cdc6e021d2..8b108d6b02 100644 --- a/gdb/probe.c +++ b/gdb/probe.c @@ -695,7 +695,7 @@ probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n) if (!probe.prob) return NULL; - n_args = probe.prob->get_argument_count (frame); + n_args = probe.prob->get_argument_count (get_frame_arch (frame)); if (n >= n_args) return NULL; @@ -818,7 +818,7 @@ compute_probe_arg (struct gdbarch *arch, struct internalvar *ivar, if (pc_probe.prob == NULL) error (_("No probe at PC %s"), core_addr_to_string (pc)); - n_args = pc_probe.prob->get_argument_count (frame); + n_args = pc_probe.prob->get_argument_count (arch); if (sel == -1) return value_from_longest (builtin_type (arch)->builtin_int, n_args); @@ -840,7 +840,6 @@ compile_probe_arg (struct internalvar *ivar, struct agent_expr *expr, int sel = (int) (uintptr_t) data; struct bound_probe pc_probe; int n_args; - struct frame_info *frame = get_selected_frame (NULL); /* SEL == -1 means "_probe_argc". */ gdb_assert (sel >= -1); @@ -849,7 +848,7 @@ compile_probe_arg (struct internalvar *ivar, struct agent_expr *expr, if (pc_probe.prob == NULL) error (_("No probe at PC %s"), core_addr_to_string (pc)); - n_args = pc_probe.prob->get_argument_count (frame); + n_args = pc_probe.prob->get_argument_count (expr->gdbarch); if (sel == -1) { diff --git a/gdb/probe.h b/gdb/probe.h index 8abf69e354..7410c5aadf 100644 --- a/gdb/probe.h +++ b/gdb/probe.h @@ -131,7 +131,7 @@ public: /* Return the number of arguments of the probe. This function can throw an exception. */ - virtual unsigned get_argument_count (struct frame_info *frame) = 0; + virtual unsigned get_argument_count (struct gdbarch *gdbarch) = 0; /* Return 1 if the probe interface can evaluate the arguments of probe, zero otherwise. See the comments on diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index b21eacb68f..2a44dd6985 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1756,7 +1756,7 @@ solib_event_probe_action (struct probe_and_action *pa) arg2: struct link_map *new (optional, for incremental updates) */ try { - probe_argc = pa->prob->get_argument_count (frame); + probe_argc = pa->prob->get_argument_count (get_frame_arch (frame)); } catch (const gdb_exception_error &ex) { diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c index b6de873d2c..700b657967 100644 --- a/gdb/stap-probe.c +++ b/gdb/stap-probe.c @@ -136,7 +136,7 @@ public: CORE_ADDR get_relocated_address (struct objfile *objfile) override; /* See probe.h. */ - unsigned get_argument_count (struct frame_info *frame) override; + unsigned get_argument_count (struct gdbarch *gdbarch) override; /* See probe.h. */ bool can_evaluate_arguments () const override; @@ -1301,10 +1301,8 @@ stap_probe::get_relocated_address (struct objfile *objfile) argument string. */ unsigned -stap_probe::get_argument_count (struct frame_info *frame) +stap_probe::get_argument_count (struct gdbarch *gdbarch) { - struct gdbarch *gdbarch = get_frame_arch (frame); - if (!m_have_parsed_args) { if (this->can_evaluate_arguments ())