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: <20240508085751.a1a5dbd31e1fa7d4e80cdd85@kernel.org>
Date: Wed, 8 May 2024 08:57:51 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, Ian Rogers
 <irogers@...gle.com>, Kan Liang <kan.liang@...ux.intel.com>, Jiri Olsa
 <jolsa@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>, Peter Zijlstra
 <peterz@...radead.org>, Ingo Molnar <mingo@...nel.org>, LKML
 <linux-kernel@...r.kernel.org>, linux-perf-users@...r.kernel.org, Masami
 Hiramatsu <mhiramat@...nel.org>
Subject: Re: [PATCH] perf dwarf-aux: Print array type name with "[]"

On Mon,  6 May 2024 21:13:38 -0700
Namhyung Kim <namhyung@...nel.org> wrote:

> It's confusing both pointers and arrays are printed as *.  Let's print
> array types with [] so that we can identify them easily.  Although it's
> interchangable, sometimes it can cause confusion with size like in the
> below example.
> 
> Note that it is not the same with C syntax where it goes to the variable
> names, but we want to have it in the type names (like in Go language).
> 
> Before:
>   mov [20] 0x68(reg5) -> reg0 type='struct page**' size=0x80 (die:0x4e61d32)
> 
> After:
>   mov [20] 0x68(reg5) -> reg0 type='struct page*[]' size=0x80 (die:0x4e61d32)
> 

Good improvement!

Acked-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>

Thank you!

> Cc: Masami Hiramatsu <mhiramat@...nel.org>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
>  tools/perf/util/dwarf-aux.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
> index c0a492e65388..ec988f294497 100644
> --- a/tools/perf/util/dwarf-aux.c
> +++ b/tools/perf/util/dwarf-aux.c
> @@ -1110,8 +1110,10 @@ int die_get_typename_from_type(Dwarf_Die *type_die, struct strbuf *buf)
>  	const char *tmp = "";
>  
>  	tag = dwarf_tag(type_die);
> -	if (tag == DW_TAG_array_type || tag == DW_TAG_pointer_type)
> +	if (tag == DW_TAG_pointer_type)
>  		tmp = "*";
> +	else if (tag == DW_TAG_array_type)
> +		tmp = "[]";
>  	else if (tag == DW_TAG_subroutine_type) {
>  		/* Function pointer */
>  		return strbuf_add(buf, "(function_type)", 15);
> -- 
> 2.45.0.rc1.225.g2a3ae87e7f-goog
> 


-- 
Masami Hiramatsu (Google) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ