From: pavenis AT lanet DOT lv Message-ID: To: Eli Zaretskii , djgpp-workers AT delorie DOT com Date: Mon, 14 Jun 1999 12:48:15 +0300 MIME-Version: 1.0 Content-type: Multipart/Mixed; boundary=Message-Boundary-22908 Subject: Re: save_npx and FSDB/Edebug32 References: In-reply-to: X-mailer: Pegasus Mail for Win32 (v3.11) Reply-To: djgpp-workers AT delorie DOT com --Message-Boundary-22908 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body On 14 Jun 99, at 10:36, Eli Zaretskii wrote: > > On Mon, 14 Jun 1999, Andris Pavenis wrote: > > > Most my own applications use floating point. At least my own experience > > with debuggers shows that FP supports works there. > > The problem should only show up if the debuggee changes the FPU state by > fiddling with the control word, or gets an FP exception. Otherwise, > FNINIT is a no-op. > > > However I think that > > having 2 FPU states (one for debugger, second for debugee) which are > > swapped before and after running child (as suggested in one of earlier > > posts to this mailing list) would be better. > > I agree. But this should probably wait for a later DJGPP version. > Here is my patch. I tested it yet with FSDB only. Andris --Message-Boundary-22908 Content-type: text/plain; charset=US-ASCII Content-disposition: inline Content-description: Attachment information. The following section of this message contains a file attachment prepared for transmission using the Internet MIME message format. If you are using Pegasus Mail, or any another MIME-compliant system, you should be able to save it or view it from within your mailer. If you cannot, please ask your system administrator for assistance. ---- File information ----------- File: dbgcom.c.diff-990614 Date: 14 Jun 1999, 12:42 Size: 1457 bytes. Type: Text --Message-Boundary-22908 Content-type: Application/Octet-stream; name="dbgcom.c.diff-990614"; type=Text Content-disposition: attachment; filename="dbgcom.c.diff-990614" *** src/debug/common/dbgcom.c~1 Mon Jun 7 12:43:10 1999 --- src/debug/common/dbgcom.c Mon Jun 14 12:29:18 1999 *************** *** 86,91 **** --- 86,92 ---- #endif NPX npx; + NPX debugger_npx; /* ------------------------------------------------------------------------- */ /* Store the contents of the NPX in the global variable `npx'. */ *************** *** 146,153 **** npx.mmx[i]= * (long double *) &(npx.reg[i]); } ! /* asm("frstor %0" : :"m" (npx)); */ ! /* if we do this in mmx mode the fpu will be unusable */ #endif } /* ------------------------------------------------------------------------- */ --- 147,153 ---- npx.mmx[i]= * (long double *) &(npx.reg[i]); } ! asm("frstor %0" : :"m" (debugger_npx)); #endif } /* ------------------------------------------------------------------------- */ *************** *** 158,163 **** --- 158,164 ---- int i; if ((__dpmi_get_coprocessor_status() & FPU_PRESENT) == 0) return; + asm("fnsave %0" : :"m" (debugger_npx)); if (npx.in_mmx_mode) { /* change reg to mmx */ *************** *** 1256,1261 **** --- 1257,1263 ---- app_cs = a_tss.tss_cs; edi.app_base = 0; memset(&npx,0,sizeof(npx)); + asm("fnsave %0" : :"m" (debugger_npx)); save_npx(); /* FIXME!! */ /* Save all the changed signal handlers */ oldTRAP = signal(SIGTRAP, dbgsig); --Message-Boundary-22908--