Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2752194pxb; Mon, 31 Jan 2022 03:37:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJy72O2G3iDkQPpKmF74wND12z53pRhBHlps3zrHkGVhsXxljdqWkfvPHgycov/ZUiLCsEHu X-Received: by 2002:a17:902:7844:: with SMTP id e4mr20452548pln.154.1643629021030; Mon, 31 Jan 2022 03:37:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643629021; cv=none; d=google.com; s=arc-20160816; b=hPumLu1cpPngve5cfjaZHPDVZMcHHc2Hh+0M5jlfp2evwDTTwXT45HKKzUXyEZAgca GHaHKBl7HkYKDfSKUj//cQUFPBsMSzaGFNTCCRukMRc0CR/CwQPBqdx7voIqKiZuy7jO ATEuQ+iQGpT2llSgj+cpONNiz1Rke/gwKGSiWD5tHybfHELsUBzyW30qs5lrqu6+PpcZ nr9jT/T2RmpPLDJdVBd2wuiYqwgk3YXB6nPRAmuI8VdnBGEt1wzdJEDaenG/nBX4pBVs 7mAaR8b+e4lSKReSd9cuVSx5QIrEZAvTBoesKLfJ9UwswtIAq8vg6JtB1O9X21oTv1di g1og== 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 :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=X5ESwBG6b6i8YhyGmxv/0fv/Q3LnACC0URr3jF91X2A=; b=gtIXdcQpq+ucv7+wQug5VB2odnAweIoaQhhrVWt53Ucf0xQGqjQSfQXMwex5RmMklh A+TyjsVRRC4qQYMueAvlO4QE1pR1H4yGJ6HeMLyFAG3wLgK6gBZUVN8xx2XOxSGiYaTK 57Ghv+IgbXVopVJ9dDaNFi1MYE3UnGnqn2PO1ms9VzxWmyDensdWGD8LUlLnglYtgIQv aK1P5CNOivRunzh4IUeLp7F86L0/khZFgfGwD9zClHCPmgT7gvWYfBE0g1Jc3wR6clc4 vrx+OhKuPAJ4wQFdXV+2la8eS149c0ng6/BsnRm4sIWDl4HU9Bs1d5wCYpyIgSty3lgR Esrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iYmzpNKU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z11si10021246pjc.23.2022.01.31.03.36.50; Mon, 31 Jan 2022 03:37:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iYmzpNKU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351482AbiA1UlA (ORCPT + 99 others); Fri, 28 Jan 2022 15:41:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351343AbiA1Uj6 (ORCPT ); Fri, 28 Jan 2022 15:39:58 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15A77C061749 for ; Fri, 28 Jan 2022 12:39:57 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id z14-20020a17090ab10e00b001b6175d4040so6172865pjq.0 for ; Fri, 28 Jan 2022 12:39:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X5ESwBG6b6i8YhyGmxv/0fv/Q3LnACC0URr3jF91X2A=; b=iYmzpNKUB+T1KgiTlY8iN4WQBCiTqcfAWm+z84/sPor3C7bmf7+mUMiaTRG/oND6FB BDR9JWd1CbK3BIi2W55gBn584SnlQSJy2RO1H4MST8WWIaipkIGxlqG12dkujRdNcFxZ KVtEiHX0S4w+LiE/IkqQyXDa75IuUyBFuFfGpy0rTWjOXJT0/dAmGDtXBelwtdxRgoRg 5JNre7akcL5OT7jdA0/I2j63+hAqG6fS1fV5BZyRjHdTjqrM2wd7UWq8HYgRP/cGazty JevFy+nRYeGvx7wTj72M+ONS+LxyMbXR9EqvmxGlEgYTxUi/uHG0Hj4QAuIMUTqNjWkx uzwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=X5ESwBG6b6i8YhyGmxv/0fv/Q3LnACC0URr3jF91X2A=; b=b859edkUltVFbDc7pdbpx6ioX8z6OVMwsuF6J2JCOphkTSnlT0XPaMKX0aPC0Fl4aw QGhFmuD1wdJIOUmL6qmqP0MegIEollquvJrfrqVxJ8yfj1wo2rR+ua85kd3rpBnT3YgK zIYybIN7mU1keok5dAJb7/R6ULgk/Yz3A9SQx5gZX7wnkMgGVYWagHspBekvVtVAUfim z987eVImvMVlcjXvVCYyC8HbnJ0KIri4pz5C4KiFCJcjH/T3rouWIJE4dC4V3zWm1pa3 NLXW84mKyPgnNpRlxMPCzTH3j6blsHJFiEfe2Le5FHJA+e5bDzBaY0b+sF6pVHGASclq zE9A== X-Gm-Message-State: AOAM530/gs4cSh6HZppxLRKkHSEbAKb17YUMntQEcKroQMvo374RPH3g +A2V9SRSweRomDU/2A5mfyDpdBH+tG4= X-Received: by 2002:a17:903:1042:: with SMTP id f2mr10635037plc.115.1643402396610; Fri, 28 Jan 2022 12:39:56 -0800 (PST) Received: from balhae.hsd1.ca.comcast.net ([2601:647:4800:c6f0:f13b:bc2c:fac:4a86]) by smtp.gmail.com with ESMTPSA id k3sm11235428pfu.180.2022.01.28.12.39.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jan 2022 12:39:55 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Andi Kleen , Ian Rogers Subject: [PATCH 3/3] perf annotate: Try chroot filename for objdump Date: Fri, 28 Jan 2022 12:39:50 -0800 Message-Id: <20220128203950.3371061-4-namhyung@kernel.org> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220128203950.3371061-1-namhyung@kernel.org> References: <20220128203950.3371061-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Likewise, it should use a proper name in case the task runs under chroot. The child_process.err was needed to set to -1 to show error messages properly in TUI. Signed-off-by: Namhyung Kim --- tools/perf/util/annotate.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 01900689dc00..e4c641b240df 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -33,6 +33,7 @@ #include "string2.h" #include "util/event.h" #include "arch/common.h" +#include "namespaces.h" #include #include #include @@ -1696,6 +1697,15 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil * DSO is the same as when 'perf record' ran. */ __symbol__join_symfs(filename, filename_size, dso->long_name); + + if (access(filename, R_OK) && errno == ENOENT && dso->nsinfo) { + char *new_name = filename_with_chroot(dso->nsinfo->pid, + filename); + if (new_name) { + strlcpy(filename, new_name, filename_size); + free(new_name); + } + } } free(build_id_path); @@ -2036,6 +2046,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args) memset(&objdump_process, 0, sizeof(objdump_process)); objdump_process.argv = objdump_argv; objdump_process.out = -1; + objdump_process.err = -1; if (start_command(&objdump_process)) { pr_err("Failure starting to run %s\n", command); err = -1; -- 2.35.0.rc2.247.g8bbb082509-goog