proc: replace SavedRegisters interface with a Copy method
Fncall.go was written with the assumption that the object returned by proc.Thread.Registers does not change after we call proc.Thread.SetPC/etc. This is true for the native backend but not for gdbserial. I had anticipated this problem and introduced the Save/SavedRegisters mechanism during the first implementation of fncall.go but that's insufficient. Instead: 1. clarify that the object returned by proc.Thread.Registers could change when the CPU registers are modified. 2. add a Copy method to Registers that returns a copy of the registers that are guaranteed not to change when the CPU registers change. 3. remove the Save/SavedRegisters mechanism. This solution leaves us the option, in the future, to cache the output of proc.(Thread).Registers, avoiding a system call every time it's called.
Showing
想要评论请 注册 或 登录