Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何在kprobe中使用寄存器?_Linux_Linux Kernel_Trace_Kprobe - Fatal编程技术网

Linux 如何在kprobe中使用寄存器?

Linux 如何在kprobe中使用寄存器?,linux,linux-kernel,trace,kprobe,Linux,Linux Kernel,Trace,Kprobe,发件人: 据我所知,在X86_64平台上,应将参数传递到寄存器(请参阅)。因此,我认为添加探测器应如下所示: echo 'p:myprobe do_sys_open dfd=%rdi filename=%rsi flags=%rdx mode=%rcx' > /sys/kernel/debug/tracing/kprobe_events 但是执行上面的语句,bash抱怨: -bash: echo: write error: Invalid argument 所以我的问题是:如何在kpr

发件人:

据我所知,在
X86_64
平台上,应将参数传递到寄存器(请参阅)。因此,我认为添加探测器应如下所示:

echo 'p:myprobe do_sys_open dfd=%rdi filename=%rsi flags=%rdx mode=%rcx' > /sys/kernel/debug/tracing/kprobe_events
但是执行上面的语句,
bash
抱怨:

-bash: echo: write error: Invalid argument

所以我的问题是:如何在
kprobe
中使用寄存器?哪些寄存器有效?

在与
kprobe
维护人员讨论后,我得到了答案:

ftrace kprobe
接口不接受像“
rax
”这样的位宽前缀,而是接受“
ax
”。位宽度由体系结构自动选择。因此,请从所有参数中删除“
r
”。如果要访问
eax
ax
,可以使用typecast,如
%ax:u32

-bash: echo: write error: Invalid argument