提交 0dd7b747 编写于 作者: F Frederic Weisbecker 提交者: Ingo Molnar

tracing: Fix double CPP substitution in TRACE_EVENT_FN

TRACE_EVENT_FN relays on TRACE_EVENT by reprocessing its parameters
into the ftrace events CPP macro. This leads to a double substitution
in some cases.

For example, a bad consequence is a format always prefixed by
"%s, %s\n" for every TRACE_EVENT_FN based events.

Eg:
	cat /debug/tracing/events/syscalls/sys_enter/format
	[...]
	print fmt: "%s, %s\n", "\"NR %ld (%lx, %lx, %lx, %lx, %lx, %lx)\"",\
	"REC->id, REC->args[0], REC->args[1], REC->args[2], REC->args[3],\
	REC->args[4], REC->args[5]"

This creates a failure in post-processing tools such as perf trace or
trace-cmd.

Then drop this double substitution and replace it by a new __cpparg()
macro that relays CPP arguments containing commas.
Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
Cc: Josh Stone <jistone@redhat.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Jason Baron <jbaron@redhat.com>
LKML-Reference: <1251413406-6704-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 66c6e29f
...@@ -45,14 +45,15 @@ ...@@ -45,14 +45,15 @@
}; \ }; \
static struct ftrace_event_call event_##name static struct ftrace_event_call event_##name
#undef __cpparg
#define __cpparg(arg...) arg
/* Callbacks are meaningless to ftrace. */ /* Callbacks are meaningless to ftrace. */
#undef TRACE_EVENT_FN #undef TRACE_EVENT_FN
#define TRACE_EVENT_FN(name, proto, args, tstruct, \ #define TRACE_EVENT_FN(name, proto, args, tstruct, \
assign, print, reg, unreg) \ assign, print, reg, unreg) \
TRACE_EVENT(name, TP_PROTO(proto), TP_ARGS(args), \ TRACE_EVENT(name, __cpparg(proto), __cpparg(args), \
TP_STRUCT__entry(tstruct), \ __cpparg(tstruct), __cpparg(assign), __cpparg(print)) \
TP_fast_assign(assign), \
TP_printk(print))
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册