From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ian Rogers <irogers@google.com>,
Kan Liang <kan.liang@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>
Subject: Re: [PATCH] perf dwarf-aux: Print array type name with "[]"
Date: Wed, 8 May 2024 08:57:51 +0900 [thread overview]
Message-ID: <20240508085751.a1a5dbd31e1fa7d4e80cdd85@kernel.org> (raw)
In-Reply-To: <20240507041338.2081775-1-namhyung@kernel.org>
On Mon, 6 May 2024 21:13:38 -0700
Namhyung Kim <namhyung@kernel.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@kernel.org>
Thank you!
> Cc: Masami Hiramatsu <mhiramat@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.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@kernel.org>
next prev parent reply other threads:[~2024-05-07 23:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 4:13 [PATCH] perf dwarf-aux: Print array type name with "[]" Namhyung Kim
2024-05-07 23:57 ` Masami Hiramatsu [this message]
2024-05-08 0:42 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240508085751.a1a5dbd31e1fa7d4e80cdd85@kernel.org \
--to=mhiramat@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).