perf annotate-data: Fix global variable lookup
authorNamhyung Kim <namhyung@kernel.org>
Fri, 5 Apr 2024 21:17:58 +0000 (14:17 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 12 Apr 2024 15:02:05 +0000 (12:02 -0300)
The recent change in the global variable handling added a bug to miss
setting the return value even if it found a data type.  Also add the
type name in the debug message.

Fixes: 1ebb5e17ef21b492 ("perf annotate-data: Add get_global_var_type()")
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240405211800.1412920-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/annotate-data.c

index 043d80791bd0c19d19355b328f25ca814ad4eeff..1047ea9d578c5ca2502feeb9b58632d981c7628d 100644 (file)
@@ -1468,8 +1468,10 @@ static int find_data_type_die(struct data_loc_info *dloc, Dwarf_Die *type_die)
                                        &offset, type_die)) {
                        dloc->type_offset = offset;
 
-                       pr_debug_dtp("found PC-rel by addr=%#"PRIx64" offset=%#x\n",
+                       pr_debug_dtp("found PC-rel by addr=%#"PRIx64" offset=%#x",
                                     dloc->var_addr, offset);
+                       pr_debug_type_name(type_die, TSR_KIND_TYPE);
+                       ret = 0;
                        goto out;
                }
        }