Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab 2: Add missing dyndbg exercise. #21

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tools/labs/templates/kernel_modules/10-dyndbg/Kbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
EXTRA_CFLAGS = -Wall -g

obj-m = dyndbg.o
32 changes: 32 additions & 0 deletions tools/labs/templates/kernel_modules/10-dyndbg/dyndbg.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>

MODULE_DESCRIPTION("Dyndbg kernel module");
MODULE_AUTHOR("Dyndbg");
MODULE_LICENSE("GPL");

void my_debug_func(void)
{
pr_info("Important dyndbg debug message1\n");
pr_info("Important dyndbg debug message2\n");
pr_info("Verbose dyndbg debug message\n");
}
EXPORT_SYMBOL(my_debug_func);


static int dyndbg_init(void)
{
printk(KERN_INFO "Hi dyndbg!\n" );
my_debug_func();
return 0;
}

static void dyndbg_exit(void)
{
printk(KERN_INFO "Bye dyndbg!\n" );
my_debug_func();
}

module_init(dyndbg_init);
module_exit(dyndbg_exit);