lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3001bde2-b010-3c00-17de-1c78ef4b589b@intel.com>
Date:   Wed, 19 Apr 2023 21:58:10 +0300
From:   Adrian Hunter <adrian.hunter@...el.com>
To:     Changbin Du <changbin.du@...wei.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Ian Rogers <irogers@...gle.com>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        Hui Wang <hw.huiwang@...wei.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH v5 2/3] perf: add helper map__fprintf_dsoname_dsoff

On 18/04/23 06:18, Changbin Du wrote:
> This adds a helper function map__fprintf_dsoname_dsoff() to print dsoname
> with optional dso offset.
> 
> Suggested-by: Adrian Hunter <adrian.hunter@...el.com>
> Signed-off-by: Changbin Du <changbin.du@...wei.com>
> ---
>  tools/perf/util/map.c | 13 +++++++++++++
>  tools/perf/util/map.h |  1 +
>  2 files changed, 14 insertions(+)
> 
> diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
> index d81b6ca18ee9..7da96b41100f 100644
> --- a/tools/perf/util/map.c
> +++ b/tools/perf/util/map.c
> @@ -445,6 +445,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)

That will also block vmlinux offsets not just [kernel.kallsyms]
Is that what was intended?

> +		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)
> diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
> index f89ab7c2d327..4cca211b6e66 100644
> --- a/tools/perf/util/map.h
> +++ b/tools/perf/util/map.h
> @@ -175,6 +175,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);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ