Skip to contentSkip to conversation

perf tool: Actually show symbol offset in stack trace when requested

PATCH New David Ahern 2 participants 2 messages Jul 28, 2013 – Aug 12, 2013 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tool: Actually show symbol offset in stack trace when requested

Symbol offset is one of the fields that can be requested in perf-script. Currently you do not get that data when requested. e.g.,

perf script -f comm,tid,pid,time,cpu,sym,symoff,ip
...
gcc 6201/6201 [006] 762250.617897:

    ffffffff81090d95 update_curr
    ffffffff810911b8 dequeue_entity
    ffffffff81091825 dequeue_task_fair
    ffffffff81087163 dequeue_task
    ffffffff81087c03 deactivate_task

...

With this patch you get the offset:
...
gcc 6201/6201 [006] 762250.617897:

    ffffffff81090d95 update_curr+0x1c5
    ffffffff810911b8 dequeue_entity+0x28
    ffffffff81091825 dequeue_task_fair+0x45
    ffffffff81087163 dequeue_task+0x93
    ffffffff81087c03 deactivate_task+0x23

...

---
 tools/perf/util/session.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/util/session.c +6 -1
index 272c9cf..38320ac 100644
@@ -1411,8 +1411,13 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, union perf_event *event,
 			printf("\t%16" PRIx64, node->ip);
 			if (print_sym) {
 				printf(" ");
-				symbol__fprintf_symname(node->sym, stdout);
+				if (print_symoffset) {
+					al.addr = node->ip;
+					symbol__fprintf_symname_offs(node->sym, &al, stdout);
+				} else
+					symbol__fprintf_symname(node->sym, stdout);
 			}
+
 			if (print_dso) {
 				printf(" (");
 				map__fprintf_dsoname(node->map, stdout);
Signature · 1 line
1.7.10.1
#1 lore raw

[tip:perf/core] perf evsel: Actually show symbol offset in stack trace when requested

perf evsel: Actually show symbol offset in stack trace when requested
Commit-ID:  251f426fddd9217ce6e4478653d3ee33df518030
Gitweb:     http://git.kernel.org/tip/251f426fddd9217ce6e4478653d3ee33df518030
Author:     David Ahern <[email protected]>
AuthorDate: Sun, 28 Jul 2013 09:14:34 -0600
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 7 Aug 2013 17:35:24 -0300

perf evsel: Actually show symbol offset in stack trace when requested

Symbol offset is one of the fields that can be requested in perf-script. Currently you do not get that data when requested. e.g.,

perf script -f comm,tid,pid,time,cpu,sym,symoff,ip
...
gcc 6201/6201 [006] 762250.617897:

    ffffffff81090d95 update_curr
    ffffffff810911b8 dequeue_entity
    ffffffff81091825 dequeue_task_fair
    ffffffff81087163 dequeue_task
    ffffffff81087c03 deactivate_task

...

With this patch you get the offset:
...
gcc 6201/6201 [006] 762250.617897:

    ffffffff81090d95 update_curr+0x1c5
    ffffffff810911b8 dequeue_entity+0x28
    ffffffff81091825 dequeue_task_fair+0x45
    ffffffff81087163 dequeue_task+0x93
    ffffffff81087c03 deactivate_task+0x23

...

---
 tools/perf/util/session.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/util/session.c +6 -1
index 9247d9c..a0ce5a4 100644
@@ -1519,8 +1519,13 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, union perf_event *event,
 			printf("\t%16" PRIx64, node->ip);
 			if (print_sym) {
 				printf(" ");
-				symbol__fprintf_symname(node->sym, stdout);
+				if (print_symoffset) {
+					al.addr = node->ip;
+					symbol__fprintf_symname_offs(node->sym, &al, stdout);
+				} else
+					symbol__fprintf_symname(node->sym, stdout);
 			}
+
 			if (print_dso) {
 				printf(" (");
 				map__fprintf_dsoname(node->map, stdout);