From owner-freebsd-emulation Sun Sep 5 17: 5:35 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 C6DB114D6F for ; Sun, 5 Sep 1999 17:04:18 -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 BAA15093; Mon, 6 Sep 1999 01:59:07 +0200 Received: (from nox@localhost) by saturn.kn-bremen.de (8.9.3/8.8.5) id BAA17946; Mon, 6 Sep 1999 01:58:57 +0200 (MET DST) From: Juergen Lock Date: Mon, 6 Sep 1999 01:58:56 +0200 To: Marcus Meissner Cc: wine-devel@winehq.com, FreeBSD-emulation@FreeBSD.ORG Subject: Re: debugger, stepi, c(ontinue) from breakpoint... Message-ID: <19990906015856.A15839@saturn.kn-bremen.de> References: <19990904035542.A20689@saturn.kn-bremen.de> <19990904130203.A1206@jet.franken.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.7i In-Reply-To: <19990904130203.A1206@jet.franken.de> Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Sat, Sep 04, 1999 at 01:02:03PM +0200, Marcus Meissner wrote: > On Sat, Sep 04, 1999 at 03:55:43AM +0200, Juergen Lock wrote: > > ...still don't work on FreeBSD (they loop endlessly, getting signalled > > again and again). Looks like this is another result of the missing > > TRAP_sig? If yes i could try to fix it, if someone could point me > > to a description of those constants in there? FreeBSD only has > > sc_trapno which comes straight from the hardware and is defined > > completely different... (see .) > > Hmm. Not sure about differently, but Linux also uses the one directly > passed from the x86 hardware. Your right of course, FreeBSD's sc_trapno constants are the ones that differ from what the hardware uses, where was i looking... > Could you just try to define TRAP_sig() > accordingly (if the code is passed up through the signal handler)? So i made a translation function, Index: include/sig_context.h =================================================================== RCS file: /home/wine/wine/include/sig_context.h,v retrieving revision 1.15 diff -u -u -r1.15 sig_context.h --- include/sig_context.h 1999/09/05 16:26:12 1.15 +++ include/sig_context.h 1999/09/05 22:41:26 @@ -171,6 +171,8 @@ #define EFL_sig(context) ((context)->sc_efl) /* FreeBSD, see i386/i386/traps.c::trap_pfault va->err kludge */ #define CR2_sig(context) ((context)->sc_err) +int xlatebsdtrapno(int t); +#define TRAP_sig(context) ((long)xlatebsdtrapno((context)->sc_trapno)) #endif Index: dlls/ntdll/exception.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/exception.c,v retrieving revision 1.11 diff -u -u -r1.11 exception.c --- dlls/ntdll/exception.c 1999/09/03 12:46:38 1.11 +++ dlls/ntdll/exception.c 1999/09/05 22:41:22 @@ -31,6 +31,34 @@ # define GET_IP(context) ((LPVOID)0) #endif /* __i386__ */ +#ifdef __FreeBSD__ +/* translate BSD's sigcontext sc_trapno for TRAP_sig */ +int xlatebsdtrapno(int t) +{ + switch (t) + { + case T_PRIVINFLT: return 6; + case T_BPTFLT: return 3; + case T_ARITHTRAP: return 16; + case T_PROTFLT: return 13; + case T_TRCTRAP: return 1; + case T_PAGEFLT: return 14; + case T_ALIGNFLT: return 17; + case T_DIVIDE: return 0; + case T_NMI: return 2; + case T_OFLOW: return 4; + case T_BOUND: return 5; + case T_DNA: return 7; + case T_FPOPFLT: return 9; + case T_TSSFLT: return 10; + case T_SEGNPFLT: return 11; + case T_STKFLT: return 12; + case T_RESERVED: return 15; + default: return 18; + } +} +#endif + /* Default hook for built-in debugger */ static DWORD default_hook( EXCEPTION_RECORD *rec, CONTEXT *ctx, BOOL first ) { but i also had to patch this before it started working, 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/05 01:56:02 @@ -57,6 +57,9 @@ #include #include #include +#include +#include +#include #include #include #ifdef KTRACE @@ -1135,9 +1181,12 @@ break; } - 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?) now `si' works but sometimes(!) i still have to disable a breakpoint before it would step over it, shouldn't the debugger do this itself? the funny thing is it appears sometimes it does it and sometimes not! can anyone reproduce this on eg linux? (wine -debug different programs and see if `si' steps over the initial breakpoint, for me it depends on the program i chose if it does or not...) Oh and after some hacking i can now also read the taz archive CDs with wine, there's only one little problem with a scrollbar... 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