From: Arnaldo Carvalho de Melo <a...@redhat.com>

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.hun...@intel.com>
Cc: David Ahern <dsah...@gmail.com>
Cc: Frederic Weisbecker <fweis...@gmail.com>
Cc: Mike Galbraith <efa...@gmx.de>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Stephane Eranian <eran...@google.com>
Link: http://lkml.kernel.org/n/tip-lfuveegw4od1t08n7bsmo...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com>
---
 tools/perf/builtin-trace.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 9e23660..b2038fd 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -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;
 
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to