From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8626 invoked by alias); 17 Aug 2009 06:36:50 -0000 Received: (qmail 8618 invoked by uid 22791); 17 Aug 2009 06:36:49 -0000 X-SWARE-Spam-Status: No, hits=-0.5 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_21,J_CHICKENPOX_41,J_CHICKENPOX_46,J_CHICKENPOX_53,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f197.google.com (HELO mail-pz0-f197.google.com) (209.85.222.197) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 17 Aug 2009 06:36:42 +0000 Received: by pzk35 with SMTP id 35so2019613pzk.24 for ; Sun, 16 Aug 2009 23:36:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.26.40 with SMTP id d40mr579325wfj.232.1250490999457; Sun, 16 Aug 2009 23:36:39 -0700 (PDT) In-Reply-To: <4A887719.2090508@vmware.com> References: <919551.75637.qm@web112511.mail.gq1.yahoo.com> <4A887719.2090508@vmware.com> From: Hui Zhu Date: Mon, 17 Aug 2009 09:17:00 -0000 Message-ID: Subject: Re: final i386.floating.record.patch To: Michael Snyder Cc: paawan oza , "gdb-patches@sourceware.org" , Mark Kettenis Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-08/txt/msg00229.txt.bz2 Get some error with this patch. cat fp.c #include #include #include /* the test intends to test following insns. flds faddp fstps fstpl fldl fxch fabs fdivrp fmulp fsubrp fucomp fnstsw fsq= rt fchs f2xm1 fyl2x fxtract fprem1 fld fdecstp fld1 fldl2t fldl2e FLDPI FLDLG2 FLDLN2 FLDZ fincstp ffree fptan fpatan fincstp fsincos frndint fscale fsin fcos fc= movb fcmovbe fcmove fcmovu fcmovnb fcmovnbe fsave frstor fstsw */ float no1,no2,no3,no4,no5,no6,no7; double x =3D 100.345, y =3D 25.7789; long double ldx =3D 88888888888888888888.88, ldy =3D 9999999999999999999.99; float result,resultd,resultld; float *float_memory; /* initialization of floats */ void init_floats() { no1 =3D 10.45; no2 =3D 20.77; no3 =3D 156.89874646; no4 =3D 14.56; no5 =3D 11.11; no6 =3D 66.77; no7 =3D 88.88; float_memory =3D malloc(sizeof(float) * 4); *float_memory =3D 256.256; *(float_memory + 1) =3D 356.356; *(float_memory + 2) =3D 456.456; *(float_memory + 3) =3D 556.556; } /* marks FPU stack as empty */ void empty_fpu_stack() { asm ("ffree %st(1) \n\t" "ffree %st(2) \n\t" "ffree %st(3) \n\t" "ffree %st(4) \n\t" "ffree %st(5) \n\t" "ffree %st(6) \n\t" "ffree %st(7)"); } /* tests floating point arithmatic */ void test_arith_floats() { result =3D no1 + no2 + no3 + no4 + no5 + no6 + no7; printf("result is %f\n",result); result =3D fmodf(no2,no1); printf("result is %f\n",result); resultd =3D fmod(x,y); printf("result is %f\n",resultd); resultld =3D fmodl(ldy,ldy); printf("result is %f\n",resultld); result =3D fabsf(no1); printf("result is %f\n",result); result =3D no3 / no4; printf("result is %f\n",result); result =3D no1 * no2 * no3 * no4; printf("result is %f\n",result); result =3D no1 - no2 - no3 - no4; printf("result is %f\n",result); asm ("fld %0" : :"m"(*float_memory)); asm ("fchs"); /* test for f2xm1 */ asm ("fld %0" : :"m"(*float_memory)); asm ("f2xm1"); asm ("fyl2x"); asm ("fld %0" : :"m"(*float_memory)); asm ("fxtract"); asm ("fld %0" : :"m"(*float_memory)); asm ("fprem1"); /* decrement fpu stack pointer only status register should get affected */ asm ("fld %0" : :"m"(*float_memory)); empty_fpu_stack(); asm ("fld1"); asm ("fldl2t"); asm ("fldl2e"); asm ("fldpi"); asm ("fldlg2"); asm ("fldln2"); asm ("fldz"); empty_fpu_stack(); /* finishing emptying the stack */ result =3D sqrt(no3); printf("result is %f\n",result); } void test_log_exp_floats() { result =3D log10(no3); printf("result is %f\n",result); result =3D log(no3); printf("result is %f\n",result); result =3D exp10(no3); printf("result is %f\n",result); result =3D exp(no3); printf("result is %f\n",result); } void test_trigo_floats() { result =3D sin(30); printf("result is %f\n",result); result =3D cos(30); printf("result is %f\n",result); result =3D tan(30); printf("result is %f\n",result); result =3D atan(30); printf("result is %f\n",result); asm ("fld %0" : :"m"(*float_memory)); asm ("fptan"); /* changes st1 and popping register stack */ asm ("fpatan"); asm("fincstp"); asm ("fld %0" : :"m"(float_memory)); asm ("fsincos"); asm ("fld %0" : :"m"(*float_memory)); asm ("frndint"); asm ("fld %0" : :"m"(*float_memory)); asm ("fld %0" : :"m"(*(float_memory+1))); asm ("fscale"); empty_fpu_stack(); asm ("fld %0" : :"m"(*float_memory)); asm ("fsin"); asm ("fcos"); /* currently we assume condition likely and always record the registers code could be optimized only if the flag is set then record */ asm ("fld %0" : :"m"(*float_memory)); asm ("fld %0" : :"m"(*(float_memory+1))); asm ("fcmovb %st(1), %st"); asm ("fcmovbe %st(1), %st"); asm ("fcmove %st(1), %st"); asm ("fcmovu %st(1), %st"); asm ("fcmovnb %st(1), %st"); asm ("fcmovnbe %st(1), %st"); empty_fpu_stack(); /* finished emtyping the stack */ } void test_compare_floats() { ldy =3D 88888888888888888888.88; if (ldx =3D=3D ldy) ldy =3D 7777777777777777777777777777.777; else ldy =3D 666666666666666666666666666.666; } /* test loading and saving of FPU environment */ void test_fpu_env() { asm ("fsave %0" : "=3Dm"(*float_memory) : ); asm ("frstor %0" : : "m"(*float_memory)); asm ("fstsw %ax"); } int main() { init_floats(); test_arith_floats(); test_log_exp_floats(); test_trigo_floats(); test_compare_floats(); test_fpu_env(); } ./gdb ./a.out GNU gdb (GDB) 6.8.50.20090817-cvs Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu". For bug reporting instructions, please see: ... Setting up the environment for debugging gdb. Function "internal_error" not defined. Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal] Function "info_command" not defined. Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal] /home/teawater/gdb/bgdbno/gdb/.gdbinit:8: Error in sourced command file: No breakpoint number 0. (gdb) start During symbol reading, DW_AT_name missing from DW_TAG_base_type. Temporary breakpoint 1 at 0x8048c74: file fp.c, line 196. Starting program: /home/teawater/gdb/bgdbno/gdb/a.out Temporary breakpoint 1, main () at fp.c:196 196 init_floats(); (gdb) record (gdb) c Continuing. ../../src/gdb/utils.c:1200: internal-error: virtual memory exhausted. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) n ../../src/gdb/utils.c:1200: internal-error: virtual memory exhausted. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) n Program received signal SIGTRAP, Trace/breakpoint trap. 0xb7eba9bc in memcpy () from /lib/tls/i686/cmov/libc.so.6 (gdb) quit A debugging session is active. Inferior 1 [process 15657] will be killed. Quit anyway? (y or n) y Thanks, Hui On Mon, Aug 17, 2009 at 05:16, Michael Snyder wrote: > paawan oza wrote: >> >> Hi Hui & Michael, >> Now we revert status registers also. >> please find the patch attached. >> I am sorry, if I am not pasting the patch in email-body due to tabs&spac= es >> problem faced by Michael last time. >> Regards, >> Oza. > > Looking good! > > There were some conflicts between your changes and a check-in that > happened after your submission =A0-- =A0I've taken the liberty of merging > your changes with the cvs head, fixing up the conflicts. =A0Hope you > don't mind =A0-- =A0merged patch attached. > > I'll review your tests next. > > Can you write up a change log entry for this patch? > > Hui, Mark, any more comments? > > Cheers, > Michael > > > > >