diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2010-01-14 00:12:12 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-17 02:15:35 -0500 |
commit | 231e36f4d2e63dd770db80b9f5113310c2bcfcfd (patch) | |
tree | 6ecff75b334f24234e0e44bed703cfaa809a7d10 /kernel | |
parent | 0eda7385db1f30271ade830a231006938a76fb53 (diff) |
tracing/kprobe: Update kprobe tracing self test for new syntax
Update kprobe tracing self test for new syntax (it supports
deleting individual probes, and drops $argN support)
and behavior change (new probes are disabled in default).
This selftest includes the following checks:
- Adding function-entry probe and return probe with arguments.
- Enabling these probes.
- Deleting it individually.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20100114051211.7814.29436.stgit@localhost6.localdomain6>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace_kprobe.c | 55 |
1 files changed, 47 insertions, 8 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 7ac728ded964..d6266cad6953 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c | |||
@@ -1507,28 +1507,67 @@ static int kprobe_trace_selftest_target(int a1, int a2, int a3, | |||
1507 | 1507 | ||
1508 | static __init int kprobe_trace_self_tests_init(void) | 1508 | static __init int kprobe_trace_self_tests_init(void) |
1509 | { | 1509 | { |
1510 | int ret; | 1510 | int ret, warn = 0; |
1511 | int (*target)(int, int, int, int, int, int); | 1511 | int (*target)(int, int, int, int, int, int); |
1512 | struct trace_probe *tp; | ||
1512 | 1513 | ||
1513 | target = kprobe_trace_selftest_target; | 1514 | target = kprobe_trace_selftest_target; |
1514 | 1515 | ||
1515 | pr_info("Testing kprobe tracing: "); | 1516 | pr_info("Testing kprobe tracing: "); |
1516 | 1517 | ||
1517 | ret = command_trace_probe("p:testprobe kprobe_trace_selftest_target " | 1518 | ret = command_trace_probe("p:testprobe kprobe_trace_selftest_target " |
1518 | "$arg1 $arg2 $arg3 $arg4 $stack $stack0"); | 1519 | "$stack $stack0 +0($stack)"); |
1519 | if (WARN_ON_ONCE(ret)) | 1520 | if (WARN_ON_ONCE(ret)) { |
1520 | pr_warning("error enabling function entry\n"); | 1521 | pr_warning("error on probing function entry.\n"); |
1522 | warn++; | ||
1523 | } else { | ||
1524 | /* Enable trace point */ | ||
1525 | tp = find_probe_event("testprobe", KPROBE_EVENT_SYSTEM); | ||
1526 | if (WARN_ON_ONCE(tp == NULL)) { | ||
1527 | pr_warning("error on getting new probe.\n"); | ||
1528 | warn++; | ||
1529 | } else | ||
1530 | probe_event_enable(&tp->call); | ||
1531 | } | ||
1521 | 1532 | ||
1522 | ret = command_trace_probe("r:testprobe2 kprobe_trace_selftest_target " | 1533 | ret = command_trace_probe("r:testprobe2 kprobe_trace_selftest_target " |
1523 | "$retval"); | 1534 | "$retval"); |
1524 | if (WARN_ON_ONCE(ret)) | 1535 | if (WARN_ON_ONCE(ret)) { |
1525 | pr_warning("error enabling function return\n"); | 1536 | pr_warning("error on probing function return.\n"); |
1537 | warn++; | ||
1538 | } else { | ||
1539 | /* Enable trace point */ | ||
1540 | tp = find_probe_event("testprobe2", KPROBE_EVENT_SYSTEM); | ||
1541 | if (WARN_ON_ONCE(tp == NULL)) { | ||
1542 | pr_warning("error on getting new probe.\n"); | ||
1543 | warn++; | ||
1544 | } else | ||
1545 | probe_event_enable(&tp->call); | ||
1546 | } | ||
1547 | |||
1548 | if (warn) | ||
1549 | goto end; | ||
1526 | 1550 | ||
1527 | ret = target(1, 2, 3, 4, 5, 6); | 1551 | ret = target(1, 2, 3, 4, 5, 6); |
1528 | 1552 | ||
1529 | cleanup_all_probes(); | 1553 | ret = command_trace_probe("-:testprobe"); |
1554 | if (WARN_ON_ONCE(ret)) { | ||
1555 | pr_warning("error on deleting a probe.\n"); | ||
1556 | warn++; | ||
1557 | } | ||
1558 | |||
1559 | ret = command_trace_probe("-:testprobe2"); | ||
1560 | if (WARN_ON_ONCE(ret)) { | ||
1561 | pr_warning("error on deleting a probe.\n"); | ||
1562 | warn++; | ||
1563 | } | ||
1530 | 1564 | ||
1531 | pr_cont("OK\n"); | 1565 | end: |
1566 | cleanup_all_probes(); | ||
1567 | if (warn) | ||
1568 | pr_cont("NG: Some tests are failed. Please check them.\n"); | ||
1569 | else | ||
1570 | pr_cont("OK\n"); | ||
1532 | return 0; | 1571 | return 0; |
1533 | } | 1572 | } |
1534 | 1573 | ||