Re: [PATCH] perf, tools: Always use non inlined file name for srcfile
Em Tue, Sep 01, 2015 at 11:48:39AM -0700, Andi Kleen escreveu: > On Tue, Sep 01, 2015 at 03:36:57PM -0300, Arnaldo Carvalho de Melo wrote: > > Em Tue, Sep 01, 2015 at 11:11:42AM -0700, Andi Kleen escreveu: > > > From: Andi Kleen > > > > > > When profiling the kernel with srcfile it's common to "get > > > stuck" in include. For example a lot of code uses current > > > or other inlines, so they get accounted to some random > > > include file. This is not very useful as a high level > > > categorization. > > > > Cool idea :-) > > Yes. > > It would be also nice to use this information for unwinding > (so to show the inline stack as part of the call graph) Yes, agreed. > > Why not the so much simpler: > > > > while (bfd_find_inliner_info(...)); > > > > But other than that, wouldn't be better to put an upper limit on this? > > > > Say, 1024 levels of unwinding to avoid tripping in some bfd lib bug that > > could make this function always return true and make addr2line get stuck > > in an infinite loop? > > Done. I sent a v2. Thanks, I applied v2. - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] perf, tools: Always use non inlined file name for srcfile
On Tue, Sep 01, 2015 at 03:36:57PM -0300, Arnaldo Carvalho de Melo wrote: > Em Tue, Sep 01, 2015 at 11:11:42AM -0700, Andi Kleen escreveu: > > From: Andi Kleen > > > > When profiling the kernel with srcfile it's common to "get > > stuck" in include. For example a lot of code uses current > > or other inlines, so they get accounted to some random > > include file. This is not very useful as a high level > > categorization. > > Cool idea :-) Yes. It would be also nice to use this information for unwinding (so to show the inline stack as part of the call graph) > Why not the so much simpler: > > while (bfd_find_inliner_info(...)); > > But other than that, wouldn't be better to put an upper limit on this? > > Say, 1024 levels of unwinding to avoid tripping in some bfd lib bug that > could make this function always return true and make addr2line get stuck > in an infinite loop? Done. I sent a v2. -Andi -- a...@linux.intel.com -- Speaking for myself only -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] perf, tools: Always use non inlined file name for srcfile
From: Andi Kleen When profiling the kernel with srcfile it's common to "get stuck" in include. For example a lot of code uses current or other inlines, so they get accounted to some random include file. This is not very useful as a high level categorization. For example just profiling the idle loop usually shows mostly inlines, so you never see the actual cpuidle file. This patch changes srcfile to always unwind the inline stack using BFD/dwarf. So we always account to the base function that called the inline. In a few cases include is still shown (for example for MSR accesses), but that is because they get inlining expanded as part of assigning to a global function pointer. For the majority it works fine though. v2: Use simpler while loop. Add maximum iteration count. Signed-off-by: Andi Kleen --- tools/perf/util/sort.c| 4 ++-- tools/perf/util/srcline.c | 29 - tools/perf/util/util.h| 2 ++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 7e38716..a97bcee 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -328,8 +328,8 @@ static char *get_srcfile(struct hist_entry *e) char *sf, *p; struct map *map = e->ms.map; - sf = get_srcline(map->dso, map__rip_2objdump(map, e->ip), -e->ms.sym, true); + sf = __get_srcline(map->dso, map__rip_2objdump(map, e->ip), +e->ms.sym, false, true); if (!strcmp(sf, SRCLINE_UNKNOWN)) return no_srcfile; p = strchr(sf, ':'); diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index fc08248..c36bab6 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -149,8 +149,11 @@ static void addr2line_cleanup(struct a2l_data *a2l) free(a2l); } +#define MAX_INLINE_NEST 1024 + static int addr2line(const char *dso_name, u64 addr, -char **file, unsigned int *line, struct dso *dso) +char **file, unsigned int *line, struct dso *dso, +bool unwind_inlines) { int ret = 0; struct a2l_data *a2l = dso->a2l; @@ -170,6 +173,15 @@ static int addr2line(const char *dso_name, u64 addr, bfd_map_over_sections(a2l->abfd, find_address_in_section, a2l); + if (a2l->found && unwind_inlines) { + int cnt = 0; + + while (bfd_find_inliner_info(a2l->abfd, >filename, + >funcname, >line) + && cnt++ < MAX_INLINE_NEST) + ; + } + if (a2l->found && a2l->filename) { *file = strdup(a2l->filename); *line = a2l->line; @@ -197,7 +209,8 @@ void dso__free_a2l(struct dso *dso) static int addr2line(const char *dso_name, u64 addr, char **file, unsigned int *line_nr, -struct dso *dso __maybe_unused) +struct dso *dso __maybe_unused, +bool unwind_inlines __maybe_unused) { FILE *fp; char cmd[PATH_MAX]; @@ -254,8 +267,8 @@ void dso__free_a2l(struct dso *dso __maybe_unused) */ #define A2L_FAIL_LIMIT 123 -char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, - bool show_sym) +char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym, + bool show_sym, bool unwind_inlines) { char *file = NULL; unsigned line = 0; @@ -276,7 +289,7 @@ char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, if (!strncmp(dso_name, "/tmp/perf-", 10)) goto out; - if (!addr2line(dso_name, addr, , , dso)) + if (!addr2line(dso_name, addr, , , dso, unwind_inlines)) goto out; if (asprintf(, "%s:%u", @@ -310,3 +323,9 @@ void free_srcline(char *srcline) if (srcline && strcmp(srcline, SRCLINE_UNKNOWN) != 0) free(srcline); } + +char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, + bool show_sym) +{ + return __get_srcline(dso, addr, sym, show_sym, false); +} diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 291be1d..09c1a8b 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -321,6 +321,8 @@ struct symbol; extern bool srcline_full_filename; char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, bool show_sym); +char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym, + bool show_sym, bool unwind_inlines); void free_srcline(char *srcline); int filename__read_str(const char *filename, char **buf, size_t *sizep); -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ
Re: [PATCH] perf, tools: Always use non inlined file name for srcfile
Em Tue, Sep 01, 2015 at 11:11:42AM -0700, Andi Kleen escreveu: > From: Andi Kleen > > When profiling the kernel with srcfile it's common to "get > stuck" in include. For example a lot of code uses current > or other inlines, so they get accounted to some random > include file. This is not very useful as a high level > categorization. Cool idea :-) > For example just profiling the idle loop usually shows > mostly inlines, so you never see the actual cpuidle file. > @@ -170,6 +171,15 @@ static int addr2line(const char *dso_name, u64 addr, > > bfd_map_over_sections(a2l->abfd, find_address_in_section, a2l); > > + if (a2l->found && unwind_inlines) { > + bool found; > + > + do { > + found = bfd_find_inliner_info(a2l->abfd, >filename, > + >funcname, > >line); > + } while (found); > + } Why not the so much simpler: while (bfd_find_inliner_info(...)); But other than that, wouldn't be better to put an upper limit on this? Say, 1024 levels of unwinding to avoid tripping in some bfd lib bug that could make this function always return true and make addr2line get stuck in an infinite loop? - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] perf, tools: Always use non inlined file name for srcfile
From: Andi Kleen When profiling the kernel with srcfile it's common to "get stuck" in include. For example a lot of code uses current or other inlines, so they get accounted to some random include file. This is not very useful as a high level categorization. For example just profiling the idle loop usually shows mostly inlines, so you never see the actual cpuidle file. This patch changes srcfile to always unwind the inline stack using BFD/dwarf. So we always account to the base function that called the inline. In a few cases include is still shown (for example for MSR accesses), but that is because they get inlining expanded as part of assigning to a global function pointer. For the majority it works fine though. Signed-off-by: Andi Kleen --- tools/perf/util/sort.c| 4 ++-- tools/perf/util/srcline.c | 27 ++- tools/perf/util/util.h| 2 ++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 7e38716..a97bcee 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -328,8 +328,8 @@ static char *get_srcfile(struct hist_entry *e) char *sf, *p; struct map *map = e->ms.map; - sf = get_srcline(map->dso, map__rip_2objdump(map, e->ip), -e->ms.sym, true); + sf = __get_srcline(map->dso, map__rip_2objdump(map, e->ip), +e->ms.sym, false, true); if (!strcmp(sf, SRCLINE_UNKNOWN)) return no_srcfile; p = strchr(sf, ':'); diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index fc08248..8f025e2 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -150,7 +150,8 @@ static void addr2line_cleanup(struct a2l_data *a2l) } static int addr2line(const char *dso_name, u64 addr, -char **file, unsigned int *line, struct dso *dso) +char **file, unsigned int *line, struct dso *dso, +bool unwind_inlines) { int ret = 0; struct a2l_data *a2l = dso->a2l; @@ -170,6 +171,15 @@ static int addr2line(const char *dso_name, u64 addr, bfd_map_over_sections(a2l->abfd, find_address_in_section, a2l); + if (a2l->found && unwind_inlines) { + bool found; + + do { + found = bfd_find_inliner_info(a2l->abfd, >filename, + >funcname, >line); + } while (found); + } + if (a2l->found && a2l->filename) { *file = strdup(a2l->filename); *line = a2l->line; @@ -197,7 +207,8 @@ void dso__free_a2l(struct dso *dso) static int addr2line(const char *dso_name, u64 addr, char **file, unsigned int *line_nr, -struct dso *dso __maybe_unused) +struct dso *dso __maybe_unused, +bool unwind_inlines __maybe_unused) { FILE *fp; char cmd[PATH_MAX]; @@ -254,8 +265,8 @@ void dso__free_a2l(struct dso *dso __maybe_unused) */ #define A2L_FAIL_LIMIT 123 -char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, - bool show_sym) +char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym, + bool show_sym, bool unwind_inlines) { char *file = NULL; unsigned line = 0; @@ -276,7 +287,7 @@ char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, if (!strncmp(dso_name, "/tmp/perf-", 10)) goto out; - if (!addr2line(dso_name, addr, , , dso)) + if (!addr2line(dso_name, addr, , , dso, unwind_inlines)) goto out; if (asprintf(, "%s:%u", @@ -310,3 +321,9 @@ void free_srcline(char *srcline) if (srcline && strcmp(srcline, SRCLINE_UNKNOWN) != 0) free(srcline); } + +char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, + bool show_sym) +{ + return __get_srcline(dso, addr, sym, show_sym, false); +} diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 291be1d..09c1a8b 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -321,6 +321,8 @@ struct symbol; extern bool srcline_full_filename; char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, bool show_sym); +char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym, + bool show_sym, bool unwind_inlines); void free_srcline(char *srcline); int filename__read_str(const char *filename, char **buf, size_t *sizep); -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] perf, tools: Always use non inlined file name for srcfile
From: Andi KleenWhen profiling the kernel with srcfile it's common to "get stuck" in include. For example a lot of code uses current or other inlines, so they get accounted to some random include file. This is not very useful as a high level categorization. For example just profiling the idle loop usually shows mostly inlines, so you never see the actual cpuidle file. This patch changes srcfile to always unwind the inline stack using BFD/dwarf. So we always account to the base function that called the inline. In a few cases include is still shown (for example for MSR accesses), but that is because they get inlining expanded as part of assigning to a global function pointer. For the majority it works fine though. Signed-off-by: Andi Kleen --- tools/perf/util/sort.c| 4 ++-- tools/perf/util/srcline.c | 27 ++- tools/perf/util/util.h| 2 ++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 7e38716..a97bcee 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -328,8 +328,8 @@ static char *get_srcfile(struct hist_entry *e) char *sf, *p; struct map *map = e->ms.map; - sf = get_srcline(map->dso, map__rip_2objdump(map, e->ip), -e->ms.sym, true); + sf = __get_srcline(map->dso, map__rip_2objdump(map, e->ip), +e->ms.sym, false, true); if (!strcmp(sf, SRCLINE_UNKNOWN)) return no_srcfile; p = strchr(sf, ':'); diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index fc08248..8f025e2 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -150,7 +150,8 @@ static void addr2line_cleanup(struct a2l_data *a2l) } static int addr2line(const char *dso_name, u64 addr, -char **file, unsigned int *line, struct dso *dso) +char **file, unsigned int *line, struct dso *dso, +bool unwind_inlines) { int ret = 0; struct a2l_data *a2l = dso->a2l; @@ -170,6 +171,15 @@ static int addr2line(const char *dso_name, u64 addr, bfd_map_over_sections(a2l->abfd, find_address_in_section, a2l); + if (a2l->found && unwind_inlines) { + bool found; + + do { + found = bfd_find_inliner_info(a2l->abfd, >filename, + >funcname, >line); + } while (found); + } + if (a2l->found && a2l->filename) { *file = strdup(a2l->filename); *line = a2l->line; @@ -197,7 +207,8 @@ void dso__free_a2l(struct dso *dso) static int addr2line(const char *dso_name, u64 addr, char **file, unsigned int *line_nr, -struct dso *dso __maybe_unused) +struct dso *dso __maybe_unused, +bool unwind_inlines __maybe_unused) { FILE *fp; char cmd[PATH_MAX]; @@ -254,8 +265,8 @@ void dso__free_a2l(struct dso *dso __maybe_unused) */ #define A2L_FAIL_LIMIT 123 -char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, - bool show_sym) +char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym, + bool show_sym, bool unwind_inlines) { char *file = NULL; unsigned line = 0; @@ -276,7 +287,7 @@ char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, if (!strncmp(dso_name, "/tmp/perf-", 10)) goto out; - if (!addr2line(dso_name, addr, , , dso)) + if (!addr2line(dso_name, addr, , , dso, unwind_inlines)) goto out; if (asprintf(, "%s:%u", @@ -310,3 +321,9 @@ void free_srcline(char *srcline) if (srcline && strcmp(srcline, SRCLINE_UNKNOWN) != 0) free(srcline); } + +char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, + bool show_sym) +{ + return __get_srcline(dso, addr, sym, show_sym, false); +} diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 291be1d..09c1a8b 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -321,6 +321,8 @@ struct symbol; extern bool srcline_full_filename; char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, bool show_sym); +char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym, + bool show_sym, bool unwind_inlines); void free_srcline(char *srcline); int filename__read_str(const char *filename, char **buf, size_t *sizep); -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] perf, tools: Always use non inlined file name for srcfile
On Tue, Sep 01, 2015 at 03:36:57PM -0300, Arnaldo Carvalho de Melo wrote: > Em Tue, Sep 01, 2015 at 11:11:42AM -0700, Andi Kleen escreveu: > > From: Andi Kleen> > > > When profiling the kernel with srcfile it's common to "get > > stuck" in include. For example a lot of code uses current > > or other inlines, so they get accounted to some random > > include file. This is not very useful as a high level > > categorization. > > Cool idea :-) Yes. It would be also nice to use this information for unwinding (so to show the inline stack as part of the call graph) > Why not the so much simpler: > > while (bfd_find_inliner_info(...)); > > But other than that, wouldn't be better to put an upper limit on this? > > Say, 1024 levels of unwinding to avoid tripping in some bfd lib bug that > could make this function always return true and make addr2line get stuck > in an infinite loop? Done. I sent a v2. -Andi -- a...@linux.intel.com -- Speaking for myself only -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] perf, tools: Always use non inlined file name for srcfile
Em Tue, Sep 01, 2015 at 11:11:42AM -0700, Andi Kleen escreveu: > From: Andi Kleen> > When profiling the kernel with srcfile it's common to "get > stuck" in include. For example a lot of code uses current > or other inlines, so they get accounted to some random > include file. This is not very useful as a high level > categorization. Cool idea :-) > For example just profiling the idle loop usually shows > mostly inlines, so you never see the actual cpuidle file. > @@ -170,6 +171,15 @@ static int addr2line(const char *dso_name, u64 addr, > > bfd_map_over_sections(a2l->abfd, find_address_in_section, a2l); > > + if (a2l->found && unwind_inlines) { > + bool found; > + > + do { > + found = bfd_find_inliner_info(a2l->abfd, >filename, > + >funcname, > >line); > + } while (found); > + } Why not the so much simpler: while (bfd_find_inliner_info(...)); But other than that, wouldn't be better to put an upper limit on this? Say, 1024 levels of unwinding to avoid tripping in some bfd lib bug that could make this function always return true and make addr2line get stuck in an infinite loop? - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] perf, tools: Always use non inlined file name for srcfile
Em Tue, Sep 01, 2015 at 11:48:39AM -0700, Andi Kleen escreveu: > On Tue, Sep 01, 2015 at 03:36:57PM -0300, Arnaldo Carvalho de Melo wrote: > > Em Tue, Sep 01, 2015 at 11:11:42AM -0700, Andi Kleen escreveu: > > > From: Andi Kleen> > > > > > When profiling the kernel with srcfile it's common to "get > > > stuck" in include. For example a lot of code uses current > > > or other inlines, so they get accounted to some random > > > include file. This is not very useful as a high level > > > categorization. > > > > Cool idea :-) > > Yes. > > It would be also nice to use this information for unwinding > (so to show the inline stack as part of the call graph) Yes, agreed. > > Why not the so much simpler: > > > > while (bfd_find_inliner_info(...)); > > > > But other than that, wouldn't be better to put an upper limit on this? > > > > Say, 1024 levels of unwinding to avoid tripping in some bfd lib bug that > > could make this function always return true and make addr2line get stuck > > in an infinite loop? > > Done. I sent a v2. Thanks, I applied v2. - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] perf, tools: Always use non inlined file name for srcfile
From: Andi KleenWhen profiling the kernel with srcfile it's common to "get stuck" in include. For example a lot of code uses current or other inlines, so they get accounted to some random include file. This is not very useful as a high level categorization. For example just profiling the idle loop usually shows mostly inlines, so you never see the actual cpuidle file. This patch changes srcfile to always unwind the inline stack using BFD/dwarf. So we always account to the base function that called the inline. In a few cases include is still shown (for example for MSR accesses), but that is because they get inlining expanded as part of assigning to a global function pointer. For the majority it works fine though. v2: Use simpler while loop. Add maximum iteration count. Signed-off-by: Andi Kleen --- tools/perf/util/sort.c| 4 ++-- tools/perf/util/srcline.c | 29 - tools/perf/util/util.h| 2 ++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 7e38716..a97bcee 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -328,8 +328,8 @@ static char *get_srcfile(struct hist_entry *e) char *sf, *p; struct map *map = e->ms.map; - sf = get_srcline(map->dso, map__rip_2objdump(map, e->ip), -e->ms.sym, true); + sf = __get_srcline(map->dso, map__rip_2objdump(map, e->ip), +e->ms.sym, false, true); if (!strcmp(sf, SRCLINE_UNKNOWN)) return no_srcfile; p = strchr(sf, ':'); diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index fc08248..c36bab6 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -149,8 +149,11 @@ static void addr2line_cleanup(struct a2l_data *a2l) free(a2l); } +#define MAX_INLINE_NEST 1024 + static int addr2line(const char *dso_name, u64 addr, -char **file, unsigned int *line, struct dso *dso) +char **file, unsigned int *line, struct dso *dso, +bool unwind_inlines) { int ret = 0; struct a2l_data *a2l = dso->a2l; @@ -170,6 +173,15 @@ static int addr2line(const char *dso_name, u64 addr, bfd_map_over_sections(a2l->abfd, find_address_in_section, a2l); + if (a2l->found && unwind_inlines) { + int cnt = 0; + + while (bfd_find_inliner_info(a2l->abfd, >filename, + >funcname, >line) + && cnt++ < MAX_INLINE_NEST) + ; + } + if (a2l->found && a2l->filename) { *file = strdup(a2l->filename); *line = a2l->line; @@ -197,7 +209,8 @@ void dso__free_a2l(struct dso *dso) static int addr2line(const char *dso_name, u64 addr, char **file, unsigned int *line_nr, -struct dso *dso __maybe_unused) +struct dso *dso __maybe_unused, +bool unwind_inlines __maybe_unused) { FILE *fp; char cmd[PATH_MAX]; @@ -254,8 +267,8 @@ void dso__free_a2l(struct dso *dso __maybe_unused) */ #define A2L_FAIL_LIMIT 123 -char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, - bool show_sym) +char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym, + bool show_sym, bool unwind_inlines) { char *file = NULL; unsigned line = 0; @@ -276,7 +289,7 @@ char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, if (!strncmp(dso_name, "/tmp/perf-", 10)) goto out; - if (!addr2line(dso_name, addr, , , dso)) + if (!addr2line(dso_name, addr, , , dso, unwind_inlines)) goto out; if (asprintf(, "%s:%u", @@ -310,3 +323,9 @@ void free_srcline(char *srcline) if (srcline && strcmp(srcline, SRCLINE_UNKNOWN) != 0) free(srcline); } + +char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, + bool show_sym) +{ + return __get_srcline(dso, addr, sym, show_sym, false); +} diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 291be1d..09c1a8b 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -321,6 +321,8 @@ struct symbol; extern bool srcline_full_filename; char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, bool show_sym); +char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym, + bool show_sym, bool unwind_inlines); void free_srcline(char *srcline); int filename__read_str(const char *filename, char **buf, size_t *sizep); -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at