This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix disp-step-syscall.exp on some i386 targets
On 02/28/2012 09:42 PM, Jan Kratochvil wrote:
> +/* Linux kernel shows PC value after the 'int $0x80' instruction even if
> + inferior is still inside the syscall. On next PTRACE_SINGLESTEP it will
> + finish the syscall but PC will not change.
> +
> + Some vDSOs contain 'int $0x80; ret' and during stepping out of the syscall
> + i386_displaced_step_fixup would keep PC at the displaced pad location.
> + As PC is pointing to the 'ret' instruction before the step
> + i386_displaced_step_fixup would expect inferior has just executed that 'ret'
> + and PC should not be adjusted. In reality it finished syscall instead and
> + PC should get relocated back to its vDSO address. Hide the 'ret'
> + instruction by 'nop' so that i386_displaced_step_fixup is not confused.
> +
> + It is not fully correct as the bytes in struct displaced_step_closure will
> + not match the inferior code. But we would need some new flag in
> + displaced_step_closure otherwise to keep the state that syscall is finishing
> + for the later i386_displaced_step_fixup execution as the syscall execution
> + is already no longer detectable there. The new flag field would mean
> + i386-linux-tdep.c needs to wrap all the displacement methods of i386-tdep.c
> + which does not seem worth it. The same effect is achieved by patching that
> + 'nop' instruction there instead. */
These comments are clear. I like them :)
--
Yao (éå)