aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2014-12-16 01:19:06 -0500
committerIngo Molnar <mingo@kernel.org>2014-12-19 07:09:43 -0500
commitac931f87a647ca156f65a4c00e7297165e4fa2d8 (patch)
tree32054cdc6966779b341936e0acd04ed3a5044911 /tools
parent6aaba7c9011e0d34cf520808467bd7eb36e51b4c (diff)
perf: Fix building warning on ARM 32
Commit 85c116a6cb91 ("perf callchain: Make get_srcline fall back to sym+offset") introduces asprintf() call and matches '%ld' to a u64 argument, which is incorrect on ARM: CC /home/wn/util/srcline.o util/srcline.c: In function 'get_srcline': util/srcline.c:297:6: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'u64' [-Werror=format] cc1: all warnings being treated as errors make[1]: *** [/home/wn/util/srcline.o] Error 1 In addition, all users of get_srcline() use u64 addr, and libbfd also use 64 bit bfd_vma as address. This patch also fix prototype of get_srcline() and addr2line() to use u64 addr instead of unsigned long. Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: <lizefan@huawei.com> Cc: <a.p.zijlstra@chello.nl> Cc: <paulus@samba.org> Cc: <acme@kernel.org> Cc: <ak@linux.intel.com> Link: http://lkml.kernel.org/r/1418710746-35943-1-git-send-email-wangnan0@huawei.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/srcline.c12
-rw-r--r--tools/perf/util/util.h2
2 files changed, 7 insertions, 7 deletions
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index e73b6a5c9e0f..c93fb0c5bd0b 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -20,7 +20,7 @@
20 20
21struct a2l_data { 21struct a2l_data {
22 const char *input; 22 const char *input;
23 unsigned long addr; 23 u64 addr;
24 24
25 bool found; 25 bool found;
26 const char *filename; 26 const char *filename;
@@ -147,7 +147,7 @@ static void addr2line_cleanup(struct a2l_data *a2l)
147 free(a2l); 147 free(a2l);
148} 148}
149 149
150static int addr2line(const char *dso_name, unsigned long addr, 150static int addr2line(const char *dso_name, u64 addr,
151 char **file, unsigned int *line, struct dso *dso) 151 char **file, unsigned int *line, struct dso *dso)
152{ 152{
153 int ret = 0; 153 int ret = 0;
@@ -193,7 +193,7 @@ void dso__free_a2l(struct dso *dso)
193 193
194#else /* HAVE_LIBBFD_SUPPORT */ 194#else /* HAVE_LIBBFD_SUPPORT */
195 195
196static int addr2line(const char *dso_name, unsigned long addr, 196static int addr2line(const char *dso_name, u64 addr,
197 char **file, unsigned int *line_nr, 197 char **file, unsigned int *line_nr,
198 struct dso *dso __maybe_unused) 198 struct dso *dso __maybe_unused)
199{ 199{
@@ -252,7 +252,7 @@ void dso__free_a2l(struct dso *dso __maybe_unused)
252 */ 252 */
253#define A2L_FAIL_LIMIT 123 253#define A2L_FAIL_LIMIT 123
254 254
255char *get_srcline(struct dso *dso, unsigned long addr, struct symbol *sym, 255char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
256 bool show_sym) 256 bool show_sym)
257{ 257{
258 char *file = NULL; 258 char *file = NULL;
@@ -293,10 +293,10 @@ out:
293 dso__free_a2l(dso); 293 dso__free_a2l(dso);
294 } 294 }
295 if (sym) { 295 if (sym) {
296 if (asprintf(&srcline, "%s+%ld", show_sym ? sym->name : "", 296 if (asprintf(&srcline, "%s+%" PRIu64, show_sym ? sym->name : "",
297 addr - sym->start) < 0) 297 addr - sym->start) < 0)
298 return SRCLINE_UNKNOWN; 298 return SRCLINE_UNKNOWN;
299 } else if (asprintf(&srcline, "%s[%lx]", dso->short_name, addr) < 0) 299 } else if (asprintf(&srcline, "%s[%" PRIx64 "]", dso->short_name, addr) < 0)
300 return SRCLINE_UNKNOWN; 300 return SRCLINE_UNKNOWN;
301 return srcline; 301 return srcline;
302} 302}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index be198ac27031..027a5153495c 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -310,7 +310,7 @@ static inline int path__join3(char *bf, size_t size,
310struct dso; 310struct dso;
311struct symbol; 311struct symbol;
312 312
313char *get_srcline(struct dso *dso, unsigned long addr, struct symbol *sym, 313char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
314 bool show_sym); 314 bool show_sym);
315void free_srcline(char *srcline); 315void free_srcline(char *srcline);
316 316