Skip to content

Commit 187c219

Browse files
namhyungacmel
authored andcommitted
perf dwarf-aux: Print array type name with "[]"
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) Signed-off-by: Namhyung Kim <[email protected]> Acked-by: Masami Hiramatsu <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Ian Rogers <[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]>
1 parent d561e17 commit 187c219

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/perf/util/dwarf-aux.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,8 +1110,10 @@ int die_get_typename_from_type(Dwarf_Die *type_die, struct strbuf *buf)
11101110
const char *tmp = "";
11111111

11121112
tag = dwarf_tag(type_die);
1113-
if (tag == DW_TAG_array_type || tag == DW_TAG_pointer_type)
1113+
if (tag == DW_TAG_pointer_type)
11141114
tmp = "*";
1115+
else if (tag == DW_TAG_array_type)
1116+
tmp = "[]";
11151117
else if (tag == DW_TAG_subroutine_type) {
11161118
/* Function pointer */
11171119
return strbuf_add(buf, "(function_type)", 15);

0 commit comments

Comments
 (0)