Re: ptrace in 2.6.5
From: Davide Libenzi
Date: Mon May 10 2004 - 18:28:32 EST
On Mon, 10 May 2004, Daniel Jacobowitz wrote:
> On Tue, May 11, 2004 at 07:47:08AM +0900, OGAWA Hirofumi wrote:
> > OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx> writes:
> >
> > > So single-step exception happen *after* executed the "mov ...".
> > > Probably you need to use the breakpoint instead of single-step.
> >
> > Ah, sorry. Just use PTRACE_SYSCALL instead of PTRACE_SINGLESTEP.
> > It's will stop before/after does syscall.
>
> Doing it this way is pretty lousy - you have to inspect the code after
> every step to see if it's an int $0x80. Is there some reason not to
> report a trap on the syscall return path if single-stepping?
Well, the "iret" restore TF, and Intel states that the TF flag must be set
at the beginning of the instruction for the trap to be fired. The next
insn has the TF set, and the tap is fired. But the EIP is the one
following the trapped insn.
- Davide
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/