mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
tracing/eprobe: Show syntax error logs in error_log file
Show the syntax errors for event probes in error_log file as same as other dynamic events, so that user can understand what is the problem. Link: https://lkml.kernel.org/r/165932113556.2850673.3483079297896607612.stgit@devnote2 Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
parent
95522f0b18
commit
2f63e5d2e3
@ -839,8 +839,11 @@ static int trace_eprobe_tp_update_arg(struct trace_eprobe *ep, const char *argv[
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (ep->tp.args[i].code->op == FETCH_OP_TP_ARG)
|
||||
if (ep->tp.args[i].code->op == FETCH_OP_TP_ARG) {
|
||||
ret = trace_eprobe_tp_arg_update(ep, i);
|
||||
if (ret)
|
||||
trace_probe_log_err(0, BAD_ATTACH_ARG);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -880,8 +883,10 @@ static int __trace_eprobe_create(int argc, const char *argv[])
|
||||
trace_probe_log_set_index(1);
|
||||
sys_event = argv[1];
|
||||
ret = traceprobe_parse_event_name(&sys_event, &sys_name, buf2, 0);
|
||||
if (!sys_event || !sys_name)
|
||||
if (!sys_event || !sys_name) {
|
||||
trace_probe_log_err(0, NO_EVENT_INFO);
|
||||
goto parse_error;
|
||||
}
|
||||
|
||||
if (!event) {
|
||||
strscpy(buf1, argv[1], MAX_EVENT_NAME_LEN);
|
||||
@ -896,6 +901,8 @@ static int __trace_eprobe_create(int argc, const char *argv[])
|
||||
|
||||
if (IS_ERR(ep)) {
|
||||
ret = PTR_ERR(ep);
|
||||
if (ret == -ENODEV)
|
||||
trace_probe_log_err(0, BAD_ATTACH_EVENT);
|
||||
/* This must return -ENOMEM or missing event, else there is a bug */
|
||||
WARN_ON_ONCE(ret != -ENOMEM && ret != -ENODEV);
|
||||
ep = NULL;
|
||||
|
@ -442,7 +442,10 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,
|
||||
C(FAIL_REG_PROBE, "Failed to register probe event"),\
|
||||
C(DIFF_PROBE_TYPE, "Probe type is different from existing probe"),\
|
||||
C(DIFF_ARG_TYPE, "Argument type or name is different from existing probe"),\
|
||||
C(SAME_PROBE, "There is already the exact same probe event"),
|
||||
C(SAME_PROBE, "There is already the exact same probe event"),\
|
||||
C(NO_EVENT_INFO, "This requires both group and event name to attach"),\
|
||||
C(BAD_ATTACH_EVENT, "Attached event does not exist"),\
|
||||
C(BAD_ATTACH_ARG, "Attached event does not have this field"),
|
||||
|
||||
#undef C
|
||||
#define C(a, b) TP_ERR_##a
|
||||
|
Loading…
Reference in New Issue
Block a user