Re: [PATCH v2 13/14] perf util: do not consider empty files as valid srclines
Em Sun, Aug 06, 2017 at 11:24:45PM +0200, Milian Wolff escreveu: > Sometimes we get a non-null, but empty, string for the filename from > bfd. This then results in srclines of the form ":0", which is > different from the canonical SRCLINE_UNKNOWN in the form "??:0". > Set the file to NULL if it is empty to fix this. I cherry picked this one now, i.e. looks useful even before looking at the other patches in depth. - Arnaldo > Cc: Arnaldo Carvalho de Melo> Cc: David Ahern > Cc: Namhyung Kim > Cc: Peter Zijlstra > Cc: Yao Jin > Signed-off-by: Milian Wolff > --- > tools/perf/util/srcline.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c > index 0c5ee741c515..7bf38b78a1ba 100644 > --- a/tools/perf/util/srcline.c > +++ b/tools/perf/util/srcline.c > @@ -168,6 +168,9 @@ static void find_address_in_section(bfd *abfd, asection > *section, void *data) > a2l->found = bfd_find_nearest_line(abfd, section, a2l->syms, pc - vma, > >filename, >funcname, > >line); > + > + if (a2l->filename && !strlen(a2l->filename)) > + a2l->filename = NULL; > } > > static struct a2l_data *addr2line_init(const char *path) > @@ -297,6 +300,9 @@ static int addr2line(const char *dso_name, u64 addr, >>funcname, >line) && > cnt++ < MAX_INLINE_NEST) { > > + if (a2l->filename && !strlen(a2l->filename)) > + a2l->filename = NULL; > + > if (node != NULL) { > if (inline_list__append_dso_a2l(dso, node, sym)) > return 0; > -- > 2.13.3
Re: [PATCH v2 13/14] perf util: do not consider empty files as valid srclines
Em Sun, Aug 06, 2017 at 11:24:45PM +0200, Milian Wolff escreveu: > Sometimes we get a non-null, but empty, string for the filename from > bfd. This then results in srclines of the form ":0", which is > different from the canonical SRCLINE_UNKNOWN in the form "??:0". > Set the file to NULL if it is empty to fix this. I cherry picked this one now, i.e. looks useful even before looking at the other patches in depth. - Arnaldo > Cc: Arnaldo Carvalho de Melo > Cc: David Ahern > Cc: Namhyung Kim > Cc: Peter Zijlstra > Cc: Yao Jin > Signed-off-by: Milian Wolff > --- > tools/perf/util/srcline.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c > index 0c5ee741c515..7bf38b78a1ba 100644 > --- a/tools/perf/util/srcline.c > +++ b/tools/perf/util/srcline.c > @@ -168,6 +168,9 @@ static void find_address_in_section(bfd *abfd, asection > *section, void *data) > a2l->found = bfd_find_nearest_line(abfd, section, a2l->syms, pc - vma, > >filename, >funcname, > >line); > + > + if (a2l->filename && !strlen(a2l->filename)) > + a2l->filename = NULL; > } > > static struct a2l_data *addr2line_init(const char *path) > @@ -297,6 +300,9 @@ static int addr2line(const char *dso_name, u64 addr, >>funcname, >line) && > cnt++ < MAX_INLINE_NEST) { > > + if (a2l->filename && !strlen(a2l->filename)) > + a2l->filename = NULL; > + > if (node != NULL) { > if (inline_list__append_dso_a2l(dso, node, sym)) > return 0; > -- > 2.13.3
[PATCH v2 13/14] perf util: do not consider empty files as valid srclines
Sometimes we get a non-null, but empty, string for the filename from bfd. This then results in srclines of the form ":0", which is different from the canonical SRCLINE_UNKNOWN in the form "??:0". Set the file to NULL if it is empty to fix this. Cc: Arnaldo Carvalho de MeloCc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Yao Jin Signed-off-by: Milian Wolff --- tools/perf/util/srcline.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index 0c5ee741c515..7bf38b78a1ba 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -168,6 +168,9 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data) a2l->found = bfd_find_nearest_line(abfd, section, a2l->syms, pc - vma, >filename, >funcname, >line); + + if (a2l->filename && !strlen(a2l->filename)) + a2l->filename = NULL; } static struct a2l_data *addr2line_init(const char *path) @@ -297,6 +300,9 @@ static int addr2line(const char *dso_name, u64 addr, >funcname, >line) && cnt++ < MAX_INLINE_NEST) { + if (a2l->filename && !strlen(a2l->filename)) + a2l->filename = NULL; + if (node != NULL) { if (inline_list__append_dso_a2l(dso, node, sym)) return 0; -- 2.13.3
[PATCH v2 13/14] perf util: do not consider empty files as valid srclines
Sometimes we get a non-null, but empty, string for the filename from bfd. This then results in srclines of the form ":0", which is different from the canonical SRCLINE_UNKNOWN in the form "??:0". Set the file to NULL if it is empty to fix this. Cc: Arnaldo Carvalho de Melo Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Yao Jin Signed-off-by: Milian Wolff --- tools/perf/util/srcline.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index 0c5ee741c515..7bf38b78a1ba 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -168,6 +168,9 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data) a2l->found = bfd_find_nearest_line(abfd, section, a2l->syms, pc - vma, >filename, >funcname, >line); + + if (a2l->filename && !strlen(a2l->filename)) + a2l->filename = NULL; } static struct a2l_data *addr2line_init(const char *path) @@ -297,6 +300,9 @@ static int addr2line(const char *dso_name, u64 addr, >funcname, >line) && cnt++ < MAX_INLINE_NEST) { + if (a2l->filename && !strlen(a2l->filename)) + a2l->filename = NULL; + if (node != NULL) { if (inline_list__append_dso_a2l(dso, node, sym)) return 0; -- 2.13.3