0

When you execute a single step operation using ptrace does the process do one "line" of code or does it do one line of assembly instead. If it's the former case is there a way to step a process in linux by one processor instruction only?

I mean to do this within the kernel but the GDB source is kind of large and it's hard to track exactly what it's doing to do it's ASM singlestepping. I want to single step a process it's just that I'm not sure what the exact behavior of ptrace's single step is (just 1 instruction or more?)

4

2 回答 2

2

它只做一条装配线。您可以通过打开两个会话来验证这一点,在一个会话中,您可以运行您的程序,该程序显示 IP 寄存器的内容(32 位 EIP 和 64 位 RIP),在另一个会话中使用以下命令运行 objdump - objdump -d - j.code | 少并验证

于 2011-09-28T10:52:36.287 回答
0

使用 gdb:http ://condor.depaul.edu/glancast/373class/docs/gdb.html#Running_the_Program_being_Debugged

如果您有权访问源代码或调试符号,则可以一次执行一行。如果你不这样做,你将不得不一次执行一个指令。

于 2011-09-28T04:09:36.493 回答