Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf trace: Use perf_evsel__sc_tp_{uint,ptr} for "id"/"args" handling syscalls:* events

Now it looks just about the same as for the trace__sys_{enter,exit}.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-y59may7zx1eccnp4m3qm4u0b@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+3 -10
+3 -10
tools/perf/builtin-trace.c
··· 1693 1693 static int trace__fprintf_sys_enter(struct trace *trace, struct perf_evsel *evsel, 1694 1694 struct perf_sample *sample) 1695 1695 { 1696 - struct format_field *field = perf_evsel__field(evsel, "__syscall_nr"); 1697 1696 struct thread_trace *ttrace; 1698 1697 struct thread *thread; 1699 - struct syscall *sc; 1698 + int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1; 1699 + struct syscall *sc = trace__syscall_info(trace, evsel, id); 1700 1700 char msg[1024]; 1701 - int id, err = -1; 1702 1701 void *args; 1703 - 1704 - if (field == NULL) 1705 - return -1; 1706 - 1707 - id = format_field__intval(field, sample, evsel->needs_swap); 1708 - sc = trace__syscall_info(trace, evsel, id); 1709 1702 1710 1703 if (sc == NULL) 1711 1704 return -1; ··· 1712 1719 if (ttrace == NULL) 1713 1720 goto out_put; 1714 1721 1715 - args = sample->raw_data + field->offset + sizeof(u64); /* skip __syscall_nr, there is where args are */ 1722 + args = perf_evsel__sc_tp_ptr(evsel, args, sample); 1716 1723 syscall__scnprintf_args(sc, msg, sizeof(msg), args, trace, thread); 1717 1724 fprintf(trace->output, "%s", msg); 1718 1725 err = 0;