Messages in this thread | | | From | Namhyung Kim <> | Subject | Re: [PATCH 01/32] perf tools powerpc: Cache the DWARF debug info | Date | Wed, 29 Oct 2014 15:39:46 +0900 |
| |
Hi Arnaldo and Sukadev,
On Tue, 28 Oct 2014 11:31:55 -0200, Arnaldo Carvalho de Melo wrote: > From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> > @@ -156,15 +156,27 @@ static int check_return_addr(const char *exec_file, Dwarf_Addr pc) > Dwarf_Addr end = pc; > bool signalp; > > - dwfl = dwfl_begin(&offline_callbacks); > - if (!dwfl) { > - pr_debug("dwfl_begin() failed: %s\n", dwarf_errmsg(-1)); > - return -1; > - } > + dwfl = dso->dwfl; > > - if (dwfl_report_offline(dwfl, "", exec_file, -1) == NULL) { > - pr_debug("dwfl_report_offline() failed %s\n", dwarf_errmsg(-1)); > - goto out; > + if (!dwfl) { > + dwfl = dwfl_begin(&offline_callbacks); > + if (!dwfl) { > + pr_debug("dwfl_begin() failed: %s\n", dwarf_errmsg(-1)); > + return -1; > + } > + > + if (dwfl_report_offline(dwfl, "", dso->long_name, -1) == NULL) { > + pr_debug("dwfl_report_offline() failed %s\n", > + dwarf_errmsg(-1)); > + /* > + * We normally cache the DWARF debug info and never > + * call dwfl_end(). But to prevent fd leak, free in > + * case of error. > + */
Well, it can be freed when dso__delete() called at least. :)
> + dwfl_end(dwfl); > + goto out; > + } > + dso->dwfl = dwfl; > } > > mod = dwfl_addrmodule(dwfl, pc);
I don't know how dwfl_report_offline() can make it to find out a mod from pc as it's an (loaded) virtual address. Maybe I miss something or is your dso's are prelinked?
Thanks, Namhyung
> @@ -194,7 +206,6 @@ static int check_return_addr(const char *exec_file, Dwarf_Addr pc) > rc = check_return_reg(ra_regno, frame); > > out: > - dwfl_end(dwfl); > return rc; > } > > @@ -246,7 +257,7 @@ int arch_skip_callchain_idx(struct machine *machine, struct thread *thread, > return skip_slot; > } > > - rc = check_return_addr(dso->long_name, ip); > + rc = check_return_addr(dso, ip); > > pr_debug("DSO %s, nr %" PRIx64 ", ip 0x%" PRIx64 "rc %d\n", > dso->long_name, chain->nr, ip, rc); > diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h > index acb651acc7fd..3c9b391493f9 100644 > --- a/tools/perf/util/dso.h > +++ b/tools/perf/util/dso.h > @@ -127,6 +127,7 @@ struct dso { > const char *long_name; > u16 long_name_len; > u16 short_name_len; > + void *dwfl; /* DWARF debug info */ > > /* dso data file */ > struct {
| |