mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
perf map: Add helper map__fprintf_dsoname_dsoff
This adds a helper function map__fprintf_dsoname_dsoff() to print dsoname with optional dso offset. Suggested-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Changbin Du <changbin.du@huawei.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Hui Wang <hw.huiwang@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20230418031825.1262579-3-changbin.du@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
2d4c53973f
commit
2b433fadb1
2 changed files with 14 additions and 0 deletions
|
@ -452,6 +452,19 @@ size_t map__fprintf_dsoname(struct map *map, FILE *fp)
|
|||
return fprintf(fp, "%s", dsoname);
|
||||
}
|
||||
|
||||
size_t map__fprintf_dsoname_dsoff(struct map *map, bool print_off, u64 addr, FILE *fp)
|
||||
{
|
||||
int printed = 0;
|
||||
|
||||
printed += fprintf(fp, " (");
|
||||
printed += map__fprintf_dsoname(map, fp);
|
||||
if (print_off && map && map__dso(map) && !map__dso(map)->kernel)
|
||||
printed += fprintf(fp, "+0x%" PRIx64, addr);
|
||||
printed += fprintf(fp, ")");
|
||||
|
||||
return printed;
|
||||
}
|
||||
|
||||
char *map__srcline(struct map *map, u64 addr, struct symbol *sym)
|
||||
{
|
||||
if (map == NULL)
|
||||
|
|
|
@ -194,6 +194,7 @@ static inline void __map__zput(struct map **map)
|
|||
|
||||
size_t map__fprintf(struct map *map, FILE *fp);
|
||||
size_t map__fprintf_dsoname(struct map *map, FILE *fp);
|
||||
size_t map__fprintf_dsoname_dsoff(struct map *map, bool print_off, u64 addr, FILE *fp);
|
||||
char *map__srcline(struct map *map, u64 addr, struct symbol *sym);
|
||||
int map__fprintf_srcline(struct map *map, u64 addr, const char *prefix,
|
||||
FILE *fp);
|
||||
|
|
Loading…
Reference in a new issue