Commit 6bcf9c1ff3ec22fd81eba336737d9865476509b1

Authored by Sukadev Bhattiprolu
Committed by Arnaldo Carvalho de Melo
1 parent 813ccd1545

perf tools powerpc: Use dwfl_report_elf() instead of offline.

dwfl_report_offline() works only when libraries are prelinked.

Replace dwfl_report_offline() with dwfl_report_elf() so we correctly
extract debug info even from libraries that are not prelinked.

Reported-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Tested-by: Jiri Olsa <jolsa@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Link: http://lkml.kernel.org/r/20150114221045.GA17703@us.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Showing 1 changed file with 11 additions and 8 deletions Side-by-side Diff

tools/perf/arch/powerpc/util/skip-callchain-idx.c
... ... @@ -103,7 +103,7 @@
103 103 return NULL;
104 104 }
105 105  
106   - result = dwarf_cfi_addrframe(cfi, pc, &frame);
  106 + result = dwarf_cfi_addrframe(cfi, pc-bias, &frame);
107 107 if (result) {
108 108 pr_debug("%s(): %s\n", __func__, dwfl_errmsg(-1));
109 109 return NULL;
... ... @@ -128,7 +128,7 @@
128 128 return NULL;
129 129 }
130 130  
131   - result = dwarf_cfi_addrframe(cfi, pc, &frame);
  131 + result = dwarf_cfi_addrframe(cfi, pc-bias, &frame);
132 132 if (result) {
133 133 pr_debug("%s(): %s\n", __func__, dwfl_errmsg(-1));
134 134 return NULL;
... ... @@ -145,7 +145,7 @@
145 145 * yet used)
146 146 * -1 in case of errors
147 147 */
148   -static int check_return_addr(struct dso *dso, Dwarf_Addr pc)
  148 +static int check_return_addr(struct dso *dso, u64 map_start, Dwarf_Addr pc)
149 149 {
150 150 int rc = -1;
151 151 Dwfl *dwfl;
... ... @@ -155,6 +155,7 @@
155 155 Dwarf_Addr start = pc;
156 156 Dwarf_Addr end = pc;
157 157 bool signalp;
  158 + const char *exec_file = dso->long_name;
158 159  
159 160 dwfl = dso->dwfl;
160 161  
... ... @@ -165,8 +166,10 @@
165 166 return -1;
166 167 }
167 168  
168   - if (dwfl_report_offline(dwfl, "", dso->long_name, -1) == NULL) {
169   - pr_debug("dwfl_report_offline() failed %s\n",
  169 + mod = dwfl_report_elf(dwfl, exec_file, exec_file, -1,
  170 + map_start, false);
  171 + if (!mod) {
  172 + pr_debug("dwfl_report_elf() failed %s\n",
170 173 dwarf_errmsg(-1));
171 174 /*
172 175 * We normally cache the DWARF debug info and never
173 176  
... ... @@ -256,10 +259,10 @@
256 259 return skip_slot;
257 260 }
258 261  
259   - rc = check_return_addr(dso, ip);
  262 + rc = check_return_addr(dso, al.map->start, ip);
260 263  
261   - pr_debug("DSO %s, nr %" PRIx64 ", ip 0x%" PRIx64 "rc %d\n",
262   - dso->long_name, chain->nr, ip, rc);
  264 + pr_debug("[DSO %s, sym %s, ip 0x%" PRIx64 "] rc %d\n",
  265 + dso->long_name, al.sym->name, ip, rc);
263 266  
264 267 if (rc == 0) {
265 268 /*