aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/builtin-annotate.c33
-rw-r--r--tools/perf/util/include/linux/kernel.h1
-rw-r--r--tools/perf/util/symbol.c9
3 files changed, 18 insertions, 25 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 73c202ee0882..4fc3899bf83a 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -97,9 +97,7 @@ static void hist_hit(struct hist_entry *he, u64 ip)
97 sym_size = sym->end - sym->start; 97 sym_size = sym->end - sym->start;
98 offset = ip - sym->start; 98 offset = ip - sym->start;
99 99
100 if (verbose) 100 pr_debug3("%s: ip=%#Lx\n", __func__, he->map->unmap_ip(he->map, ip));
101 fprintf(stderr, "%s: ip=%Lx\n", __func__,
102 he->map->unmap_ip(he->map, ip));
103 101
104 if (offset >= sym_size) 102 if (offset >= sym_size)
105 return; 103 return;
@@ -108,12 +106,8 @@ static void hist_hit(struct hist_entry *he, u64 ip)
108 h->sum++; 106 h->sum++;
109 h->ip[offset]++; 107 h->ip[offset]++;
110 108
111 if (verbose >= 3) 109 pr_debug3("%#Lx %s: count++ [ip: %#Lx, %#Lx] => %Ld\n", he->sym->start,
112 printf("%p %s: count++ [ip: %p, %08Lx] => %Ld\n", 110 he->sym->name, ip, ip - he->sym->start, h->ip[offset]);
113 (void *)(unsigned long)he->sym->start,
114 he->sym->name,
115 (void *)(unsigned long)ip, ip - he->sym->start,
116 h->ip[offset]);
117} 111}
118 112
119static int perf_session__add_hist_entry(struct perf_session *self, 113static int perf_session__add_hist_entry(struct perf_session *self,
@@ -136,14 +130,14 @@ static int process_sample_event(event_t *event, struct perf_session *session)
136 event->ip.pid, event->ip.ip); 130 event->ip.pid, event->ip.ip);
137 131
138 if (event__preprocess_sample(event, session, &al, symbol_filter) < 0) { 132 if (event__preprocess_sample(event, session, &al, symbol_filter) < 0) {
139 fprintf(stderr, "problem processing %d event, skipping it.\n", 133 pr_warning("problem processing %d event, skipping it.\n",
140 event->header.type); 134 event->header.type);
141 return -1; 135 return -1;
142 } 136 }
143 137
144 if (!al.filtered && perf_session__add_hist_entry(session, &al, 1)) { 138 if (!al.filtered && perf_session__add_hist_entry(session, &al, 1)) {
145 fprintf(stderr, "problem incrementing symbol count, " 139 pr_warning("problem incrementing symbol count, "
146 "skipping event\n"); 140 "skipping event\n");
147 return -1; 141 return -1;
148 } 142 }
149 143
@@ -378,11 +372,9 @@ static void annotate_sym(struct hist_entry *he)
378 if (!filename) 372 if (!filename)
379 return; 373 return;
380 374
381 if (verbose) 375 pr_debug("%s: filename=%s, sym=%s, start=%#Lx, end=%#Lx\n", __func__,
382 fprintf(stderr, "%s: filename=%s, sym=%s, start=%Lx, end=%Lx\n", 376 filename, sym->name, map->unmap_ip(map, sym->start),
383 __func__, filename, sym->name, 377 map->unmap_ip(map, sym->end));
384 map->unmap_ip(map, sym->start),
385 map->unmap_ip(map, sym->end));
386 378
387 if (full_paths) 379 if (full_paths)
388 d_filename = filename; 380 d_filename = filename;
@@ -542,9 +534,8 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __used)
542 setup_pager(); 534 setup_pager();
543 535
544 if (field_sep && *field_sep == '.') { 536 if (field_sep && *field_sep == '.') {
545 fputs("'.' is the only non valid --field-separator argument\n", 537 pr_err("'.' is the only non valid --field-separator argument\n");
546 stderr); 538 return -1;
547 exit(129);
548 } 539 }
549 540
550 return __cmd_annotate(); 541 return __cmd_annotate();
diff --git a/tools/perf/util/include/linux/kernel.h b/tools/perf/util/include/linux/kernel.h
index 21c0274c02fa..f2611655ab51 100644
--- a/tools/perf/util/include/linux/kernel.h
+++ b/tools/perf/util/include/linux/kernel.h
@@ -101,5 +101,6 @@ simple_strtoul(const char *nptr, char **endptr, int base)
101 eprintf(n, pr_fmt(fmt), ##__VA_ARGS__) 101 eprintf(n, pr_fmt(fmt), ##__VA_ARGS__)
102#define pr_debug2(fmt, ...) pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__) 102#define pr_debug2(fmt, ...) pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__)
103#define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__) 103#define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)
104#define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)
104 105
105#endif 106#endif
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index bfb055459670..a60ba2ba1044 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -137,7 +137,7 @@ static struct symbol *symbol__new(u64 start, u64 len, const char *name)
137 self->start = start; 137 self->start = start;
138 self->end = len ? start + len - 1 : start; 138 self->end = len ? start + len - 1 : start;
139 139
140 pr_debug3("%s: %s %#Lx-%#Lx\n", __func__, name, start, self->end); 140 pr_debug4("%s: %s %#Lx-%#Lx\n", __func__, name, start, self->end);
141 141
142 memcpy(self->name, name, namelen); 142 memcpy(self->name, name, namelen);
143 143
@@ -1024,9 +1024,10 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
1024 } 1024 }
1025 1025
1026 if (curr_dso->adjust_symbols) { 1026 if (curr_dso->adjust_symbols) {
1027 pr_debug2("adjusting symbol: st_value: %Lx sh_addr: " 1027 pr_debug4("%s: adjusting symbol: st_value: %#Lx "
1028 "%Lx sh_offset: %Lx\n", (u64)sym.st_value, 1028 "sh_addr: %#Lx sh_offset: %#Lx\n", __func__,
1029 (u64)shdr.sh_addr, (u64)shdr.sh_offset); 1029 (u64)sym.st_value, (u64)shdr.sh_addr,
1030 (u64)shdr.sh_offset);
1030 sym.st_value -= shdr.sh_addr - shdr.sh_offset; 1031 sym.st_value -= shdr.sh_addr - shdr.sh_offset;
1031 } 1032 }
1032 /* 1033 /*