Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1768365rdb; Sun, 24 Dec 2023 00:33:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IF405+ZLWkk19Alx01MXytN2T9MVufu2uISKSMJk86iZgWo7SCYJzysM/1AOr1Sm4VHDu+q X-Received: by 2002:a05:620a:4942:b0:77f:3f7d:b49c with SMTP id vz2-20020a05620a494200b0077f3f7db49cmr5039904qkn.94.1703406829562; Sun, 24 Dec 2023 00:33:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703406829; cv=none; d=google.com; s=arc-20160816; b=ulRbgVX4fRNM3JaoqkkQnymrKEdMw4e0kiJI7XS8kR9/ZI5H4M9pCicmtHPiH0KotD DpHsbyQW5CtMKuQVmqYjZB5Vyb5GEJTq1zN/dnHBu3+Fl6BQVTLoHTdHXYIYkuOKBkMa QbCAGvaHX6b3QPUgadjCD4ydPEbMaFr+9KoTAEZhABOl7iOTZKQ14+umAZqoWaracb4X i5MO3MC0jdMOWQNZgAXMkZwZqdVQIOx9lYszDyWhUl5Tw85GoasMRWzThx94jFmwQ+ym IuXur8hfmKha+rtFQjx0LlYksTFoXyA+/YWNUC65ACCINQWv1+Pxi3gNp/X4tXm/ryVQ Wm8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rO7WgIPdNcnqWQpaudC4tS6W5dWb0hVk4elNmQeiAV8=; fh=a0fVa9EfBAQNSkJIk+C45AbMiSrel99mIEPH4eHpjxQ=; b=VwgZAh6boXv/pxynILcna2mFhXylBEGPznbWSwlcssjDpV6V5azPebEmQFyLJUdNfT BXSH1rsDSr8ie2OgY+y1bpFPRpLX3yWcEcI42+vebY/MeDSCHf5oJoGAPwFM+FMRaYs8 0MubgLmGIny5/qFpcTuMW6NW5uMrEzWxXpPGQh6X3WBPvLqwVNFuvQvglR50ZVekTqdz 9pdJUj0+6VG4gFYQ7ba2HlZg0mihzAQsleG1yM/w2j/fDZ23brgptP6jivDiNWTVN0JZ /7T+6oq/HEYET/omrqXjSaarOF/6wfIZozlWPqKrZgJ54JBlm/DwWJ+YgEpFq+nRPfDe MZCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=olUzveYL; spf=pass (google.com: domain of linux-kernel+bounces-10662-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10662-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 30-20020a05620a049e00b007741b0f3fd8si8095757qkr.283.2023.12.24.00.33.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 00:33:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10662-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=olUzveYL; spf=pass (google.com: domain of linux-kernel+bounces-10662-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10662-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 53F361C21265 for ; Sun, 24 Dec 2023 08:33:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B0C2211A; Sun, 24 Dec 2023 08:33:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="olUzveYL" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E786F20F5 for ; Sun, 24 Dec 2023 08:33:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-7ba737ee9b5so221227739f.0 for ; Sun, 24 Dec 2023 00:33:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703406819; x=1704011619; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=rO7WgIPdNcnqWQpaudC4tS6W5dWb0hVk4elNmQeiAV8=; b=olUzveYL3r35YTE26G3Zj4/GB0nt+zCYqwDBpxnT+5Joi+YfHAG7ssEvTo9cG9DA1H GqpDefuyAVrM9t9ZUHImei/9ETq3olMIQLDWXnLCJ/INmWSmMgFR2eBm3ArNY2oPAyOL /hPCL5mhYvgjFMant+OsWR1vf9tzZ4DM8uxPhcxk1o0ohxhOpomjjfSVS0AwHRYHzxE3 Uicbx7wSngIIjOn7ybjkcaxH/NCtbtelsSPz9cYblospIka3ZtUX5N/hq27p7AywuTmR LeU678AXrPbqzR1nlzL5O7itSmMQI9DjTgLnWOOM+u4SZf3tdvtDsQnVLsMbkD9zX81T Z55Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703406819; x=1704011619; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rO7WgIPdNcnqWQpaudC4tS6W5dWb0hVk4elNmQeiAV8=; b=IQpYZynKAgY0MVLT0zKCdA82Fm1gAD7Xg21AKRCm2Kf+s4gw8kCCE50FuGjGHSshrc MGq995IXHgvy6JYzD3b/jv1UydffSLq092LeDoLSL4lJQb6rJcOtVC3vlJk4CZ1BVbU4 PSgtdS1KUfpA3J5+b84S2p8TJCwUYG/RhoPQeTZTPZmSCYUrlyu0tfI1GbYLFBnuQ1Cg wJxfuWFHI6CSyrLqhTXGPsczhVU/pKS7b8+/cg2cRA4gsJI7eZV1un5Foiz/4EhgXemt dk76PB2LDy+dyHTSXpQqD7jul7bNyUE+T7/F4uU6KB7Wlby0Wb1ducdP2g5Z2TF0jBms Ewog== X-Gm-Message-State: AOJu0YxmW+B+SSbyA2VAwx0MWGOpzVbcpTVgcvaVtOWMiSHJp8Q1IWUv xI2j/TAxEKn3o17a+ymnm6Z7aI1DmKFArQ== X-Received: by 2002:a05:6e02:19cd:b0:35f:ee15:688d with SMTP id r13-20020a056e0219cd00b0035fee15688dmr3742373ill.104.1703406818815; Sun, 24 Dec 2023 00:33:38 -0800 (PST) Received: from leoy-huanghe.lan (211-75-219-200.hinet-ip.hinet.net. [211.75.219.200]) by smtp.gmail.com with ESMTPSA id b17-20020a170902ed1100b001d3d8c04331sm6154915pld.64.2023.12.24.00.33.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 00:33:38 -0800 (PST) Date: Sun, 24 Dec 2023 16:33:32 +0800 From: Leo Yan To: Ruidong Tian Cc: James Clark , linux-kernel@vger.kernel.org, coresight@lists.linaro.org, suzuki.poulose@arm.com, mike.leach@linaro.org, alexander.shishkin@linux.intel.com, linux-arm-kernel@lists.infradead.org, adrian.hunter@intel.com, linux-perf-users@vger.kernel.org, al.grant@arm.com, mathieu.poirier@linaro.org, tor@ti.com, acme@redhat.com Subject: Re: [PATCH 1/3] perf scripts python: arm-cs-trace-disasm.py: print dso base address Message-ID: <20231224083332.GB13521@leoy-huanghe.lan> References: <20231214123304.34087-1-tianruidong@linux.alibaba.com> <20231214123304.34087-2-tianruidong@linux.alibaba.com> <912a39f4-025e-26a1-7786-091fa211f293@arm.com> <6177beec-f140-44aa-b534-182cd4b0a988@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6177beec-f140-44aa-b534-182cd4b0a988@linux.alibaba.com> Hi Ruidong, On Fri, Dec 22, 2023 at 03:29:18PM +0800, Ruidong Tian wrote: [...] > > Although it's also not that clear what this is useful for, given that > > all the other output is relative too? Maybe you could add an example to > > the commit message, even if it's just for debugging. Would an option > > that turned _all_ the output into virtual addresses not be more useful? > > I want to use arm-cs-trace-disasm.py output associate with PMU and SPE data > to explore more CPU performance info, all the PMU/SPE/Coresight informations > generated by `perf report` and `perf script` include virtual address, so i > want this script do the same thing. I think James' suggestion is valid for replacing all offsets with virtual addresses, in addition to introducing a new option. Below change works well at my side. Hope this is helpful. diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py index de58991c78bb..6c94ff2287cd 100755 --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py @@ -36,7 +36,10 @@ option_list = [ help="Set path to objdump executable file"), make_option("-v", "--verbose", dest="verbose", action="store_true", default=False, - help="Enable debugging log") + help="Enable debugging log"), + make_option("-a", "--vaddr", dest="vaddr", + action="store_true", default=False, + help="Enable virtual address") ] parser = OptionParser(option_list=option_list) @@ -108,6 +111,14 @@ def print_disam(dso_fname, dso_start, start_addr, stop_addr): m = disasm_re.search(line) if m is None: continue + + # Replace offset with virtual address + if (options.vaddr == True): + offset = re.search(r"^\s*([0-9a-fA-F]+)", line).group() + if offset: + virt_addr = dso_start + int(offset, 16) + line = line.replace(offset.lstrip(), "0x%016x" % virt_addr) + print("\t" + line) def print_sample(sample): Thanks, Leo