From nobody Tue Feb 10 06:06:13 2026 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 C037512F5BC; Thu, 4 Apr 2024 17:57:19 +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=1712253439; cv=none; b=nxNJ9oFzgE0pgKYJuiqS5Y/HaBihE6AcTSRSdVYUAaUsYpTcAyFuNF3BoeYXjtFRjMxPal359OeFZLJ8jYn1B656ABFlpizVl9uY0Y9HcLRt4aNGATaY6B9lfYeAak1VDVTUr0CTZMGwnk51vDuM8TG7Uq2oWWNXjA/6vPMa/gg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712253439; c=relaxed/simple; bh=GpzHHadLf3YosmcJ25cQdas5aywqFNxjfnYY+ULKu6U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pq2o6m3vGRjflWdjxiBLUSw2rVlw3oPImnAcweTj/B8Mw12Jg9j+FXfJMBIr3ILFJCL4K562eRKr/jK6l+xgJ/oUK8ZQCYUZFw6KKAqp+jlpRWJMJKMtyMfsgaDHucF4cjggkibKSOyvvcQmGDKeIwQ4JTFSPIXKAw0RhGE7dRc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IapbwqgI; 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="IapbwqgI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4F7DC433B1; Thu, 4 Apr 2024 17:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712253439; bh=GpzHHadLf3YosmcJ25cQdas5aywqFNxjfnYY+ULKu6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IapbwqgIG6nVtU4XbjbiafvS0yiobNrsyYLPd0Fl0YCdfNlToQymVKTID/Bve+jT6 dKvHnyqPeO+O8g8VpT5YzO2W3Jo6YsdoyM3g1IrdxLGKec2/9jlTjisCbMSzywNVY7 0MkPtZFruKk6SXi3faO6IjNmv8YvvzQIfaonX66dnVFe/AVQ3OMnBA3IU3RCX7kQNf l8rneWG4zQE3eeU6E4vQAD8bcg//22oulCv1DFDB632PVmD0XheOSdTKH86qzfjbhP 3YAKTEHYm4ZtZaQObn6w+RvK49GdLrr4/cd2WdaMhIdHM+C3IXVRcmc3kX5Bu18QvE pJVi+CdxCBy9Q== 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 1/9] perf annotate: Fix annotation_calc_lines() Date: Thu, 4 Apr 2024 10:57:08 -0700 Message-ID: <20240404175716.1225482-2-namhyung@kernel.org> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog In-Reply-To: <20240404175716.1225482-1-namhyung@kernel.org> References: <20240404175716.1225482-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 should pass a proper address (i.e. suitable for objdump or addr2line) to get_srcline() in order to work correctly. It used to pass an address with map__rip_2objdump() as the second argument but later it's changed to use notes->start. It's ok in normal cases but it can be changed when annotate_opts.full_addr is set. So let's convert the address directly instead of using the notes->start. Also the last argument is an IP to print symbol offset if requested. So it should pass symbol-relative address. Fixes: 7d18a824b5e5 ("perf annotate: Toggle full address <-> offset display= ") Signed-off-by: Namhyung Kim --- tools/perf/util/annotate.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 35235147b111..a330e92c2552 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1440,7 +1440,7 @@ void annotation__toggle_full_addr(struct annotation *= notes, struct map_symbol *m annotation__update_column_widths(notes); } =20 -static void annotation__calc_lines(struct annotation *notes, struct map *m= ap, +static void annotation__calc_lines(struct annotation *notes, struct map_sy= mbol *ms, struct rb_root *root) { struct annotation_line *al; @@ -1448,6 +1448,7 @@ static void annotation__calc_lines(struct annotation = *notes, struct map *map, =20 list_for_each_entry(al, ¬es->src->source, node) { double percent_max =3D 0.0; + u64 addr; int i; =20 for (i =3D 0; i < al->data_nr; i++) { @@ -1463,8 +1464,9 @@ static void annotation__calc_lines(struct annotation = *notes, struct map *map, if (percent_max <=3D 0.5) continue; =20 - al->path =3D get_srcline(map__dso(map), notes->start + al->offset, NULL, - false, true, notes->start + al->offset); + addr =3D map__rip_2objdump(ms->map, ms->sym->start); + al->path =3D get_srcline(map__dso(ms->map), addr + al->offset, NULL, + false, true, ms->sym->start + al->offset); insert_source_line(&tmp_root, al); } =20 @@ -1475,7 +1477,7 @@ static void symbol__calc_lines(struct map_symbol *ms,= struct rb_root *root) { struct annotation *notes =3D symbol__annotation(ms->sym); =20 - annotation__calc_lines(notes, ms->map, root); + annotation__calc_lines(notes, ms, root); } =20 int symbol__tty_annotate2(struct map_symbol *ms, struct evsel *evsel) --=20 2.44.0.478.gd926399ef9-goog