mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-08 10:59:46 +00:00
perf annotate: Fix annotation_calc_lines() to pass correct address to get_srcline()
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: 7d18a824b5 ("perf annotate: Toggle full address <-> offset display")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240404175716.1225482-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
218c200f67
commit
aaf494cf48
@@ -1440,7 +1440,7 @@ void annotation__toggle_full_addr(struct annotation *notes, struct map_symbol *m
|
|||||||
annotation__update_column_widths(notes);
|
annotation__update_column_widths(notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void annotation__calc_lines(struct annotation *notes, struct map *map,
|
static void annotation__calc_lines(struct annotation *notes, struct map_symbol *ms,
|
||||||
struct rb_root *root)
|
struct rb_root *root)
|
||||||
{
|
{
|
||||||
struct annotation_line *al;
|
struct annotation_line *al;
|
||||||
@@ -1448,6 +1448,7 @@ static void annotation__calc_lines(struct annotation *notes, struct map *map,
|
|||||||
|
|
||||||
list_for_each_entry(al, ¬es->src->source, node) {
|
list_for_each_entry(al, ¬es->src->source, node) {
|
||||||
double percent_max = 0.0;
|
double percent_max = 0.0;
|
||||||
|
u64 addr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < al->data_nr; i++) {
|
for (i = 0; i < al->data_nr; i++) {
|
||||||
@@ -1463,8 +1464,9 @@ static void annotation__calc_lines(struct annotation *notes, struct map *map,
|
|||||||
if (percent_max <= 0.5)
|
if (percent_max <= 0.5)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
al->path = get_srcline(map__dso(map), notes->start + al->offset, NULL,
|
addr = map__rip_2objdump(ms->map, ms->sym->start);
|
||||||
false, true, notes->start + al->offset);
|
al->path = get_srcline(map__dso(ms->map), addr + al->offset, NULL,
|
||||||
|
false, true, ms->sym->start + al->offset);
|
||||||
insert_source_line(&tmp_root, al);
|
insert_source_line(&tmp_root, al);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1475,7 +1477,7 @@ static void symbol__calc_lines(struct map_symbol *ms, struct rb_root *root)
|
|||||||
{
|
{
|
||||||
struct annotation *notes = symbol__annotation(ms->sym);
|
struct annotation *notes = symbol__annotation(ms->sym);
|
||||||
|
|
||||||
annotation__calc_lines(notes, ms->map, root);
|
annotation__calc_lines(notes, ms, root);
|
||||||
}
|
}
|
||||||
|
|
||||||
int symbol__tty_annotate2(struct map_symbol *ms, struct evsel *evsel)
|
int symbol__tty_annotate2(struct map_symbol *ms, struct evsel *evsel)
|
||||||
|
|||||||
Reference in New Issue
Block a user