diff options
| author | Namhyung Kim <[email protected]> | 2024-04-05 21:17:59 +0000 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <[email protected]> | 2024-04-12 15:02:05 +0000 |
| commit | 879ebf3c830dba437781d034c536af53b0bff0c0 (patch) | |
| tree | 3d85e5c5e9cc9f33624abaca319755f8182f4148 /tools/perf/util/annotate-data.c | |
| parent | perf annotate-data: Fix global variable lookup (diff) | |
| download | kernel-879ebf3c830dba437781d034c536af53b0bff0c0.tar.gz kernel-879ebf3c830dba437781d034c536af53b0bff0c0.zip | |
perf annotate-data: Do not delete non-asm lines
For data type profiling, it removed non-instruction lines from the list
of annotation lines. It was to simplify the implementation dealing with
instructions like to calculate the PC-relative address and to search the
shortest path to the target instruction or basic block.
But it means that it removes all the comments and debug information in
the annotate output like source file name and line numbers. To support
both code annotation and data type annotation, it'd be better to keep
the non-instruction lines as well.
So this change is to skip those lines during the data type profiling
and to display them in the normal perf annotate output.
No function changes intended (other than having more lines).
Reviewed-by: Ian Rogers <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/util/annotate-data.c')
| -rw-r--r-- | tools/perf/util/annotate-data.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/util/annotate-data.c b/tools/perf/util/annotate-data.c index 1047ea9d578c..b69a1cd1577a 100644 --- a/tools/perf/util/annotate-data.c +++ b/tools/perf/util/annotate-data.c @@ -1314,6 +1314,8 @@ static int find_data_type_insn(struct data_loc_info *dloc, int reg, list_for_each_entry(bb, basic_blocks, list) { struct disasm_line *dl = bb->begin; + BUG_ON(bb->begin->al.offset == -1 || bb->end->al.offset == -1); + pr_debug_dtp("bb: [%"PRIx64" - %"PRIx64"]\n", bb->begin->al.offset, bb->end->al.offset); @@ -1321,6 +1323,10 @@ static int find_data_type_insn(struct data_loc_info *dloc, int reg, u64 this_ip = sym->start + dl->al.offset; u64 addr = map__rip_2objdump(dloc->ms->map, this_ip); + /* Skip comment or debug info lines */ + if (dl->al.offset == -1) + continue; + /* Update variable type at this address */ update_var_state(&state, dloc, addr, dl->al.offset, var_types); |
