diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2009-10-16 20:07:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-17 03:53:58 -0400 |
commit | e63cc2397ecc0f2b604f22fb9cdbb05911c1e5d4 (patch) | |
tree | b6e68a1487c4ed3d285aa37457ea83e4b54d7def /kernel/trace/trace_kprobe.c | |
parent | f397af06e4c9bf5a0bc92facb8cb29905e338ab0 (diff) |
tracing/kprobes: Add failure messages for debugging
Add verbose failure messages to kprobe-tracer for debugging.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20091017000728.16556.16713.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_kprobe.c')
-rw-r--r-- | kernel/trace/trace_kprobe.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index cdacdab10020..b8ef707c84d7 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c | |||
@@ -597,15 +597,19 @@ static int create_trace_probe(int argc, char **argv) | |||
597 | void *addr = NULL; | 597 | void *addr = NULL; |
598 | char buf[MAX_EVENT_NAME_LEN]; | 598 | char buf[MAX_EVENT_NAME_LEN]; |
599 | 599 | ||
600 | if (argc < 2) | 600 | if (argc < 2) { |
601 | pr_info("Probe point is not specified.\n"); | ||
601 | return -EINVAL; | 602 | return -EINVAL; |
603 | } | ||
602 | 604 | ||
603 | if (argv[0][0] == 'p') | 605 | if (argv[0][0] == 'p') |
604 | is_return = 0; | 606 | is_return = 0; |
605 | else if (argv[0][0] == 'r') | 607 | else if (argv[0][0] == 'r') |
606 | is_return = 1; | 608 | is_return = 1; |
607 | else | 609 | else { |
610 | pr_info("Probe definition must be started with 'p' or 'r'.\n"); | ||
608 | return -EINVAL; | 611 | return -EINVAL; |
612 | } | ||
609 | 613 | ||
610 | if (argv[0][1] == ':') { | 614 | if (argv[0][1] == ':') { |
611 | event = &argv[0][2]; | 615 | event = &argv[0][2]; |
@@ -625,21 +629,29 @@ static int create_trace_probe(int argc, char **argv) | |||
625 | } | 629 | } |
626 | 630 | ||
627 | if (isdigit(argv[1][0])) { | 631 | if (isdigit(argv[1][0])) { |
628 | if (is_return) | 632 | if (is_return) { |
633 | pr_info("Return probe point must be a symbol.\n"); | ||
629 | return -EINVAL; | 634 | return -EINVAL; |
635 | } | ||
630 | /* an address specified */ | 636 | /* an address specified */ |
631 | ret = strict_strtoul(&argv[0][2], 0, (unsigned long *)&addr); | 637 | ret = strict_strtoul(&argv[0][2], 0, (unsigned long *)&addr); |
632 | if (ret) | 638 | if (ret) { |
639 | pr_info("Failed to parse address.\n"); | ||
633 | return ret; | 640 | return ret; |
641 | } | ||
634 | } else { | 642 | } else { |
635 | /* a symbol specified */ | 643 | /* a symbol specified */ |
636 | symbol = argv[1]; | 644 | symbol = argv[1]; |
637 | /* TODO: support .init module functions */ | 645 | /* TODO: support .init module functions */ |
638 | ret = split_symbol_offset(symbol, &offset); | 646 | ret = split_symbol_offset(symbol, &offset); |
639 | if (ret) | 647 | if (ret) { |
648 | pr_info("Failed to parse symbol.\n"); | ||
640 | return ret; | 649 | return ret; |
641 | if (offset && is_return) | 650 | } |
651 | if (offset && is_return) { | ||
652 | pr_info("Return probe must be used without offset.\n"); | ||
642 | return -EINVAL; | 653 | return -EINVAL; |
654 | } | ||
643 | } | 655 | } |
644 | argc -= 2; argv += 2; | 656 | argc -= 2; argv += 2; |
645 | 657 | ||
@@ -658,8 +670,11 @@ static int create_trace_probe(int argc, char **argv) | |||
658 | } | 670 | } |
659 | tp = alloc_trace_probe(group, event, addr, symbol, offset, argc, | 671 | tp = alloc_trace_probe(group, event, addr, symbol, offset, argc, |
660 | is_return); | 672 | is_return); |
661 | if (IS_ERR(tp)) | 673 | if (IS_ERR(tp)) { |
674 | pr_info("Failed to allocate trace_probe.(%d)\n", | ||
675 | (int)PTR_ERR(tp)); | ||
662 | return PTR_ERR(tp); | 676 | return PTR_ERR(tp); |
677 | } | ||
663 | 678 | ||
664 | /* parse arguments */ | 679 | /* parse arguments */ |
665 | ret = 0; | 680 | ret = 0; |
@@ -672,6 +687,8 @@ static int create_trace_probe(int argc, char **argv) | |||
672 | arg = argv[i]; | 687 | arg = argv[i]; |
673 | 688 | ||
674 | if (conflict_field_name(argv[i], tp->args, i)) { | 689 | if (conflict_field_name(argv[i], tp->args, i)) { |
690 | pr_info("Argument%d name '%s' conflicts with " | ||
691 | "another field.\n", i, argv[i]); | ||
675 | ret = -EINVAL; | 692 | ret = -EINVAL; |
676 | goto error; | 693 | goto error; |
677 | } | 694 | } |
@@ -685,8 +702,10 @@ static int create_trace_probe(int argc, char **argv) | |||
685 | goto error; | 702 | goto error; |
686 | } | 703 | } |
687 | ret = parse_probe_arg(arg, &tp->args[i].fetch, is_return); | 704 | ret = parse_probe_arg(arg, &tp->args[i].fetch, is_return); |
688 | if (ret) | 705 | if (ret) { |
706 | pr_info("Parse error at argument%d. (%d)\n", i, ret); | ||
689 | goto error; | 707 | goto error; |
708 | } | ||
690 | } | 709 | } |
691 | tp->nr_args = i; | 710 | tp->nr_args = i; |
692 | 711 | ||