Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp719972rdd; Tue, 9 Jan 2024 18:57:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdjnrjAPFhKnNs2XbHIRYOy7vX2MDVW2KLsheidNrMhN0t7M/Wl0w+nhzDw98B7CYetv7H X-Received: by 2002:a05:622a:20c:b0:429:aff8:14f9 with SMTP id b12-20020a05622a020c00b00429aff814f9mr498204qtx.73.1704855429539; Tue, 09 Jan 2024 18:57:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704855429; cv=none; d=google.com; s=arc-20160816; b=so4OqPXRM7j7iadYZCwP+cVfGfoXJbY9OugjnXq3IRp328E4I/W7T6A9w3WxQA7dS/ NBh4/ThO3BcGja7pg8vZbasHdCKLb5UkFH70g3yB15MGGQgPT1bZmEhipG0hK2Symd/u j4isog25ZfjGUN04evStNS9LGllAfd61Ayazblc27ylM87cYG0dosJLDgzUAbhmcPFM6 PL9PrH5cPraOqMRP85vsJ0rqZ8Uo9vB1nIQ3P8snRKvAIlvadlGMQZ8LQwrECwRzK59+ AfsbFUXU99i4PpIMHsiEmbBm9azZxssHEDau3LYjPkUMmxu7yZZZpelCIM+6XZzy7UfA zAaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=FLwvyzrEEmpWI790K8F1Rf0/6M/bOkWAI8oFLmhA054=; fh=2C1f0j/nzSygmX2ABc+8OQYD53hkUy28AVWbjAwc8E0=; b=LE6909sFA5Yr/opS9CfkpCZM5wEG8e/60pkGka4/AxwxPmTTAyhEr5Vu+rUgYPUudo 0Gj5eoxUpJASS/ADm/edVNskbA8MDcSpE59Dmf/7PgLiKPLBfsj8E4qsmwIdyXXtt0R7 souyQyHh2xvnB3CRS74mkj1Pq2Z46E1EBPKPmQqNkL17Ug8vIbkLARU4fUC3AdvWESqH njZ/rVztnQxsXX+9im9dEVKqpZ27DtTVjGt0nn0S6qAqwkk7fMT1r/ZHBDQlZr2fLwn7 fRdlLElIhYS0CvQO/pXzorzACUp7yk9Em1zfTFoGOwO09WCDmsLjRfBF6EYThfT1KjRC N19g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-21664-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21664-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y15-20020ac85f4f000000b004299b7236b8si3341847qta.632.2024.01.09.18.57.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 18:57:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21664-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-21664-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21664-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com 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 0160F1C25326 for ; Wed, 10 Jan 2024 02:57:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3902A63DF; Wed, 10 Jan 2024 02:56:36 +0000 (UTC) Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 890624A3C; Wed, 10 Jan 2024 02:56:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=tianruidong@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0W-KKTUe_1704855384; Received: from localhost(mailfrom:tianruidong@linux.alibaba.com fp:SMTPD_---0W-KKTUe_1704855384) by smtp.aliyun-inc.com; Wed, 10 Jan 2024 10:56:26 +0800 From: Ruidong Tian To: linux-kernel@vger.kernel.org Cc: james.clark@arm.com, 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, leo.yan@linaro.org, al.grant@arm.com, mathieu.poirier@linaro.org, tor@ti.com, acme@redhat.com, Ruidong Tian Subject: [PATCH v2 1/1] perf scripts python: arm-cs-trace-disasm.py: add option to print virtual address Date: Wed, 10 Jan 2024 10:56:17 +0800 Message-Id: <20240110025617.66646-2-tianruidong@linux.alibaba.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20240110025617.66646-1-tianruidong@linux.alibaba.com> References: <20231214123304.34087-1-tianruidong@linux.alibaba.com> <20240110025617.66646-1-tianruidong@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit arm-cs-trace-disasm just print offset for library dso now: 0000000000002200 : 2200: d503201f nop 2204: 8b020024 add x4, x1, x2 2208: 8b020005 add x5, x0, x2 Add a option `-a` to print virtual offset other than offset: # perf script -s scripts/python/arm-cs-trace-disasm.py -- -d llvm-objdump -a ... ffffb4c23200 : ffffb4c23200: d503201f nop ffffb4c23204: 8b020024 add x4, x1, x2 ffffb4c23208: 8b020005 add x5, x0, x2 ... Signed-off-by: Ruidong Tian Signed-off-by: Leo Yan --- tools/perf/scripts/python/arm-cs-trace-disasm.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py index d973c2baed1c..78419498237e 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(), "%x" % virt_addr) + print("\t" + line) def print_sample(sample): -- 2.33.1