Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Sep 1999 22:53:34 +0200
From:      Juergen Lock <nox@jelal.kn-bremen.de>
To:        Luoqi Chen <luoqi@watermarkgroup.com>
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>
In-Reply-To: <199909081833.OAA12069@lor.watermarkgroup.com>
References:  <199909081833.OAA12069@lor.watermarkgroup.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <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?19990908225333.C1394>