From owner-freebsd-emulation Wed Sep 8 22:37:34 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from gidora.zeta.org.au (gidora.zeta.org.au [203.26.10.25]) by hub.freebsd.org (Postfix) with SMTP id 10AF21580F for ; Wed, 8 Sep 1999 22:37:12 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: (qmail 15045 invoked from network); 9 Sep 1999 05:36:55 -0000 Received: from d168.syd2.zeta.org.au (203.26.9.40) by gidora.zeta.org.au with SMTP; 9 Sep 1999 05:36:55 -0000 Date: Thu, 9 Sep 1999 15:36:50 +1000 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Juergen Lock Cc: Luoqi Chen , marcus@jet.franken.de, FreeBSD-emulation@FreeBSD.ORG, wine-devel@winehq.com Subject: Re: debugger, stepi, c(ontinue) from breakpoint... In-Reply-To: <19990908225333.C1394@saturn.kn-bremen.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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. 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. 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. 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(). > > > } > > > > > > (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. > > It seems to me that SIGTRAP is signalled for either a breakpoint or the > > TF bit in eflags, > > Yup! > > > so it is probably safe to assume it's a single step > > unless the trapno is T_BPTTRAP. We haven't necessarily even seen a trace trap at this point. All we know is that the trace flag is set. This is certain to be for tracing and not for a breakpoint :-). The flag means that a trace trap is scheduled, not that it has occurred. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message