From nobody Mon Oct 6 03:14:00 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 AEBD125A352; Fri, 25 Jul 2025 19:38:05 +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=1753472285; cv=none; b=LznUPSocr/aiuR9DzGrEhnJtNJKa2YjtmBhX86lNjq7aD9j1WvRYTCPwdaEQ18bpqaTMnQEcZeCICi8yXWVVzYoXQBS2lj8HISTYuklim1B7OD+nC8mJdE7Jet1XydYlgUPynwtmmHHauRPNZTjP7MqfdpIVrxcNfbwxU/9asYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753472285; c=relaxed/simple; bh=rMP4NwEbgs09Yo6duPN7LsyJrXjr4LcRueUhN1EP6L0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XkqoAeItPuv4/ax3WD/uYqvuFFB3AbHR5sp3wASOLLm7nKSUucpXUS/Mjwql0wZag18Q1OEY5lULlszFdIIetDHgBUzG25k1KI+qMf5SUPNUhC8o23XlqGRlaJ8riEhR7EVxxa/wShiXh3C7yQBrHa3Kq125jIpj8d7O47wFR6Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QsvrNXeH; 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="QsvrNXeH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C67A3C4CEF8; Fri, 25 Jul 2025 19:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753472285; bh=rMP4NwEbgs09Yo6duPN7LsyJrXjr4LcRueUhN1EP6L0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QsvrNXeHY26NDoQp4A8mJfP6ig1bOkYAim2QVT1IgQFGTSyVLAriZOB+pciHdsJQ9 O5KQTIUyQBqUdIAs2++p2tTD4Pc9wOpkOt4jceJEaE7sWwgzSh3s7+UkVMw/Y2ec3y aRSRynFmRF+msMUGb+nhad7o2qe7p8oonR9nPunL2CWim9TvPsGZBHJSp4fIf3vpoD TjZI9lwCTegEwlWnJk0v+5fjpi1LcGqGOwi8X5KgQp66f7ZwkFP6HtcMVks1D9P2d6 BPMi60mJHyM5uAIGPVheowQGjLHGl9ITaGExAD1Vy/azcg/pxAAUQfJsGry4EBiRfp U4ZyrbxJsaQqg== 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 7/9] perf annotate: Show warning when debuginfo is not available Date: Fri, 25 Jul 2025 12:37:53 -0700 Message-ID: <20250725193755.12276-8-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" When user requests data-type annotation but no DWARF info is available, show a warning message about it. Warning: DWARF debuginfo not found. Data-type in this DSO will not be displayed. Please make sure to have debug information. Press any key... Signed-off-by: Namhyung Kim --- tools/perf/ui/browsers/annotate.c | 17 +++++++++++++++++ tools/perf/util/dso.h | 11 +++++++++++ 2 files changed, 28 insertions(+) diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/ann= otate.c index 4b059e0bafd33fcf..2a4db5bdcdb7e9d8 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -804,6 +804,20 @@ static int annotate__scnprintf_title(struct hists *his= ts, char *bf, size_t size) return printed; } =20 +static void annotate_browser__debuginfo_warning(struct annotate_browser *b= rowser) +{ + struct map_symbol *ms =3D browser->b.priv; + struct dso *dso =3D map__dso(ms->map); + + if (browser->dbg =3D=3D NULL && annotate_opts.code_with_type && + !dso__debuginfo_warned(dso)) { + ui__warning("DWARF debuginfo not found.\n\n" + "Data-type in this DSO will not be displayed.\n" + "Please make sure to have debug information."); + dso__set_debuginfo_warned(dso); + } +} + static int annotate_browser__run(struct annotate_browser *browser, struct evsel *evsel, struct hist_browser_timer *hbt) @@ -834,6 +848,8 @@ static int annotate_browser__run(struct annotate_browse= r *browser, =20 annotation_br_cntr_abbr_list(&br_cntr_text, evsel, false); =20 + annotate_browser__debuginfo_warning(browser); + while (1) { key =3D ui_browser__run(&browser->b, delay_secs); =20 @@ -1028,6 +1044,7 @@ static int annotate_browser__run(struct annotate_brow= ser *browser, if (browser->dbg =3D=3D NULL) browser->dbg =3D debuginfo__new(dso__long_name(map__dso(ms->map))); annotate_browser__show(&browser->b, title, help); + annotate_browser__debuginfo_warning(browser); continue; case K_LEFT: case '<': diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index 3457d713d3c56df6..7df1673f08d3ddb4 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h @@ -299,6 +299,7 @@ DECLARE_RC_STRUCT(dso) { u8 hit:1; u8 annotate_warned:1; u8 auxtrace_warned:1; + u8 debuginfo_warned:1; u8 short_name_allocated:1; u8 long_name_allocated:1; u8 is_64_bit:1; @@ -362,6 +363,16 @@ static inline void dso__set_annotate_warned(struct dso= *dso) RC_CHK_ACCESS(dso)->annotate_warned =3D 1; } =20 +static inline bool dso__debuginfo_warned(const struct dso *dso) +{ + return RC_CHK_ACCESS(dso)->debuginfo_warned; +} + +static inline void dso__set_debuginfo_warned(struct dso *dso) +{ + RC_CHK_ACCESS(dso)->debuginfo_warned =3D 1; +} + static inline bool dso__auxtrace_warned(const struct dso *dso) { return RC_CHK_ACCESS(dso)->auxtrace_warned; --=20 2.50.1