From patchwork Wed Aug 28 01:50:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13780441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1C09C5474A for ; Wed, 28 Aug 2024 03:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EHWC+SfKQZU4x5+3U1K0Xq7drTMGvU/j7ZyAQp0cv5g=; b=0Po79qCNFhobOjzb4lEIGL/QkX TQi/PxmxgOU2+iO1wE6YdKxUMVrZ8Ojxh/TGVuKYG0MM7Awt+vzIZej+vBRXe9Uwufj1oo+CG6PuK dz1Mo1tOQivyc+r6e/QEEdJZMLslcqcfr7OB0raJqXyn60GPMbyhqE+0zH00HdsucVmLPfYWuOhL2 nv2GIFwdYzTBi7KQZmR/TN8InE+tYU0ErmXJn82xjFhVaN0Br1XD5R9DsmlTuefg4/R8H/ndfxE3y sJGeoaPIMzWkmpuOKS1pKWxi1ZAY8Ex7o3xdACDtMltPZ6+nQJ88Bc7vzBGVV0kLwrC6qgWXNUvqv qjwQ5cdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj99m-0000000Db2e-0cc9; Wed, 28 Aug 2024 03:15:38 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj89v-0000000DRo4-3wWg for linux-arm-kernel@bombadil.infradead.org; Wed, 28 Aug 2024 02:11:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=EHWC+SfKQZU4x5+3U1K0Xq7drTMGvU/j7ZyAQp0cv5g=; b=jelF+vwAS0v8/jRtQ7+vlB+cyH vDQn1QRSHiVuIvYM87yJYOY9tYx03ta55PLgFTnsy4hKpUZEZGs1HixgpeTKI5CBylHKXWwx0BX8h AVRTUmV9CQVzFyEc7KM2GbM8Mz7xw+kpRk2J7GLDI4UKFSEcyfpG0oLB7dwBrXHgM4LjzGTAfWP/L iyk9XEj1lgpgnu1cZYFesNRcu3ZxHFwtS/Ff7wNca2uFibqe4sWB5olrWBojPa5Wyup/3QhlbUJUZ ywFQ+Md/E2Aisxc66USj8wgFrXEjcMZD4lqFq3lJtQw7ZhVRwCS0iIciLvVd/WMyktCx+d17FbgWc 5YEQVkRw==; Received: from mail-centralusazlp170110009.outbound.protection.outlook.com ([2a01:111:f403:c111::9] helo=DM5PR21CU001.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj7pk-0000000Azbp-1ZUw for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 01:50:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RNnpJ8Ll8UadOdmDHFXbNPz9UbOXZUrJgMf98MM0VpUj/R7n9NdC30nUUKJI1+o4rS6adzW3MhAcCJGDlzetbMNGm1jRURk01/j4wAz1rSBwD7sgH3lI3HlVNetHNWOyaGKH90WCvVKWlpNJnQlqjecozwkeJqaXIOqM4rQuDMZt8eQag9AiAAfF/YK21QCqGg5jzxn+IdSFvJwZvq7MZnsFkcEuALpfi7Ty65ZvkrRRA/je1sG5wkbs3hX7q+0teWMkQ6r7hF3IsFyKhrGevvW4qwdoBSLQdb7MyTgoDhM5evxzErlq+zOeGJxVs6U9A6LA0YoO1fxuuELE7oI39w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EHWC+SfKQZU4x5+3U1K0Xq7drTMGvU/j7ZyAQp0cv5g=; b=Pae/J5dVy+dpZE1eeNkTOkRRQigQrx+67mIn6t679UqezTjWm/7J82hgWtsB7IULjGNRpWRilTyFju6N+eBTM/77WN2lQoZi11Oh/UzxW5Ceq94jwwC5moMTGyYdKUI4SSsqVMQLnd88KaruD3N62jskNjnD+kfwnAa5JCQH5O+H9VggfpyMiBz1U1N5gSdWb9KwB5IlCFWm8xbL+yuWS+ovZK8dKcr+68YCb7aSY2jFj83NnRN5u/f3NfsHiR/3qYEFgCFNpaKR0YdaXXXhHa2a1ieRVv2If2n2QBup3k8c4qe4EuNrW4c3NPV6W0ovdw60aSdWVeL6RvtLQ+Gh4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EHWC+SfKQZU4x5+3U1K0Xq7drTMGvU/j7ZyAQp0cv5g=; b=PZOVqYIyvSrt2oIUgzKdcvidec5pmQfu7T6Kn6rHUNihTbQUcRWtPsGBMi3ox8bSaCgJB87QUk5pLF+SZ1WZs3pR9XmLxQdPhLxxq9B/LuCP7z3bhbKmLrTsIfWkgXxVXkrrUzJMaPVPoKA47JczxicWYOUWBRyUa3c+7ZJobE8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) by LV2PR01MB7576.prod.exchangelabs.com (2603:10b6:408:17c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Wed, 28 Aug 2024 01:50:38 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%4]) with mapi id 15.20.7897.021; Wed, 28 Aug 2024 01:50:38 +0000 From: Steve Clevenger To: james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, leo.yan@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V3 1/4] Add dso__is_pie call to identify ELF PIE Date: Tue, 27 Aug 2024 19:50:16 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: BY1P220CA0004.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:59d::15) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|LV2PR01MB7576:EE_ X-MS-Office365-Filtering-Correlation-Id: d59bf81e-5ff6-49b9-d65b-08dcc703d0e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: Iqae7ms85OcDHJCZLgD1Ql7B+BtW5yVTX3fOJ6aqn0lgm/XspWDkv4ORIkQwnzXiUeBNVil460f7QfGSvc1czhWl0AHlwlTcUkDeD2Z6udTl3QfbOK1hEr/AmFz6aFEbCJCu+B/rr08T1tCDGIb2z8xZ9wJSgthMIOrz/W0MX44xohV0CFd2k6dvyLLLF85GUQwGGftroD1BhbITqfug0iekwYk3bsO5CztEsMcloqPV/aSLKe2v7O/wSTYLCsYH0tsYKWtUtQ6k7IwAHfUj122kUeSwsxxuyHsAKbs6lfwtZ1EwGQMDiDhKEmJ0KvV89bLKRdaM+P5zmsCuPjtp0jxkfZHRdQalHlj77hD+DD9w+lP7xUgCrBLBec8WDrddtIS3W705ZXsUSaU5vFmuLhuMdf3JMbBpsYmxLz8aBE4p9atfeFOwxEbzYnyUj+2hqgf+jeCbaS4lSCAHF/Q0PmdquaAGIfaJWala8NHddFb6WTv0bDO0x17etPYoTxd1FQqQF82YIsUr1mHTSyctiCTzWUpb+Ymwympo+mhZ0uBM4p1QOvzNkZd4NSadY+Rfb1qUyn7DSXx0n3dhZAezGZqWPcKI5v7CW0PMe2LQ0U2jCSZvV04vCatlOaz99/Xw7taCeXe4LbDHCDOk6HURaYjGewhLGJKN5VEwvOdw6We44Fjm2LGZDOjiq9Cj/Ex34F6fpHGFA/JaVC8/P0BiWH1+cJVzlGZY5W4hSk4CkP8hP1UcpRUUit21aQbi0N3VJ7xMsETS74Faun9IUm99rr32X5VOxKTff3rjA9jlTjG3wDy9pto+zYLRzkGFQa0oTKbK4b/38xndbI5sNCdRCRVphlMMHW12Lf9yB9NZRAxBDjx0y9vj+9r/aEYKPsHZzUupcl87+4yRi974aomL4EC869XW0TFo6irZ+LuqEk5ooPNJYhb8Jcm5rF116EAfwiq8PdPnhjRBO0WkBMHZoCVgdw7k2mKlAj9b2FInY/+2ERQS7Cle7nLeDn/qAKRxoWiDdV4aM4J/D6eBX8WodLHKuyaA+gUmjg4B2NFbJ2t5/m0bZd21F+q5s+HIxI4o8xDMLbIhxV1s8HT9dmtadsoRz/PmggXeqmzPDE5445imqvBlm8H0qXYBWj42dSidemHyL5w8rDCl2UlY/qnA3YlfWXfcx0uRn5dpYL6Fu2Uzvr67F5EsUhTs3GA43mc4EIWP5uDXlmAtq+KngmqCMMDsU3d2YBesTJskgZUf1pSif3X+D6bYrN42rmv30NlAGa3A2g6Dg1KaO2/zTQu0uZpfNZbugt8WwN3fZ3wG1lZ3u1QrKKNTW74MyUHc9NmCRIax8u/CrKhsOxjsf4UTdnhMqou3nvxYMSlBjuQj/skjUSOua2CPRCJ6A1F3TUnzM2XCwJCXdKiIuO3kjyo4QA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR01MB8146.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DKPf+3YsXlXSldmD8SJZxDVayeuPZpmdt4inuTK+wXuZFwgSpzfjcnEwM+QWpjGNgaSJRdRCYXmv+1Rc5xZTm42EjdUz8rdRLwPORWZLbqhAmLu1Cm8sTCEdKsxEZ+idPcBi6aiorMWFU5hgguNh/1PxyJ9HmPOg22pg47k9a7z5zLsvswVN4JMQ8Igdwow9lzH9BjpHIkL31Hv7KF7hAvfv1zOr71796FYugzOZmklDbncJ02JXijfH7ohSzVhf+42Y4s3FXjAx910KGVggTLcChSedChawXtLvY+OCfMbUZEHj+Y1LQZW+fIRfjwRy8wMb4tRXpYjL/luwMNXllrUfhWQzaXOekN5xY3fqvslkbNaQsmmFUpydK+nNuv92fOzRyMp5x5fAXCxcPLRHQmQEahGZarvS3wPcc0357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aeOI5FXMlUPU8bjzcMgBVZG40Cs6b6TYbLP0KKl7xcl9xLYLQA7+gOPl05VPzc7jhYSyxPvGWai7yZLYv8SHdWoFNQb1+SUJdspj7gQY7Zc/lPuQ6RKdT3UXO5VF2gvL29oiZ95JyqDb+vasPrZjBX16a5qCidy/0aW5rx4u7 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: d59bf81e-5ff6-49b9-d65b-08dcc703d0e3 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 01:50:38.4135 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: siugeZ5m5vVKzOByMeKIzbN0IV4/r2QCp8jBB1BTnxBIshYQZD0dFcH/IYK81QW6QMk+UBvOn1hILaS7saYvUPe5Ky8wGJ0XpwHQ+JM9BbJlAq9Y11In2oDsvSj3Sc52 X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR01MB7576 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_025052_707366_08D49861 X-CRM114-Status: GOOD ( 14.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add dso__is_pie global to read the .dynamic section DT_FLAGS_1 entry for the DF_1_PIE flag. This identifies position executable code. Signed-off-by: Steve Clevenger --- tools/perf/util/symbol-elf.c | 60 ++++++++++++++++++++++++++++++++++++ tools/perf/util/symbol.h | 1 + 2 files changed, 61 insertions(+) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index e398abfd13a0..0e49c1345a67 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -662,6 +662,66 @@ static int dso__synthesize_plt_got_symbols(struct dso *dso, Elf *elf, return err; } +/* + * Check dynamic section DT_FLAGS_1 for a Position Independent + * Executable (PIE). + */ +bool dso__is_pie(struct dso *dso) +{ + Elf *elf = NULL; + Elf_Scn *scn = NULL; + GElf_Ehdr ehdr; + GElf_Shdr shdr; + bool is_pie = false; + char dso_path[PATH_MAX]; + int fd = -1; + + if (!dso || (elf_version(EV_CURRENT) == EV_NONE)) + goto exit; // false + + dso__build_id_filename(dso, dso_path, sizeof(dso_path), false); + + fd = open(dso_path, O_RDONLY); + + if (fd < 0) { + pr_debug("%s: cannot read cached %s.\n", __func__, dso_path); + goto exit; // false + } + + elf = elf_begin(fd, ELF_C_READ, NULL); + gelf_getehdr(elf, &ehdr); + + if (ehdr.e_type == ET_DYN) { + Elf_Data *data; + GElf_Dyn *entry; + int n_entries = shdr.sh_size / sizeof(GElf_Dyn); + + scn = elf_section_by_name(elf, &ehdr, &shdr, ".dynamic", NULL); + if (!scn) + goto exit; // false + + data = (Elf_Data *) elf_getdata(scn, NULL); + if (!data || !data->d_buf) + goto exit; // false + + // check DT_FLAGS_1 + for (int i = 0; i < n_entries; i++) { + entry = ((GElf_Dyn *) data->d_buf) + i; + if (entry->d_tag == DT_FLAGS_1) { + if ((entry->d_un.d_val & DF_1_PIE) != 0) { + is_pie = true; + break; + } + } + } // end for + } + + elf_end(elf); + close(fd); +exit: + return is_pie; +} + /* * We need to check if we have a .dynsym, so that we can handle the * .plt, synthesizing its symbols, that aren't on the symtabs (be it diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 3fb5d146d9b1..33ea2596ce31 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h @@ -127,6 +127,7 @@ void dso__insert_symbol(struct dso *dso, struct symbol *sym); void dso__delete_symbol(struct dso *dso, struct symbol *sym); +bool dso__is_pie(struct dso *dso); struct symbol *dso__find_symbol(struct dso *dso, u64 addr); struct symbol *dso__find_symbol_nocache(struct dso *dso, u64 addr); From patchwork Wed Aug 28 01:50:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13780458 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9EE61C5474A for ; Wed, 28 Aug 2024 03:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=EAiHOV4TUb2vdI6iyo+43VW/AI TUYkyfvg6NqeS4bKmX1G3KCAB0x6GsQjTiteZJWBfU/YgOUFnQCXnsi2c5ud797UpVvxP+kYWk7Bp jR8GRlquHlyIPp66rSLAb0TsaXvTMHACjXRGQCG5fpV+QP9jdqEP+y61rITjPanfFN+OjBFIMpd8r Mdk1rB/TiUd67TUBtgRZ1WL45pYPrhKy6AMsiBkYotmpxNDJzgnEcYHwysyNkA3cs+DPfNhaDNPyt mAqDpQi1wikmGdfy4e99C4IN08CwuxXWzjl8S/QaDm1raMBjGBrGJ7bqD6YFiuvxP+ARJUbhnhN29 NQEXtXPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj9OG-0000000DeZO-1IhM; Wed, 28 Aug 2024 03:30:36 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj8KQ-0000000DTCn-3t5r for linux-arm-kernel@bombadil.infradead.org; Wed, 28 Aug 2024 02:22:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=cMmJxmVBtpDvDrCsKjMdL14wJ4 G4mZb0B0Upeh4gmlC2EOfRJwjHFdocV1o099p53dFPgz27ZG1OpJW82njJ2tryg40PGITKo8gqb3n D9PBZSNID5XU0YarAOBfObavKKivnTQ3JLyPFlGmfEktlwXOPCCIcrIjSjLWz40Fhv9JOM+mwkf3+ VZjPs1TxPiA+AxYnGKWdpTlwdzAqmOz8mU8nxfuvFLKFzImazl32LWIBSJVikH+K+DyKIW70akJAR Vv56SRgDhNECQYEf4DmeeW0epM7tITNCzIELCbz4/vhCOCFvKn9OlNkNq7cnUuPY47fMwE+kJSW6U EY7wVPNQ==; Received: from mail-centralusazlp170110009.outbound.protection.outlook.com ([2a01:111:f403:c111::9] helo=DM5PR21CU001.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj7ph-0000000Azbp-2VnT for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 01:50:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ULbPfLdxhOHV40Fe5QzjmyNH8i6yr+Hu+UAezKOXCvZNdzgc2olY3nIgh79bvWN9d1Mcpfe1QSi5Yw8eF6WE+DLRnY8+himM+aXfd7uTvljsMYx78nQkS6w+RbM+J2hGkzihl/CXq4jBGqTui5EtolXR1+7VOMUx/Rx4f1mTGB4jv/saCVydXdo8MVZISWh5x4pylV68sGplxIJvLTNRp292fKAwV1zXS5Z0HNZlUGUHDOwn3x3Cb26FFX0NyJA5lkABNCiJgJQEwwIhRhyiM0P+JdsWOTaQ/IzoDqFg221tB7xnz1LNoPC5TJ7uV8H5m1V0DiDyZEdYGYvKzrg5gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=ozEo3c8X0Z8FGJY8m0FAodF911MErVxwE8nSXv5Cj6mxw9UTis1uJaYd3Rly8apCt50LYP4/0VucQgcnNO+Fr+lviJDXByTGKfAXzyFMqlsDjpMJmd0EmJA4lhrvx6mxePn3lINBW8gDdiq9dygxMH/+kSDkcVv8X177rKVb+O6PwWm4bIqQns9AXyOJDh7o5ygrLvvxCU4DZKZ4jOGoMnky6KzMmQ9H5rdQnegWYSdm+Kv5AYbPETQGMle7HBV5N1ddUHjKiT6rioSW1OfRIzKbPbPG+g/AQl8NeNWNL6qalq+I7KhKypnpX12QD0hCv3MCFhrIsrh1cPwSZENSFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=JNNJAMmJ7pPwAnavTcIGMUqDPWqLLSTIAA8POcg/WLS+Ei5+catygwTdyOtbyTmTE4ZxePV13PZNGvKgxAL57UgU6x0k3DP4jrRd6r1uUZo2lM30DLkTEwoBOYc5qyfFmDON+3oU0fy4c8RzQ4QGaM1k6vRVm+zrOND4SVAB2Vc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) by LV2PR01MB7576.prod.exchangelabs.com (2603:10b6:408:17c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Wed, 28 Aug 2024 01:50:37 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%4]) with mapi id 15.20.7897.021; Wed, 28 Aug 2024 01:50:36 +0000 From: Steve Clevenger To: james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, leo.yan@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V3 2/4] Force MAPPING_TYPE__IDENTIY for PIE Date: Tue, 27 Aug 2024 19:50:15 -0600 Message-Id: <85c2c76685f9aa55ada3178af8cd109f3dc7b0b0.1724808513.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: BY1P220CA0004.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:59d::15) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|LV2PR01MB7576:EE_ X-MS-Office365-Filtering-Correlation-Id: aa0b6f64-e357-4555-39ca-08dcc703cff2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: blAmYqPBvFFi/7GFz3AF4epkCU8M8cb2G/kUzD7fvfSklY1vQelp05zm0qlVewmcPN09X40FKDbuWgIx/1L2XTgduANMwRnWZker/wPBQT0sYxH6jr1dtEREYlfXrFPphzS+FE/Cssvh+295YSvfRAFW8PwP9rHRq/i7FgQQDNCvaBzRf92U63xc9adIXu/GrBiKKaQR0cOtJyhMowX5Zt1CB0kWmEnZWfwVZE2FszbSdbqkXaAEb/OfoW1iQ/22tfopYEtN/TdKsSFWJS62qCUrp49h8lkt4qlI3gglzDErhUUC4QNu/kC/ySjSMKaAi+fJdnqCHeeRQRtnNXMZJL17PsN3boW6m4ZsRfmUm3QpixzZSnd3G3fKCj5HbvKQ5LvnGQRU2thkcTvV38W7FyQttba58Yc6DbNBvciVEPbopo6rGoYjk/fx97DRm+8DFUQh0DT22Q5TWKyblqJFyhdjaLoT18cTsSndvYIH4+tytyUSDpJIniO1vydy1ZTyUVfp2o5ylLd3/Yi2E5vZNHj4qIuMuKemALpzakbBeCJRMkZS/4qBWW1Sc7IXjMiGwAdSkHC+s9dxEOs8fwLyuIVLEvzI5SbLhF1+V0ZZsiWbN38pBhsq4GRz+E9T25F5fejR2YBMqlUMAR7HsMo8rU9TZAzw0d8Du2Jb0F+NqOVmMoHB0R31qnVHZ8ZhwlqaI5ED+WXTpHWVYaBBHg6CTYIvZxjbHtCXS+AYy1duDDaX79dd1jaPtpri4svB53Ypw1yIUeBqx3at9rS8Bx1W41G/QSE9TbESmYYrwN9fXWzLSHqtMQqv0AuawhBZzdbYTaum/pro9sZHwt7EhAsImwf9Xhy7VeRx179ShgpPsjbqBIbkAfadDnMIyoOSU68uyd/GO4ivOxflHTHr4vBYbE1AvxkCHIzGzbXaDrVtwUs5HDBnkKjD03/BqaXmQo/oDh6fMOWqYykdBN+S02VRFWVsWRNP+BiJKE6pBVSb87dn61e24SeTfNFbtKXXKOiVr6Ug8zXHv6bUUPze9RzJte0fvXDK8rF3JVU4ECX1hKtfGotPpC+wNxmAkGW2wUbJ/8fFHaOiDUvP8zyiLyGSeBUNF75woAOz8y4uFLtO4ENOWi/OJmVigMj1dMA74rTSAqG4nVJmelQbtf9z9v+lCOvFvPcmRso9miKqyfpaawTQRsqayvndfiRCaGt41z0QCibVoj+y+zuFPC8iQQR8oreNxNGBGWKn3I0e+czRczukMd4qxlBITRNYLM/u8CQstxfCy9L8ZACVQt9AJ71Ywn30w9NCWu9hRzMwimky1q0Q1gD7e9AT5dwcbG7/EnE6vk0vP9/IKZ5DlNFpkT+IEd3aMBaX3Q2bgE9miuQYU1m4i5FX5M8COxTXXfUIQHBnP0eeCorc3vbetwxwU4Gi2w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR01MB8146.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a+GZueBaoi8T4vcgkMrhOKmHqR0PAaZ6hCpENrXMWZtbGY+RCpTdLEJ3XoRI4WzwzM9y+1JbJfVMGuwibWNNPn2GV6BExyBfxuNOQ/g2iCoZ/ST28+kTDfDi5i5QqHHdDuuF71b5vakFN5y97sqo3gBiCEuHv5/S6Ermtd9tn5aNuqW4Us6o6qIsDezl9uwvRfpgJvv1KGA/qqBUNcTlLdiEua26FJSZb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zOGG5CHtlagPTToji+3lX4j5SYN9QjmAoEDDIF/k2yZLdYly9cT/25SmKPGg8hiLbx3mjfbRDN8XsQwEFIet699SIMrBRKPWgTGzeybyY5ZoRLAVEa7+/xgLLgULxejRis9x8+N1ndF+3KZu79wjUHSchw/nqr5EM1SCB0WWpzxO0jJWwjflhS3CK8PHDGQDRKrh9qVBq7TcCf3IeDLT2M2qk6JCoMS8o4bq2oLTnZAriVAV/taroGZ9xs1uwMyoqMGERSshrlitBUBsSGG10jS13oWNobcI9B/3md8nGJF6AeOdrqP0bF+hiELI1aVpzEJ9nD6uT40auXDVAV5UfCudsxx2EEVV0HB7 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa0b6f64-e357-4555-39ca-08dcc703cff2 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 01:50:36.8652 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7dryqFgmLIXynoZLVAdv/wC60E5QYef2ca6RQNGYEHyPvROwZxFhG6q6XiSHSTi20G2sRNgVfg0g36XwhBCmLKFdTi+UKGkGLNdgrn7oDeS3ZIC8RVthV/LGZZGKLXbz X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR01MB7576 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_025050_151092_121F4197 X-CRM114-Status: GOOD ( 10.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use dso__is_pie() to check whether the DSO file is a Position Independent Executable (PIE). If PIE, change the MAPPING_TYPE to MAPPING_TYPE__IDENTITY so a zero map pgoff (text offset) is passed into the script. Signed-off-by: Steve Clevenger --- tools/perf/util/map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index e781c8d56a9a..c846faec177b 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -173,8 +173,8 @@ struct map *map__new(struct machine *machine, u64 start, u64 len, assert(!dso__kernel(dso)); map__init(result, start, start + len, pgoff, dso, prot, flags); - if (anon || no_dso) { - map->mapping_type = MAPPING_TYPE__IDENTITY; + if (anon || no_dso || dso__is_pie(dso)) { + map__set_mapping_type(map, MAPPING_TYPE__IDENTITY); /* * Set memory without DSO as loaded. All map__find_* From patchwork Wed Aug 28 01:50:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13780340 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3603AC5474B for ; Wed, 28 Aug 2024 03:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zkwZ+2zdwZ2vNhcwe9ZZTBO7ZbaQ5vYDrtH5ERwTq94=; b=SG+UFP2I9ku5nX7rfLfI1Uthx2 PkcA3iogg8zp/8V0ouTuC6gT6npw0rW5dZ7fPLPbguR8xwtVAQPk3ynDRjWhADBJ1/HEhzRrZWAZ9 PMl0oT6/Q9ZgC9jVCBrztzfGJJFMczNt4T6K2aPSV8NL7mdOIlmyD6sYpnsL0c4MKNqJmzTsizaMY 0tgWs+NyT1MmH80qBtGKuqOzJnl0M2GUcTts4TdEiLCGcpPagqAh9O8NSc8yjigf+MxUL1XQ1qH6P gGwQ6ZobbmXDzlarhYJHLiqGbosBgEL3Uf8lwoDi9tUkXypGklW/TtsKaqBpCKvyRKFbu4OHLgajv /n1kUECA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj8vE-0000000DYbW-4BQ1; Wed, 28 Aug 2024 03:00:37 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj7pi-0000000DPAG-1BKY for linux-arm-kernel@bombadil.infradead.org; Wed, 28 Aug 2024 01:50:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=zkwZ+2zdwZ2vNhcwe9ZZTBO7ZbaQ5vYDrtH5ERwTq94=; b=FsZruIF43muZKU/TourSjRQXJG tcRVdJR2jkoY7Ce3lrD5oD+uRFIrX8PMQfsuBGe0KLqQTVrPtgHdmMBnh0n4jZ9Aw2CvVTNcJ/yKs 9p6631xerDrO/IFwKRF1DQerF4HOEaeriK/oa0TBRWMcAc2I8g1uL9PMFDj0cB+kbWpmYw8JiWGEp gB9WiO8DHUfpEH0xJZTcZSRg8vRHHXKFf5hstcDOAKlZuJwDV+5rRE6u6FOxBk78LilTHL4p3hAf4 QWCvZzz7uYeLxt5+Ld+D5iWPqlGJ0Jg93E2FUvvtq+5CGj0Mwz0z1slQHEI0/3SAxC9bb9Lw3S3xw dH6sEmRw==; Received: from mail-centralusazlp170110009.outbound.protection.outlook.com ([2a01:111:f403:c111::9] helo=DM5PR21CU001.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj7pe-0000000Azbp-3Xqr for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 01:50:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eyr7gUO5uIeJsks1+jnvnDsTclxHwtld3VDXaXnDmBsvGNysesdJGL/N9eOj15ToidI42O17jYabYRYnlSdDh6L1MzHb8rz5X83+8TevIGVXIECK58TdayB5YOzuprglUpC8WYcd0qg+v2xV2mKfxzVpIyJl8qCfn8ypi+Qw7FMjsSZnEfyNZTHbm7PpazpooqntTJm1Gx77qWaap/yFSMg8IGEEXTCK/Novto0mYhes4fZkMpROo8glEOJnlR13TKbDEu2acnrEcs+UIRdlWBmdGO0SehtQK0uMEr0K/CQ7uX8TKQULKQQN3hGxqF8INbFQPnQEPvR7c9LyZL14ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zkwZ+2zdwZ2vNhcwe9ZZTBO7ZbaQ5vYDrtH5ERwTq94=; b=ldZxuNUMuRGsJdSSzl0seRZLJ5FWags8YsfLfzHv/S3n5LIqyEMeOSdjfkfAvVB+/LcP0ubONvM6d/Jy0b7MsNaRoYkdBEoOirfglFC06bf11i+B96Wc1fIdfPh1S+1sqoNeeu/AMN97O07f0dzlFfTvUcRpmjyX3KOo9V6FjkkkBbHfaNe+yfK9cHmXJHO0A8eUHxd9p8CJscMeDN5ObgN/zTqDKvx2cwmlp0lmYZKnliIcm+nDAA2Eg3NNJILOE+dV1ONQM/hWYsR2YnnT5OHhJ0mD/cbkGIwF7FqigcWT8yhyFtQbNATFmfZ6YwCB48/Mhj4wtVf9ggf7B9PBcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zkwZ+2zdwZ2vNhcwe9ZZTBO7ZbaQ5vYDrtH5ERwTq94=; b=Wpr3yOgrDAqIlfdzsJqxUl7gHa/qKKziNFq5ACDlbmNti/C2Kx4gowoxxCWqVcKaflIf93sbTuvyQbC0nrdNtniPM1kBaEs48e955znIp3ze8gTE7LoOUGgzQadVSnhJfONjSx5rJoE5WKm6lzhMERUXh4mWAcF+QOgZvj7w7Ww= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) by LV2PR01MB7576.prod.exchangelabs.com (2603:10b6:408:17c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Wed, 28 Aug 2024 01:50:35 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%4]) with mapi id 15.20.7897.021; Wed, 28 Aug 2024 01:50:35 +0000 From: Steve Clevenger To: james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, leo.yan@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V3 3/4] Add map pgoff to python dictionary based on MAPPING_TYPE Date: Tue, 27 Aug 2024 19:50:14 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: BY1P220CA0004.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:59d::15) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|LV2PR01MB7576:EE_ X-MS-Office365-Filtering-Correlation-Id: f2f588c1-cd5c-452e-d542-08dcc703ceef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: qkUuxJZxHXgYMm241vLqILXai7tAPBuwhwewHNmhC55nZHZ7iH6MoAnQPkO45rX4TrwXo/UkBl3DlFqgRNyw4bmS1S9/NNEl4bL8TH9l96+drg4UnyRCmAEx5+2K63Dc80j7zS8R4BT39SuBzq/+NoPylEOV8pEN8DiD4hz50tM6cmR1I9yq9yVm0LArmg4RJv2KSmbKPA2HffaL2z5eZL+bUW8kalY898XwSRoFj1kk+orQI0+IU35mt8YzuxYF8TVs5/EgVTb2nXxTuDrHt8S1BubPYso2Rs2NeMREBcAxCRgSnY3aFTRjHyAfT/BpjOMeEe08mdzCIU0rg+Nt/M9dFl+ViPrx4bq9Eiqv0r48pkfDPNlLt7LFfwECEuichd5iOhqJVzn8bVqBdRAcIJ8BwJc08ta8SLuTiXpAWWBXQyRXbPoGk1oRCBmCXxvcEe/W56NJRXveejQ/7MI5pB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gcq+Q2+T9A1cC/PsEOa2RVzUS3SAKGwbavJKtKx1Qr8+aPxCA7ONRh1kgQIXBQcU5xc0QQ967r0pbcrGiO2l/riPJNhsgWb4UkZSOf0HE8pW0kDFDLhzlUiYsJeb6W8jQYmrCnT9vF7n4WkPj1z+BXu6W41OvKmRj8aBkJpSe2Htp1nDPCyy+muyMl6fl0eBp92HVe394gUDYdMUxLdgCFKcuFCS7e9vQzKn0wNFhhJKi4jMM59hqW+ffLwhiisicgcNB654J7gsI7tFC3QHrQN/x9w6A9V3H+QL96CZ0UsyrrsuAagSh0by2tPdC01l5OjHsNobILrhVX7MuIoxbvhAHCpYSvtsrYvesAaMrOtkzoDIN3Rr7+IzqiTvS3dht/Nqp7wSoX1C0rMw+96fnYvA+lloI9M7EW/umXitdgaZos33h0rIY/i9pL5rpxl+rTFtv/Mkz7otrGGBb4c7M/P9v6VNnvMnw6hOYOYuMHN3fPAi8ZmCuh4PvmQDQ7txcUuAKEo4cMwycmLv2DnNcLgyK9k6nH2awj0ww/LQnx0WR05TYOBYtXYiPLMWUBWMf3Q3FxWqUJjfK6s4KRciCEQvqktnhD+HaSoLk76uSI0GhVVvZnrTibsv2uLhPG5x0sTCIitRJI2x70MA72yJYXZ3VbibhdhzTfC/eefmqXwca0nisbzEzl X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2f588c1-cd5c-452e-d542-08dcc703ceef X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 01:50:35.1505 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aHz8PO2G5lSTgorlvesG81bj69x5eJkDOAlGcx8DO6GOVfs0IPYMfBWgY+9QZOaLjB3GaFHRwl4PSVL7gKT4MlWFtEh7l8I3hMLpI0hajiXzIsMiG0sbdFhXluuMIFCp X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR01MB7576 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_025047_072360_55D395EA X-CRM114-Status: GOOD ( 11.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add map_pgoff parameter to python dictionary so it can be seen by the python script, arm-cs-trace-disasm.py. map_pgoff is forced to zero in the dictionary if file type is MAPPING_TYPE__IDENTITY. Otherwise, the map_pgoff value is directly added to the dictionary. Signed-off-by: Steve Clevenger --- .../util/scripting-engines/trace-event-python.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 6971dd6c231f..74b66692e3a3 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c @@ -798,7 +798,8 @@ static int set_regs_in_dict(PyObject *dict, static void set_sym_in_dict(PyObject *dict, struct addr_location *al, const char *dso_field, const char *dso_bid_field, const char *dso_map_start, const char *dso_map_end, - const char *sym_field, const char *symoff_field) + const char *sym_field, const char *symoff_field, + const char *map_pgoff) { char sbuild_id[SBUILD_ID_SIZE]; @@ -814,6 +815,12 @@ static void set_sym_in_dict(PyObject *dict, struct addr_location *al, PyLong_FromUnsignedLong(map__start(al->map))); pydict_set_item_string_decref(dict, dso_map_end, PyLong_FromUnsignedLong(map__end(al->map))); + if (al->map->mapping_type == MAPPING_TYPE__DSO) + pydict_set_item_string_decref(dict, map_pgoff, + PyLong_FromUnsignedLongLong(al->map->pgoff)); + else + pydict_set_item_string_decref(dict, map_pgoff, + PyLong_FromUnsignedLongLong(0)); } if (al->sym) { pydict_set_item_string_decref(dict, sym_field, @@ -900,8 +907,8 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, pydict_set_item_string_decref(dict, "comm", _PyUnicode_FromString(thread__comm_str(al->thread))); set_sym_in_dict(dict, al, "dso", "dso_bid", "dso_map_start", "dso_map_end", - "symbol", "symoff"); - + "symbol", "symoff", "map_pgoff"); + pydict_set_item_string_decref(dict, "callchain", callchain); brstack = python_process_brstack(sample, al->thread); From patchwork Wed Aug 28 01:50:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13780339 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12259C54749 for ; Wed, 28 Aug 2024 03:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Message-Id:Date :Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YigPosKCyA+QVqyfOxzq74WG+dtaoYHC96nYTYgVgG8=; b=P5I88F5PRulJvCPcu5l+7dhY2B plaksABN63ELV4HrJQ5eBg8eQnPUYv81Nop5AZnXz97NbtZ8hoj4I4UK63XdeEV8ta2lwj0FVcZmQ 30adYL64qYo5gTHPegamHYE973QocMBukdw2c3xG0xVRP0HLXWQ3JLNW8koIJvmiWjjxTw6fkxEM9 TsMMqXV/qmGhkvLmV0a2btj3i0Yj+/Ch3d9crAGl12BPQ07ZDErbj+JwjPgbdjZU6y8HOuzyWqqnw tw4u81ef6MRFTi/q63lThK98qWRJvTreJx9FD1YrPnpRUDmnREJpwIisSfzWAw/sx6xH4ActVhdGl c6M0AI4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj8vE-0000000DYb3-1i0R; Wed, 28 Aug 2024 03:00:36 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj7pf-0000000DP9q-2Yls for linux-arm-kernel@bombadil.infradead.org; Wed, 28 Aug 2024 01:50:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Transfer-Encoding :Content-Type:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=YigPosKCyA+QVqyfOxzq74WG+dtaoYHC96nYTYgVgG8=; b=IJnGOFFZ01ro+1PGxKFtUs46po lRW733PYOUT7TW1HICfC4hfsDwGyfBXGGZ2M2dFrqv85KSXC8Nr0KhT9ZRk0mbd5/ErPxOBl8Yi1Q 7tyntZ/WVo/xVIO1jB14I30m0ZELomlNToQKkHXXg9JKskYi4NS6jcjaVr4PayCIlTBewjpdQXyhs iL582jsYpSOfxYVLoKsIzPHvY2SKLdgg8WaOlTObL1f5PneWcFpTP4EmiHXkLSda6r+T2clHeDwKi mCmKc9hZ3dHKGYIcjEhVWhFOu7oNooiV/QYp5GOpLZP6Ot//6JrbsmpoCnpvqtU9PnuB7yIbN95Ii Z8oyxuYw==; Received: from mail-centralusazlp170110009.outbound.protection.outlook.com ([2a01:111:f403:c111::9] helo=DM5PR21CU001.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sj7pb-0000000Azbp-3sLA for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 01:50:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TOIN5BFgNPzhwtA4SYO4Cc0HBDrZ6Tya1AQr4JHarh/L7ZOjUYnklDEef9qgicZ9jNgDwtjfmCm7n91FO4J7r24vvVVSsZZtCckgL5/K2JJ1p4jsgloEJOWBDw1d7tA9VIcdNAmg8mIt/MTF48+3qvVj9+W1YSp0lMqoroizCLxomU/crfUS4Wu7KsaFL7de5HdAto66y2a2jHoiXfK6v8mT7Iv2F9XFdtD/IDqz20/fY1H51M690EI+5HF4u0rrlsEDeSnKz2oPlUAfFiaiB1Yh/rgdPKr74/3t+iZg9qSzduzZ9SLn1TddESaqJd77ErC/VcEu2ctBciyYaV6DWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YigPosKCyA+QVqyfOxzq74WG+dtaoYHC96nYTYgVgG8=; b=LFGcknnEH4Ty3nrMb+QBwW9KqW8+Y1+fs+gXJe98stNq34Ntxzfs8D4Yl1plMv/CMBu6NuxwzX+vQXMJqKS+3lPe8G4crv/dvrrZ28PkP5UgzT/bVfUnJyo/6l8U6PtyMpE5CLJfPmkCnl1opxJHda7izgYGGjYitKU94iPQHljjcBldTfy6P4X79DGBIufbwfVa/UzTdebmPwoTXeWYtPoSixA2zrDJN7CSpg3TZvUvVgClMLmMMQ8M8zgxC4EN7xJbi0oLVY8MVdFT+Y+jNcdA1RxSX4Q6QC2WP3pc5z8B0QoIyuV3VTc2wtB4rUrqk5SLKb8ZLfPJIwmWrcdm8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YigPosKCyA+QVqyfOxzq74WG+dtaoYHC96nYTYgVgG8=; b=f0Nx2w2dOBZnRkurLyQYMLYF3npO4dTc0TZpmoxsT7k+UB9wRA57l1moyuRc6+3KV5cPZv+Qyp+fNWcHxC+AUJEJ24iYVrcC+rqfqP2GWq7SgjP2+dTtVag7iDW9G0fjEAfaKqwR9frcCBxa0kriOtNPhBLborbAkgdFUAxZRrE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) by LV2PR01MB7576.prod.exchangelabs.com (2603:10b6:408:17c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Wed, 28 Aug 2024 01:50:34 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%4]) with mapi id 15.20.7897.021; Wed, 28 Aug 2024 01:50:33 +0000 From: Steve Clevenger To: james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, leo.yan@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V3 4/4] Adjust objdump start/end range per map pgoff parameter Date: Tue, 27 Aug 2024 19:50:13 -0600 Message-Id: <2c8d8f931a1484939fe0251424477f2e53423417.1724808513.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: BY1P220CA0004.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:59d::15) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|LV2PR01MB7576:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d692de0-3c00-4c7e-a574-08dcc703cdc4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?mHXVEkfE4hYP9vHTkchaLYS2+znnPaW?= =?utf-8?q?eIs+MqxBmqu21LNarv2WqXh3JfNUKHwEomDes2Lm8A34knefHFrSGzgE9qaLeurpc?= =?utf-8?q?cVLg66stCDxShlJU5ZFeNiFNPhQ6Ye/uxe0xHNZG/OQcW8PdnWNtgG8Sq7cP/VitM?= =?utf-8?q?Vzkox+aJLD6MeSWf9oi/SqISqh5RDOX21p0NZuI86nFXJvaAaq5fdyNyk7t/uCZL3?= =?utf-8?q?0tNoAN9/OmnbV3yG3wK+DrYai4NWSBSoQoJpWIIyyMHgaZ64YcVHQhftCUSMlChpg?= =?utf-8?q?crfoF0fxrBffk/vRtcZgSgW52PFbJZU+OqxZxBuQM4RhClYkbjs671weOVhKXIrC8?= =?utf-8?q?7GTN3h8NyUg4SLVQgwJRov8Hsnhzen4uM5rufd+2SicTHWbVxunBbrRPN1akgs7eA?= =?utf-8?q?8ZKp/tjvQlxNgT6Xmw3Mjiylwjcqf2EMz/5CMjpPrJ60ay1ThLUTcmV8tUU1t9VDJ?= =?utf-8?q?Qb541KRZ/+0CmUOCxtTDikBbdMDewBtEEMeWFWix3QY8j7cawM2QI/jZ4GKj853VB?= =?utf-8?q?brZoBnALQCdvpc8qRjfNLpg6itgop0AzouXo45nZIk3gypi6M3bM61i6w1j7jSert?= =?utf-8?q?QtfmjYenTbCgS+iIJXnDkQiYnV06u/DuXwx6SIUwVaHfS6e+CdO5JhiWN3dI/CcgB?= =?utf-8?q?mfgkU49DdEJvjAae1BJibqege6echzQgGwmf9NVY1wwGaWtR+QRd0rlDdXn07GrXS?= =?utf-8?q?q6L6vtaUfMEUq7gxhiUmvws/TASN/Tc9oKTknb8GRIF0UVhA7/E0vxE3N2gHGNsnk?= =?utf-8?q?/1KQ41KApTDfdTe23/HXjDkhpWiuIFuUT5f2wldrblb2N4sHzEwsWcQPBU0kDjMph?= =?utf-8?q?8/DuMlnH/rWMPA6Zx2739ltZfuMig274Z+RIQesasizWmZAnG8aFYFU29blL+GIyr?= =?utf-8?q?3um/skj2z8+ar+5GlptzNxnmlvTtB5XlZrkFjEiane/BXwec1gYNV5A2xJkzO4oQe?= =?utf-8?q?nWdkLd0skTuosi5EbgUqPxl8PNCT+42Nzh49D8pM6HPxxc3jgpoZ7gA2gA1ZvtCq9?= =?utf-8?q?zASNLmPK9CBIy9RNpzA2giHyDFSQU7wKldYiCZptQNniNQDi7hRMbBbyEYNeQb2/k?= =?utf-8?q?UqDUP4Esuw8nmlVF6ft2h2bWGA+LoJL9xfGnUJfSqDyQJtsjCfIllfNkqmIOVLLrN?= =?utf-8?q?ew7dI78g3G8TCDLzi2DlClUWPAx6KVpGR0gNDeRiOcGULTmdtT1Gnrwjwds0aRJDj?= =?utf-8?q?694pwTrKFUom0uih7Mx6XWLg1Hk8TKgza40JZ8qSI+ZhDMEvA1gK45Unkho/uIui7?= =?utf-8?q?0o3v9m0xRYWEpCAVmc+j6pqxXMr7bGc0t8AhaJ9zf34L6WLNb/FzBb/eC1zixpdny?= =?utf-8?q?F8QgtSVm36FQwKpT9OmDHODh11r5YJ0azw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR01MB8146.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?BMoxJq3skQ5zrHwabLXOXKW7SQCn?= =?utf-8?q?hv6B6aPh93VkG0SECUBxqu+l3j3cOz9TaqiMK0xaNgjOFKHUHA7xzQBvyUottzsS7?= =?utf-8?q?ykZ4UjMlAgc+2VfV/wdxzJvXqTTEj35tOszlpYb0tOE1guO1T74TUDXAGlkKfptX3?= =?utf-8?q?eltTsmv5iNpC2vokctyHvS6V4SiJC324cHkoZDta065NV/FBf1wznAFLrpQYxr+fS?= =?utf-8?q?DlD0t03SF8kWuhbqKxp8+23sGifEYC1sqcKlIPA4YxTSd+J8Aq/QnTjwUuQt/Xr3f?= =?utf-8?q?wxEb2/FAjl+yzXQrnzB8R9LenNcZtkEqumVDQz48p3cszK1+Oy8qDqcUDqxYc4mOR?= =?utf-8?q?FpHe19JvyeqAUFlmOwfzuuEt2xwf953qfu5p6nVzhE2Nu8pDmIFaS0Bpm/kDy2cHB?= =?utf-8?q?N8lvPjrop2SYkAX0pQYv39HBQQHSeTcUfdHLhw0FKm5CCQh61+r624hpBGoeeK/Pu?= =?utf-8?q?RrtvZj32J56Uw5woaIXDDmEfrlj2Hvse5qYFZTLVqr2CGM3rZm6P2EJrI1dD167rc?= =?utf-8?q?qMZwSzBarY8vNaq2rXvyelRbKYT6Urf7jhxEbwph4T7UxU4qxb27QHdt5VoyifFem?= =?utf-8?q?zguKef+MDQ+VOVm8YsUvp/YNNMZzJA/DycCI6aEzutBud1w1x3hDyoCzXhvO8dF6S?= =?utf-8?q?b8D1RD87/w8/QHwXdOS9DhrNTKKRnq/2b6PLyPqn90zXHCPEiHaBm+4v7aqPAED9p?= =?ut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x2MJ9E?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d692de0-3c00-4c7e-a574-08dcc703cdc4 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 01:50:33.1787 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0RcPW+w4KeqCwm+zfwCLhLLDUPSiwOO4BSSQKY5QOEbI+XN8pVQWOs2fo2cR60jkLI/vqko7ytin1pGPYhhGofc79iNzI7ldNrTwcVbEP7UqsUag1SkzDtN37H8CfX3h X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR01MB7576 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_025044_475964_2534A2CF X-CRM114-Status: GOOD ( 11.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Extract map_pgoff parameter from the dictionary, and adjust start/end range passed to objdump based on the value. The start_addr/stop_addr address checks are changed to print a warning only if verbose == True. This script repeatedly sees a zero value passed in for       start_addr = cpu_data[str(cpu) + 'addr'] These zero values are not a new problem. The start_addr/stop_addr warning clutters the instruction trace output, hence this change. Signed-off-by: Steve Clevenger --- tools/perf/scripts/python/arm-cs-trace-disasm.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py index 7aff02d84ffb..e8cf5d80d850 100755 --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py @@ -187,6 +187,7 @@ def process_event(param_dict): dso_start = get_optional(param_dict, "dso_map_start") dso_end = get_optional(param_dict, "dso_map_end") symbol = get_optional(param_dict, "symbol") + map_pgoff = get_optional(param_dict, "map_pgoff") cpu = sample["cpu"] ip = sample["ip"] @@ -249,11 +250,13 @@ def process_event(param_dict): return if (start_addr < int(dso_start) or start_addr > int(dso_end)): - print("Start address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (start_addr, int(dso_start), int(dso_end), dso)) + if (options.verbose == True): + print("Start address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (start_addr, int(dso_start), int(dso_end), dso)) return if (stop_addr < int(dso_start) or stop_addr > int(dso_end)): - print("Stop address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (stop_addr, int(dso_start), int(dso_end), dso)) + if (options.verbose == True): + print("Stop address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (stop_addr, int(dso_start), int(dso_end), dso)) return if (options.objdump_name != None): @@ -267,7 +270,7 @@ def process_event(param_dict): dso_fname = get_dso_file_path(dso, dso_bid) if path.exists(dso_fname): - print_disam(dso_fname, dso_vm_start, start_addr, stop_addr) + print_disam(dso_fname, dso_vm_start, start_addr + map_pgoff, stop_addr + map_pgoff) else: print("Failed to find dso %s for address range [ 0x%x .. 0x%x ]" % (dso, start_addr, stop_addr))