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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent da3c9a44
...@@ -22,13 +22,18 @@ static struct syscall_fmt { ...@@ -22,13 +22,18 @@ static struct syscall_fmt {
const char *alias; const char *alias;
bool errmsg; bool errmsg;
bool timeout; bool timeout;
bool hexret;
} syscall_fmts[] = { } syscall_fmts[] = {
{ .name = "access", .errmsg = true, }, { .name = "access", .errmsg = true, },
{ .name = "arch_prctl", .errmsg = true, .alias = "prctl", }, { .name = "arch_prctl", .errmsg = true, .alias = "prctl", },
{ .name = "brk", .hexret = true, },
{ .name = "mmap", .hexret = true, },
{ .name = "connect", .errmsg = true, }, { .name = "connect", .errmsg = true, },
{ .name = "fstat", .errmsg = true, .alias = "newfstat", }, { .name = "fstat", .errmsg = true, .alias = "newfstat", },
{ .name = "fstatat", .errmsg = true, .alias = "newfstatat", }, { .name = "fstatat", .errmsg = true, .alias = "newfstatat", },
{ .name = "futex", .errmsg = true, }, { .name = "futex", .errmsg = true, },
{ .name = "mmap", .hexret = true, },
{ .name = "mremap", .hexret = true, },
{ .name = "open", .errmsg = true, }, { .name = "open", .errmsg = true, },
{ .name = "poll", .errmsg = true, .timeout = true, }, { .name = "poll", .errmsg = true, .timeout = true, },
{ .name = "ppoll", .errmsg = true, .timeout = true, }, { .name = "ppoll", .errmsg = true, .timeout = true, },
...@@ -475,6 +480,8 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel, ...@@ -475,6 +480,8 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
fprintf(trace->output, ") = -1 %s %s", e, emsg); fprintf(trace->output, ") = -1 %s %s", e, emsg);
} else if (ret == 0 && sc->fmt->timeout) } else if (ret == 0 && sc->fmt->timeout)
fprintf(trace->output, ") = 0 Timeout"); fprintf(trace->output, ") = 0 Timeout");
else if (sc->fmt->hexret)
fprintf(trace->output, ") = %#x", ret);
else else
goto signed_print; goto signed_print;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment