27 lines
1011 B
Bash
27 lines
1011 B
Bash
#!/bin/sh
|
|
|
|
echo 0 > /sys/kernel/debug/tracing/tracing_on
|
|
if [ -f /sys/kernel/debug/tracing/events/kprobes/enable ]; then
|
|
echo 0 > /sys/kernel/debug/tracing/events/kprobes/enable
|
|
fi
|
|
echo > /sys/kernel/debug/tracing/kprobe_events
|
|
|
|
# struct test_struct {
|
|
# int val;
|
|
# int arr[3];
|
|
# int *parr;
|
|
# char name[8];
|
|
# char *pname;
|
|
# };
|
|
# void test_func1(struct test_struct *p);
|
|
# void test_func2(struct test_struct p);
|
|
|
|
echo 'p:test_func1 test_func1 val=+0($arg1):s32 arr=+4($arg1):s32[3] parr=+0(+16($arg1)):s32[3] name=+24($arg1):string pname=+0(+32($arg1)):string' >> /sys/kernel/debug/tracing/kprobe_events
|
|
echo 'p:test_func2 test_func2 val=+0($arg1):s32 arr=+4($arg1):s32[3] parr=+0(+16($arg1)):s32[3] name=+24($arg1):string pname=+0(+32($arg1)):string' >> /sys/kernel/debug/tracing/kprobe_events
|
|
|
|
echo 1 > /sys/kernel/debug/tracing/options/sym-offset
|
|
echo 0 > /sys/kernel/debug/tracing/options/stacktrace
|
|
echo 1 > /sys/kernel/debug/tracing/events/kprobes/enable
|
|
echo 1 > /sys/kernel/debug/tracing/tracing_on
|
|
|