Re: Process record and replay checked in to main trunk

Eli Zaretskii
2009-05-04T11:15:05Z

> Date: Sun, 3 May 2009 21:54:19 +0800
> From: Hui Zhu <teawater@gmail.com>
> Cc: gdb-patches@sourceware.org
>
> On Fri, May 1, 2009 at 21:27, Eli Zaretskii <eliz@gnu.org> wrote:
> > It would be nice if i386-tdep.c had some comments about what it takes
> > for another x86 target to add support for process recording and
> > replay. Â Apologies if it's already described somewhere and I missed
> > it.
> >
> > It looks like all is needed is to define suitable functions for
> > tdep->i386_intx80_record and tdep->i386_sysenter_record, is that
> > right? Â (If so, why so Linux-centric names?)
>
> The intx80 and sysenter function pointers is the interface for
> i386-os-tdep code to set intx86 insn and sysenter special record
> functions.
> Because some os (linux) have special function in intx80 and sysenter
> (system call).
>
> So, in other arch, maybe there will have other interface. For
> example, arm will have a swi interface, mips will have a syscall
> interface.

Right, but I was asking about another _x86_ target, not just any
target. Is there anything an i386 target needs to do to get process
record and replay work, except define suitable i386_intx80_record and
i386_sysenter_record functions?

> > just looking at i386_linux_intx80_sysenter_record, I cannot
> > understand how it succeed to record both the arguments to the syscall
> > and the return value. Â The syscall itself does not happen inside
> > record_linux_system_call, that just records the syscall parameters and
> > data buffers, right? Â And recording happens _before_ the instruction
> > being recorded executes, right? Â So how come
> > i386_linux_intx80_sysenter_record can use EAX as the syscall number
> > and immediately after the call to record_linux_system_call treat the
> > value of EAX as the value returned by the syscall? Â What am I missing
> > here?
>
> This is because all record work will be done before insn execute.
> Before insn execute, p record parse this insn. Find out which
> register and memory will be changed in this insn. Record the old
> value of the reg and mem.

Okay, and when will they record the new values of the registers and
memory affected by the syscall?