diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-08-26 10:36:30 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-08-26 16:25:52 -0400 |
commit | 04b34729e4584adfcb2e8ea908ff9478b1563001 (patch) | |
tree | 1078b2d9e7f673d1c689adf492e4a4bf94d536a8 | |
parent | da3c9a448af7ab2beab62cfff42bdea9590d9bea (diff) |
perf trace: Allow printing syscall return values in hex
event_format->flags has a FIELD_IS_POINTER, but it is not set for
the sys_exit 'ret' field in syscalls like mmap, so we need a way to
ask for hex printing for pointer returns and keep things like 'read'
returns printing in decimal.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-lfuveegw4od1t08n7bsmonrm@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-trace.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 9e23660d96eb..b2038fdefca1 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -22,13 +22,18 @@ static struct syscall_fmt { | |||
22 | const char *alias; | 22 | const char *alias; |
23 | bool errmsg; | 23 | bool errmsg; |
24 | bool timeout; | 24 | bool timeout; |
25 | bool hexret; | ||
25 | } syscall_fmts[] = { | 26 | } syscall_fmts[] = { |
26 | { .name = "access", .errmsg = true, }, | 27 | { .name = "access", .errmsg = true, }, |
27 | { .name = "arch_prctl", .errmsg = true, .alias = "prctl", }, | 28 | { .name = "arch_prctl", .errmsg = true, .alias = "prctl", }, |
29 | { .name = "brk", .hexret = true, }, | ||
30 | { .name = "mmap", .hexret = true, }, | ||
28 | { .name = "connect", .errmsg = true, }, | 31 | { .name = "connect", .errmsg = true, }, |
29 | { .name = "fstat", .errmsg = true, .alias = "newfstat", }, | 32 | { .name = "fstat", .errmsg = true, .alias = "newfstat", }, |
30 | { .name = "fstatat", .errmsg = true, .alias = "newfstatat", }, | 33 | { .name = "fstatat", .errmsg = true, .alias = "newfstatat", }, |
31 | { .name = "futex", .errmsg = true, }, | 34 | { .name = "futex", .errmsg = true, }, |
35 | { .name = "mmap", .hexret = true, }, | ||
36 | { .name = "mremap", .hexret = true, }, | ||
32 | { .name = "open", .errmsg = true, }, | 37 | { .name = "open", .errmsg = true, }, |
33 | { .name = "poll", .errmsg = true, .timeout = true, }, | 38 | { .name = "poll", .errmsg = true, .timeout = true, }, |
34 | { .name = "ppoll", .errmsg = true, .timeout = true, }, | 39 | { .name = "ppoll", .errmsg = true, .timeout = true, }, |
@@ -475,6 +480,8 @@ signed_print: | |||
475 | fprintf(trace->output, ") = -1 %s %s", e, emsg); | 480 | fprintf(trace->output, ") = -1 %s %s", e, emsg); |
476 | } else if (ret == 0 && sc->fmt->timeout) | 481 | } else if (ret == 0 && sc->fmt->timeout) |
477 | fprintf(trace->output, ") = 0 Timeout"); | 482 | fprintf(trace->output, ") = 0 Timeout"); |
483 | else if (sc->fmt->hexret) | ||
484 | fprintf(trace->output, ") = %#x", ret); | ||
478 | else | 485 | else |
479 | goto signed_print; | 486 | goto signed_print; |
480 | 487 | ||