aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/perf/util/dwarf-aux.h
diff options
context:
space:
mode:
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>2022-11-01 22:48:49 +0900
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-11-03 09:28:46 -0300
commitdc9a5d2ccd5c823cc05cafe75fcf19b682d8152c (patch)
tree1927d915367fa598dac3e10d119049a4d74748fc /tools/perf/util/dwarf-aux.h
parentperf probe: Use dwarf_attr_integrate as generic DWARF attr accessor (diff)
downloadwireguard-linux-dc9a5d2ccd5c823cc05cafe75fcf19b682d8152c.tar.xz
wireguard-linux-dc9a5d2ccd5c823cc05cafe75fcf19b682d8152c.zip
perf probe: Fix to get declared file name from clang DWARF5
Fix to get the declared file name even if it uses file index 0 in DWARF5, using custom die_get_decl_file() function. Actually, the DWARF5 standard says file index 0 of the DW_AT_decl_file is invalid(1), but there is a discussion and maybe this will be updated [2]. Anyway, clang generates such DWARF5 file for the linux kernel. Thus it must be handled. Without this, 'perf probe' returns an error: $ ./perf probe -k $BIN_PATH/vmlinux -s $SRC_PATH -L vfs_read:10 Debuginfo analysis failed. Error: Failed to show lines. With this, it can handle the case correctly: $ ./perf probe -k $BIN_PATH/vmlinux -s $SRC_PATH -L vfs_read:10 <vfs_read@$SRC_PATH/fs/read_write.c:10> 11 ret = rw_verify_area(READ, file, pos, count); 12 if (ret) return ret; [1] DWARF5 specification 2.14 says "The value 0 indicates that no source file has been specified.") [2] http://wiki.dwarfstd.org/index.php?title=DWARF5_Line_Table_File_Numbers) Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt (VMware) <rostedt@goodmis.org> Link: https://lore.kernel.org/r/166731052936.2100653.13380621874859467731.stgit@devnote3 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/dwarf-aux.h')
-rw-r--r--tools/perf/util/dwarf-aux.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h
index 7ee0fa19b5c4..7ec8bc1083bb 100644
--- a/tools/perf/util/dwarf-aux.h
+++ b/tools/perf/util/dwarf-aux.h
@@ -50,6 +50,9 @@ int die_get_call_lineno(Dwarf_Die *in_die);
/* Get callsite file name of inlined function instance */
const char *die_get_call_file(Dwarf_Die *in_die);
+/* Get declared file name of a DIE */
+const char *die_get_decl_file(Dwarf_Die *dw_die);
+
/* Get type die */
Dwarf_Die *die_get_type(Dwarf_Die *vr_die, Dwarf_Die *die_mem);