perf trace: Allow printing syscall return values in hex
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 26 Aug 2013 14:36:30 +0000 (11:36 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 26 Aug 2013 20:25:52 +0000 (17:25 -0300)
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>
tools/perf/builtin-trace.c

index 9e23660d96eb09cf78a413816cdcafd83890a5a6..b2038fdefca15eb6060e094a94a15c25f7bfac9c 100644 (file)
@@ -22,13 +22,18 @@ static struct syscall_fmt {
        const char *alias;
        bool       errmsg;
        bool       timeout;
+       bool       hexret;
 } syscall_fmts[] = {
        { .name     = "access",     .errmsg = true, },
        { .name     = "arch_prctl", .errmsg = true, .alias = "prctl", },
+       { .name     = "brk",        .hexret = true, },
+       { .name     = "mmap",       .hexret = true, },
        { .name     = "connect",    .errmsg = true, },
        { .name     = "fstat",      .errmsg = true, .alias = "newfstat", },
        { .name     = "fstatat",    .errmsg = true, .alias = "newfstatat", },
        { .name     = "futex",      .errmsg = true, },
+       { .name     = "mmap",       .hexret = true, },
+       { .name     = "mremap",     .hexret = true, },
        { .name     = "open",       .errmsg = true, },
        { .name     = "poll",       .errmsg = true, .timeout = true, },
        { .name     = "ppoll",      .errmsg = true, .timeout = true, },
@@ -475,6 +480,8 @@ signed_print:
                fprintf(trace->output, ") = -1 %s %s", e, emsg);
        } else if (ret == 0 && sc->fmt->timeout)
                fprintf(trace->output, ") = 0 Timeout");
+       else if (sc->fmt->hexret)
+               fprintf(trace->output, ") = %#x", ret);
        else
                goto signed_print;