From patchwork Tue Apr 18 03:18:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 8333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2559361vqo; Mon, 17 Apr 2023 20:41:54 -0700 (PDT) X-Google-Smtp-Source: AKy350YIPRdgBozcq87T/Ps5MsJZTFkdpTylmxU/4Zj+etE0mvVhmSCz5NXhIua5x9jA5S7i9Cy+ X-Received: by 2002:a05:6a20:1606:b0:ef:4944:21d4 with SMTP id l6-20020a056a20160600b000ef494421d4mr10841142pzj.16.1681789314470; Mon, 17 Apr 2023 20:41:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681789314; cv=none; d=google.com; s=arc-20160816; b=KBYiFmeU6PRqltmJquplUbFgCvfUQPb5oseIPUCZa65D3yKdOtnLu/6NTddMKQaRPW pDK3GkeZXhbUr3jDtZ5tiKHFxKriH0T4qxFRbfQpJgxfh7J6ppW2L0saL2NGNIoWmelN fN7a7cPFx4ftE2kjmbza2U9j11mRG21FIh+rfe4tupXQehxZiNcHn0SkZPSZxg5lHKtc /+yndm8dVrG1IYlu2XX5hOYTbHlW98Z30SpRdAEt6b+aDjja6BTHlIdPhpeldmiNItgn y01CeHWiqyCxXUb5U1+C9r0tmKs6lCP7qzHXPHmnzLYTrneGuJrcvrOzFlh0Zf2fypIg mRPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=wnpqDOUReescMFDWPF2dgs3yPZER7AS/DuR1Ses2j+A=; b=Yq57BCS3M3YiG4A2erPop8x6Ahdi37tFuwr4PX3GNDD1I50PACvIor/FDTSdGBgZsI 2Qg3GYRIbOkE9KTxzoECtcKL+6p1Lyas84X9uGycIxUkcCGFuZYvBMRGIllM+bQPs0NN 1/kkgotk1nO2HbZz3KXF7LL1kFZlysyfVJrO1dOxTRR+upQLOeXMcKpkm1u+h1bJNfkK BYtaiaGwR2gNCYzxMC8eC1NKzC+PhD3vN0CyTbCg/4idauIklQsSdJXh9dqIQrkJHJ/9 IRY5oC0Z3+7t6WjBkCZvyN8agpxwkoBFDty5rWmnI22FUzQrm6o4uMpFcOiE41t0ks59 z1PQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 78-20020a630151000000b0051374678f95si13822091pgb.808.2023.04.17.20.41.42; Mon, 17 Apr 2023 20:41:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230342AbjDRDTL (ORCPT + 99 others); Mon, 17 Apr 2023 23:19:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbjDRDSw (ORCPT ); Mon, 17 Apr 2023 23:18:52 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19A935BA6; Mon, 17 Apr 2023 20:18:48 -0700 (PDT) Received: from kwepemi500013.china.huawei.com (unknown [7.221.188.120]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Q0pvC5rjKz17SxY; Tue, 18 Apr 2023 11:15:03 +0800 (CST) Received: from M910t.huawei.com (10.110.54.157) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 18 Apr 2023 11:18:44 +0800 From: Changbin Du To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar CC: Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , , , Hui Wang , Changbin Du Subject: [PATCH v5 0/3] perf script: Have consistent output for symbol address Date: Tue, 18 Apr 2023 11:18:22 +0800 Message-ID: <20230418031825.1262579-1-changbin.du@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.110.54.157] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500013.china.huawei.com (7.221.188.120) X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763483776967665280?= X-GMAIL-MSGID: =?utf-8?q?1763483911864061669?= The goal of this change is to achieve consistent output for symbol address. Before this, the raw ip is printed for non-callchain and dso offset for callchain. Mostly what we expect is the raw ip. This patch does two changes: - Always print raw ip for resolved symbols. - Add a new 'dsoff' field if we really need the dso offset, and the offset is appended to dso name. v5: o add helper map__fprintf_dsoname_dsoff() to eliminate repeated dso printing code. (Adrian) o do not print offset for kernel dso (a.k.a [kernel.kallsyms]) v4: o also print 'dsoff' for brstack,brstacksym,brstackoff,etc. v3: o 'dsoff' implys 'dso' field. (Namhyung) v2: o split into two patches. (Adrian) o do not print offset for unresolved symbols. (Adrian) Changbin Du (3): perf script: print raw ip instead of binary offset for callchain perf: add helper map__fprintf_dsoname_dsoff perf: script: add new output field 'dsoff' to print dso offset tools/perf/Documentation/perf-script.txt | 2 +- tools/perf/builtin-script.c | 60 ++++++++++-------------- tools/perf/util/evsel_fprintf.c | 25 ++++------ tools/perf/util/evsel_fprintf.h | 1 + tools/perf/util/map.c | 13 +++++ tools/perf/util/map.h | 1 + 6 files changed, 48 insertions(+), 54 deletions(-)