Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf auxtrace: Alter addr_filter__entire_dso() to work if there are no symbols

addr_filter__entire_dso() uses the first and last symbols from a dso,
and so does not work when there are no symbols. Alter it to filter the
whole file instead.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Fixes: 1b36c03e3569 ("perf record: Add support for using symbols in address filters")
Link: http://lkml.kernel.org/r/20181127084634.12469-1-adrian.hunter@intel.com
[ split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
57176601 b5c2161c

+4 -7
+4 -7
tools/perf/util/auxtrace.c
··· 1983 1983 1984 1984 static int addr_filter__entire_dso(struct addr_filter *filt, struct dso *dso) 1985 1985 { 1986 - struct symbol *first_sym = dso__first_symbol(dso); 1987 - struct symbol *last_sym = dso__last_symbol(dso); 1988 - 1989 - if (!first_sym || !last_sym) { 1990 - pr_err("Failed to determine filter for %s\nNo symbols found.\n", 1986 + if (dso__data_file_size(dso, NULL)) { 1987 + pr_err("Failed to determine filter for %s\nCannot determine file size.\n", 1991 1988 filt->filename); 1992 1989 return -EINVAL; 1993 1990 } 1994 1991 1995 - filt->addr = first_sym->start; 1996 - filt->size = last_sym->end - first_sym->start; 1992 + filt->addr = 0; 1993 + filt->size = dso->data.file_size; 1997 1994 1998 1995 return 0; 1999 1996 }