From nobody Mon Oct 6 03:13:27 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DEF1B24A051; Fri, 25 Jul 2025 19:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753472293; cv=none; b=OyH6gWAGA+5MHhGnihXmhHfLLsR6hjuRCanipHPcwvlba1qh5sy1yCw5XOUIgO8uBgNGdL41Ic3iNQLxMOQZUyXkx3Q7OfVjJ/8cwxFKlQOvwhZ3ya8w+SZSroq66fv+7V/Y2qdUTkPT4OwlwQPrxj2dPrno+itrWfKP9LSsTWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753472293; c=relaxed/simple; bh=FBzJE/zcrbCRDFg7+nPtUWKHLbZcikfu52tPxC8ov4c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZVX/ZIFNer3Bc5xPlZKkn072bgQEgA5U/U14II3jwuJyQj+aNM82qBy8tWravUtjdEDCIZvXtJCY5PKW1Wap/fDClFajQY+R9QgDXskytos7YtXS9H7ZzjfTQq01Ei0bL+g/hctTxpkK5RnmdyafmSeEbmdQnbZpawgl1j+fXIE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nQ5CNljF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nQ5CNljF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2169BC4CEE7; Fri, 25 Jul 2025 19:38:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753472292; bh=FBzJE/zcrbCRDFg7+nPtUWKHLbZcikfu52tPxC8ov4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nQ5CNljFVqeNeUQ2UO8EiMp5lF4p119riNz/3EoIT8jc4Sti5K9Ny+kPjdzMCCZkb HD9TialCLBbSwjupC12Yc0WYNXVH9ERBee28/gvhHG7DLs+BOMIMpxnv/HjqoHIc2q vQ8FPValqp8g6Z86LXJeHAK5D/Q1oCVHfbZqw+dXhaLtkku+ENRCGeg9s8/WoLgbKe HtpJIq3VKVkxOi/D0gCbRV8aKVvdBDqUBSUqgTUemLdJQAjK811Qp5R3kAULmaRinx DLdrax19nZQlnMtUQeAC5idHZbL5TsWUz8yKiEGx2fVV8BgvVDjPNy69YibX7ktuly 1gVN/pG0ezbcw== From: Namhyung Kim To: Arnaldo Carvalho de Melo , Ian Rogers , Kan Liang Cc: Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Subject: [PATCH v4 9/9] perf annotate: Add dso__debuginfo() helper Date: Fri, 25 Jul 2025 12:37:55 -0700 Message-ID: <20250725193755.12276-10-namhyung@kernel.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250725193755.12276-1-namhyung@kernel.org> References: <20250725193755.12276-1-namhyung@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It'd be great if it can get the correct debug information using DSO build-Id not just the path name. Instead of adding new callsites of debuginfo__new(), let's add dso__debuginfo() which can hide the access using the pathname and help the future conversion. Suggested-by: Ian Rogers Signed-off-by: Namhyung Kim --- tools/perf/ui/browsers/annotate.c | 4 ++-- tools/perf/util/annotate.c | 6 +++--- tools/perf/util/dso.h | 10 ++++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/ann= otate.c index 2a4db5bdcdb7e9d8..54610621c5f910fe 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -1042,7 +1042,7 @@ static int annotate_browser__run(struct annotate_brow= ser *browser, case 'T': annotate_opts.code_with_type ^=3D 1; if (browser->dbg =3D=3D NULL) - browser->dbg =3D debuginfo__new(dso__long_name(map__dso(ms->map))); + browser->dbg =3D dso__debuginfo(map__dso(ms->map)); annotate_browser__show(&browser->b, title, help); annotate_browser__debuginfo_warning(browser); continue; @@ -1128,7 +1128,7 @@ int __hist_entry__tui_annotate(struct hist_entry *he,= struct map_symbol *ms, ui_helpline__push("Press ESC to exit"); =20 if (annotate_opts.code_with_type) - browser.dbg =3D debuginfo__new(dso__long_name(dso)); + browser.dbg =3D dso__debuginfo(dso); =20 browser.b.width =3D notes->src->widths.max_line_len; browser.b.nr_entries =3D notes->src->nr_entries; diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 6fc07971631ac8a3..05eb19b110ab7dcf 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1270,7 +1270,7 @@ int hist_entry__annotate_printf(struct hist_entry *he= , struct evsel *evsel) apd.addr_fmt_width =3D annotated_source__addr_fmt_width(¬es->src->sour= ce, apd.start); evsel__get_arch(evsel, &apd.arch); - apd.dbg =3D debuginfo__new(filename); + apd.dbg =3D dso__debuginfo(dso); =20 list_for_each_entry(pos, ¬es->src->source, node) { int err; @@ -1375,7 +1375,7 @@ static int symbol__annotate_fprintf2(struct symbol *s= ym, FILE *fp, =20 if (annotate_opts.code_with_type) { evsel__get_arch(apd->evsel, &apd->arch); - apd->dbg =3D debuginfo__new(dso__long_name(map__dso(apd->he->ms.map))); + apd->dbg =3D dso__debuginfo(map__dso(apd->he->ms.map)); } =20 list_for_each_entry(al, ¬es->src->source, node) { @@ -2888,7 +2888,7 @@ struct annotated_data_type *hist_entry__get_data_type= (struct hist_entry *he) di_cache.dso =3D dso__get(map__dso(ms->map)); =20 debuginfo__delete(di_cache.dbg); - di_cache.dbg =3D debuginfo__new(dso__long_name(di_cache.dso)); + di_cache.dbg =3D dso__debuginfo(di_cache.dso); } =20 if (di_cache.dbg =3D=3D NULL) { diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index 7df1673f08d3ddb4..fd8e95de77f78dfc 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h @@ -10,6 +10,7 @@ #include #include #include "build-id.h" +#include "debuginfo.h" #include "mutex.h" #include =20 @@ -914,4 +915,13 @@ u64 dso__findnew_global_type(struct dso *dso, u64 addr= , u64 offset); bool perf_pid_map_tid(const char *dso_name, int *tid); bool is_perf_pid_map_name(const char *dso_name); =20 +/* + * In the future, we may get debuginfo using build-ID (w/o path). + * Add this helper is for the smooth conversion. + */ +static inline struct debuginfo *dso__debuginfo(struct dso *dso) +{ + return debuginfo__new(dso__long_name(dso)); +} + #endif /* __PERF_DSO */ --=20 2.50.1