kprobe
1 2 3 4 5 6 7 8 | cd /sys/kernel/debug/tracing echo 'p:myprobe do_sys_open' > kprobe_events echo 'r:myretprobe do_sys_open $retval' > kprobe_events echo 'r:myprobe getname +0($retval):string' > kprobe_events echo 1 > tracing_on echo 1 > events/kprobes/myprobe/enable echo '-:myprobe' > kprobe_events cat trace |
uprobe
1 2 3 4 5 | cd /sys/kernel/debug/tracing echo 'p:do_sth /home/kernel_test/loop_print:0x52d %ip %ax' > uprobe_events echo 'r:do_sth_exit /home/kernel_test/loop_print:0x52d %ip %ax' >> uprobe_events echo 1 > events/uprobes/enable cat trace |
refer to:
https://blog.csdn.net/melody157398/article/details/113764679
https://blog.csdn.net/daiq531/article/details/52749673