From 9576ead56eb11d5bb29e4f3852516754b50b4410 Mon Sep 17 00:00:00 2001 From: compudj Date: Mon, 25 Sep 2006 14:50:40 +0000 Subject: [PATCH] test mark update git-svn-id: http://ltt.polymtl.ca/svn@2136 04897980-b3bd-0310-b5e0-8ef037075253 --- tests/kernel/Makefile | 1 - tests/kernel/probe.c | 20 ++++++++++---------- tests/kernel/test-mark.c | 13 +++++++++++++ 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/tests/kernel/Makefile b/tests/kernel/Makefile index 1b71f936..b928b684 100644 --- a/tests/kernel/Makefile +++ b/tests/kernel/Makefile @@ -20,7 +20,6 @@ endif #obj-m += test-printk.o #obj-m += test-debugfs.o obj-m += test-mark.o - obj-m += test-mark-instrumented.o obj-m += probe.o #obj-m += marker-loader.o #obj-m += test-linuxtrace.o diff --git a/tests/kernel/probe.c b/tests/kernel/probe.c index 6c6b28d4..f8916a1a 100644 --- a/tests/kernel/probe.c +++ b/tests/kernel/probe.c @@ -40,29 +40,29 @@ int init_module(void) int result; result = marker_set_probe("subsys_mark1", DO_MARK1_FORMAT, (marker_probe_func*)do_mark1); - if(result) goto end; + if(!result) goto end; result = marker_set_probe("subsys_mark2", DO_MARK2_FORMAT, (marker_probe_func*)do_mark2); - if(result) goto cleanup1; + if(!result) goto cleanup1; result = marker_set_probe("subsys_mark3", DO_MARK3_FORMAT, (marker_probe_func*)do_mark3); - if(result) goto cleanup2; + if(!result) goto cleanup2; - return -result; + return 0; cleanup2: - marker_disable_probe("subsys_mark2", (marker_probe_func*)do_mark2); + marker_remove_probe((marker_probe_func*)do_mark2); cleanup1: - marker_disable_probe("subsys_mark1", (marker_probe_func*)do_mark1); + marker_remove_probe((marker_probe_func*)do_mark1); end: - return -result; + return -EPERM; } void cleanup_module(void) { - marker_disable_probe("subsys_mark1", (marker_probe_func*)do_mark1); - marker_disable_probe("subsys_mark2", (marker_probe_func*)do_mark2); - marker_disable_probe("subsys_mark3", (marker_probe_func*)do_mark3); + marker_remove_probe((marker_probe_func*)do_mark1); + marker_remove_probe((marker_probe_func*)do_mark2); + marker_remove_probe((marker_probe_func*)do_mark3); } MODULE_LICENSE("GPL"); diff --git a/tests/kernel/test-mark.c b/tests/kernel/test-mark.c index 72874fa4..080e5a5f 100644 --- a/tests/kernel/test-mark.c +++ b/tests/kernel/test-mark.c @@ -6,11 +6,17 @@ #include #include #include +#include volatile int x=7; struct proc_dir_entry *pentry = NULL; +static inline void test(struct pt_regs * regs) +{ + MARK(kernel_debug_test, "%d %ld %p", 2, regs->eip, regs); +} + static int my_open(struct inode *inode, struct file *file) { unsigned int i; @@ -22,6 +28,8 @@ static int my_open(struct inode *inode, struct file *file) } MARK(subsys_mark2, "%d %s", 2, "blah2"); MARK(subsys_mark3, "%d %s %s", x, "blah3", "blah5"); + test(NULL); + test(NULL); return -EPERM; } @@ -33,9 +41,14 @@ static struct file_operations my_operations = { int init_module(void) { + unsigned int i; + pentry = create_proc_entry("testmark", 0444, NULL); if (pentry) pentry->proc_fops = &my_operations; + + marker_list_probe(NULL); + return 0; } -- 2.34.1