Hi, On Wed, 2007-02-07 at 19:08 +0100, Mark Wielaard wrote: > The other thing that makes stepping slightly inconvenient is that on > some architectures you will get spurious trap events (for example for > system calls). So the Isa now defines a method hasExecutedSpuriousTrap() > that checks whether the last instruction was a trapping instruction that > the kernel will handle (if not, then we do need to signal a SIGTRAP to > the inferior). This only happens on x86, but not on x86_64 as far as I > can see. PowerPC is a stub for now (please check if you have access to > such a machine). > > We also need to keep track of whether a signal was just send to the > inferior. In that case we do get a SIGTRAP, but not a step (the kernel > adjusts the pc to point to the start of the signal handle). We need to > distinguish this case from a real trap signal that also doesn't generate > a step, but which indicates that we need to signal the SIGTRAP to the > inferior. And there is a third reason the pc can be "suddenly" adjusted while stepping which is when the inferior returns from a signal handler through the sigreturn system call. The following patch adds support for detecting that case, plus a new test. Again only implemented and tested on x86 and x86_64. 2007-02-12 Mark Wielaard * funit-alarm.c: New test program. 2007-02-12 Mark Wielaard * Isa.java (isAtSyscallSigReturn): New method. * IsaIA32.java (isAtSyscallSigReturn): Likewise. * IsaPowerPC.java (isAtSyscallSigReturn): Likewise. * IsaX8664.java (isAtSyscallSigReturn): Likewise. * LinuxPtraceTask.java (sendStepInstruction): Set syscall_sigret. * LinuxPtraceTaskState.java (Running.handleTrapEvent): Check syscall_sigret. (BlockedSignal.unblock): SendContinue with pending signal. * Task.java (syscall_sigret): New field. * TestTaskObserverInstructionSigReturn.java: New test. This patch also fixes a problem where a blocked Task would not get the pending signal delivered. The new test also triggers this issue. In theory we could extend this new Isa isAtSyscallSigReturn() support for more reliably reporting syscall enter and exit even during stepping. But for now I haven't done this because syscall tracing still is not really supported even in the non-stepping case. If that is fixed then this new Isa method could return the actual system call being executed during stepping and the TaskState machine could use that to supply syscall enter/exit events to the observers. Committed, Mark