Date: Fri, 10 Sep 1999 18:02:26 +0200 From: Juergen Lock <nox@jelal.kn-bremen.de> To: Bruce Evans <bde@zeta.org.au> Cc: Juergen Lock <nox@jelal.kn-bremen.de>, Luoqi Chen <luoqi@watermarkgroup.com>, marcus@jet.franken.de, FreeBSD-emulation@FreeBSD.ORG, wine-devel@winehq.com Subject: Re: debugger, stepi, c(ontinue) from breakpoint... Message-ID: <19990910180225.A22248@saturn.kn-bremen.de> In-Reply-To: <Pine.BSF.4.10.9909091500320.14184-100000@alphplex.bde.org> References: <19990908225333.C1394@saturn.kn-bremen.de> <Pine.BSF.4.10.9909091500320.14184-100000@alphplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Sep 09, 1999 at 03:36:50PM +1000, Bruce Evans wrote: > On Wed, 8 Sep 1999, Juergen Lock wrote: > > > On Wed, Sep 08, 1999 at 02:33:57PM -0400, Luoqi Chen wrote: > > > > > > > > - if ((frame.tf_eflags & PSL_T) && !(frame.tf_eflags & PSL_VM)) { > > > > + if ((frame.tf_eflags & PSL_T) && !(frame.tf_eflags & PSL_VM) && > > > > + *callp->sy_call != sigreturn && *callp->sy_call != linux_sigreturn) { > > > > /* Traced syscall. */ > > > > frame.tf_eflags &= ~PSL_T; > > > > + /* tell the signal handler this is a trace trap */ > > > > + frame.tf_trapno = T_TRCTRAP; > > > > trapsignal(p, SIGTRAP, 0); > > This should probably be trapsignal(p, SIGTRAP, T_TRCTRAP). Signal handlers > should examine the signal code (the 3rd arg to trapsignal()) before examining > tf_trapno. It may be a bug to even look at tf_trapno. The signal code is > supposed to be a properly translated version of tf_trapno. Hmm, currently code is often 0, for example in SIGTRAP... (for both trap and breakpoint.) > > I think the purpose of (original version of the) above code is only to > make a traced syscall stop on return from the syscall and not one > instruction later. Yep. > However, this is wrong if the trace flag was set > by sigreturn(). Your changes seem to fix this case but break the case > where sigreturn() is being traced but is not responsible for setting the > trace flag. True... > This can probably be fixed by calling trapsignal() if the > trace flag was set on entry to syscall(), not if it set on exit from > syscall(). Indeed! If i do that, Index: i386/i386/trap.c =================================================================== RCS file: /home/cvs/cvs/src/sys/i386/i386/trap.c,v retrieving revision 1.133.2.1 diff -u -u -r1.133.2.1 trap.c --- trap.c 1999/08/29 16:05:56 1.133.2.1 +++ trap.c 1999/09/10 14:42:21 @@ -1041,6 +1084,7 @@ int error; int args[8]; u_int code; + int tracedsyscall = ((frame.tf_eflags & PSL_T) && !(frame.tf_eflags & PSL_VM)); #ifdef DIAGNOSTIC if (ISPL(frame.tf_cs) != SEL_UPL) @@ -1135,10 +1179,12 @@ break; } - if ((frame.tf_eflags & PSL_T) && !(frame.tf_eflags & PSL_VM)) { + if (tracedsyscall) { /* Traced syscall. */ frame.tf_eflags &= ~PSL_T; - trapsignal(p, SIGTRAP, 0); + /* tell the signal handler this is a trace trap */ + frame.tf_trapno = T_TRCTRAP; + trapsignal(p, SIGTRAP, T_TRCTRAP); } userret(p, &frame, sticks); I can single-step in wine's debugger and single-step over the sigreturn syscall from gdb like it should be. (at least in a simple test program, i first tried to test this on wine itself but there i got strange signals when i tried to set breakpoints at the end of its signal handlers. this may have to do something with the fact that wine uses sigaltstack, i don't know...) > > > > > } > > > > > > > > (so wine must be the first program that handles SIGTAP for itself and > > > > sets the trace bit from a signal handler? :) I Cc'd this to -emulation, > > Quite possibly. Heh. Regards, -- Juergen Lock <nox.foo@jelal.kn-bremen.de> (remove dot foo from address to reply) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990910180225.A22248>