From owner-freebsd-emulation Wed Sep 8 14:38:16 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from blaubaer.kn-bremen.de (blaubaer.kn-bremen.de [195.37.179.254]) by hub.freebsd.org (Postfix) with ESMTP id B477014C4C for ; Wed, 8 Sep 1999 14:37:23 -0700 (PDT) (envelope-from nox@saturn.kn-bremen.de) Received: from saturn.kn-bremen.de (uucp@localhost) by blaubaer.kn-bremen.de (8.9.1/8.9.1) with UUCP id XAA00236; Wed, 8 Sep 1999 23:32:07 +0200 Received: (from nox@localhost) by saturn.kn-bremen.de (8.9.3/8.8.5) id WAA12047; Wed, 8 Sep 1999 22:53:34 +0200 (MET DST) From: Juergen Lock Date: Wed, 8 Sep 1999 22:53:34 +0200 To: Luoqi Chen Cc: marcus@jet.franken.de, nox@jelal.kn-bremen.de, FreeBSD-emulation@FreeBSD.ORG, wine-devel@winehq.com Subject: Re: debugger, stepi, c(ontinue) from breakpoint... Message-ID: <19990908225333.C1394@saturn.kn-bremen.de> References: <199909081833.OAA12069@lor.watermarkgroup.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.7i In-Reply-To: <199909081833.OAA12069@lor.watermarkgroup.com> Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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); > > } > > > > (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, > > are any committers reading or should i also send-pr it?) > > > 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. Well tf_trapno is uninitialized in this case (syscall with trace bit set), unless i didn't look right. (Not that this is too important for wine since the instructions its debugger traces will rarely be FreeBSD syscalls, but there may be other programs that want to trace themselves in this way...) Whats important here for wine is the check for the sigreturn syscall, otherwise when the signal handler sets the trace bit it will be called again right away with the pc still pointing to the same instruction that caused the trap. which is why `si' didn't work... Btw i since noticed that the linux_sigreturn compare there probably won't work without COMPAT_LINUX in the kernel but for wine its not necessary, i just added it for completeness. (Well, unless someone tries to run a wine built for linux on FreeBSD, no idea if that would work :) Regards, -- Juergen Lock (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