* Re: Submition of i386.record.floating.point.patch
@ 2009-06-30 13:22 paawan oza
2009-06-30 18:52 ` Michael Snyder
0 siblings, 1 reply; 28+ messages in thread
From: paawan oza @ 2009-06-30 13:22 UTC (permalink / raw)
To: gdb-patches, Hui Zhu; +Cc: Mark Kettenis
Hi,
I have been waiting long for the first patch to go.
I have bee trying hard to give explanations and include review comments if any.
I request, please review the patch and provide your acceptance.
It would be nice to see myself contributing in reversible as much as possible.
the questions asked by Hui, have already been clarified.
please see the below mail.
Regards,
Oza.
> > Hi Hui,
> >
> > I have already clarified the things.
> >
> > 1 -> all floating point registers (such as FTAG,
> FCTRL,
> > FSTATUS) are required to record because of insn such
> as
> > (FFREE)
> > 2 -> gdb already has a support of all the FPU
> registers
> > including FTAG, FSTATUS, FCTRL etc...
> >
> > more importantly, patch works and properly tested with
> with
> > all possible scenerios.
> > I am eagerly waiting for the patch's acceptance by
> gdb
> > community : )
> >
> > please do the needful, If you have any specific
> sugestion
> > please elaborate and I will definately improve upon
> it.
> > please respond.
> >
> > Regards,
> > Oza.
> >
> >
> >
> > > --- On Fri, 6/12/09, Hui Zhu <teawater@gmail.com>
> > > wrote:
> > >
> > > > From: Hui Zhu <teawater@gmail.com>
> > > > Subject: Re: Submition of
> > > i386.record.floating.point.patch
> > > > To: "paawan oza" <paawan1982@yahoo.com>
> > > > Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>,
> > > gdb-patches@sourceware.org
> > > > Date: Friday, June 12, 2009, 10:49 AM
> > > > Even if you think i386 need this
> > > > register, it should not be the part
> > > > of process record patch.
> > > > You can send a patch to make i386 support
> this
> > > register
> > > > first.
> > > >
> > > > Hui
> > > >
> > > > On Thu, Jun 11, 2009 at 22:59, paawan
> oza<paawan1982@yahoo.com>
> > > > wrote:
> > > > >
> > > > > yes. I know.
> > > > > I clarified that i386 also need FTAG,
> > FSTATUS,
> > > FCTRL,
> > > > registers...
> > > > > I am also waiting for the
> clarification
> > from
> > > Mark.
> > > > > Regards,
> > > > > Oza.
> > > > >
> > > > > --- On Thu, 6/11/09, Hui Zhu <teawater@gmail.com>
> > > > wrote:
> > > > >
> > > > >> From: Hui Zhu <teawater@gmail.com>
> > > > >> Subject: Re: Submition of
> > > > i386.record.floating.point.patch
> > > > >> To: "paawan oza" <paawan1982@yahoo.com>
> > > > >> Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>,
> > > > gdb-patches@sourceware.org
> > > > >> Date: Thursday, June 11, 2009, 1:15
> PM
> > > > >> I had post my idea about your
> patch
> > > > >> in before.
> > > > >>
> > > > >> Thanks,
> > > > >> Hui
> > > > >>
> > > > >> On Thu, Jun 11, 2009 at 15:37,
> paawan
> > > oza<paawan1982@yahoo.com>
> > > > >> wrote:
> > > > >> >
> > > > >> > Hi Hui,
> > > > >> > Have you/any-body reviewed
> > floating
> > > point
> > > > patch ?
> > > > >> > I am waiting for the review
> > comments,
> > > and
> > > > also the
> > > > >> clarification from Mark.
> > > > >> > please reply.
> > > > >> > Regards,
> > > > >> > Oza.
> > > > >> >
> > > > >> > --- On Fri, 6/5/09, Hui Zhu
> <teawater@gmail.com>
> > > > >> wrote:
> > > > >> >
> > > > >> >> From: Hui Zhu <teawater@gmail.com>
> > > > >> >> Subject: Re: Submition of
> > > > >> i386.record.floating.point.patch
> > > > >> >> To: "Mark Kettenis" <mark.kettenis@xs4all.nl>
> > > > >> >> Cc: gdb-patches@sourceware.org,
> > > > >> paawan1982@yahoo.com
> > > > >> >> Date: Friday, June 5,
> 2009,
> > 8:28 AM
> > > > >> >> That is great. Thanks
> Mark.
> > > > >> >>
> > > > >> >> Hui
> > > > >> >>
> > > > >> >> On Fri, Jun 5, 2009 at
> 10:56,
> > Mark
> > > > Kettenis<mark.kettenis@xs4all.nl>
> > > > >> >> wrote:
> > > > >> >> >> Date: Fri, 5 Jun
> 2009
> > > 10:50:25
> > > > +0800
> > > > >> >> >> From: Hui Zhu
> <teawater@gmail.com>
> > > > >> >> >>
> > > > >> >> >> Could someone
> help us
> > > about
> > > > this?
> > > > >> >> >
> > > > >> >> > I should be able to,
> but
> > I'm
> > > > currently
> > > > >> travelling.
> > > > >> >> Should be back next
> week.
> > > > >> >> >
> > > > >> >>
> > > > >> >
> > > > >> >
> > > > >> >
> > > > >> >
> > > > >>
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
>
>
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
2009-06-30 13:22 Submition of i386.record.floating.point.patch paawan oza
@ 2009-06-30 18:52 ` Michael Snyder
0 siblings, 0 replies; 28+ messages in thread
From: Michael Snyder @ 2009-06-30 18:52 UTC (permalink / raw)
To: paawan oza, gdb-patches
paawan oza wrote:
> Hi,
> I have been waiting long for the first patch to go.
> I have bee trying hard to give explanations and include review comments if any.
> I request, please review the patch and provide your acceptance.
> It would be nice to see myself contributing in reversible as much as possible.
>
> the questions asked by Hui, have already been clarified.
> please see the below mail.
>
> Regards,
> Oza.
Hi Oza,
I know you have been waiting a long time, and I appologize.
It is unfortunate that some submissions take a long time to
review, but you are not being singled out. It took over a
year for Teawater's process record patches to get into gdb.
I certainly hope that it will take less than that for yours,
but please remember that the volunteer maintainers here all
have full time jobs with their own priorities and deadlines.
We're doing the best we can.
Michael
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
@ 2009-07-01 3:02 paawan oza
0 siblings, 0 replies; 28+ messages in thread
From: paawan oza @ 2009-07-01 3:02 UTC (permalink / raw)
To: gdb-patches, Michael Snyder
Hi,
I am bit relieved to see humble explanation from your side.
I was not aware of the things which you have mentioned.
As I am excited about contribution, I sounded bit hurrying : )
I am sorry for any inconvenience caused.
I will made sure that the test which testes the patch, goes into gdb testsuite.
Regards,
Oza.
--- On Wed, 7/1/09, Michael Snyder <msnyder@vmware.com> wrote:
> From: Michael Snyder <msnyder@vmware.com>
> Subject: Re: Submition of i386.record.floating.point.patch
> To: "paawan oza" <paawan1982@yahoo.com>, gdb-patches@sourceware.org
> Date: Wednesday, July 1, 2009, 12:20 AM
> paawan oza wrote:
> > Hi,
> > I have been waiting long for the first patch to go.
> > I have bee trying hard to give explanations and
> include review comments if any.
> > I request, please review the patch and provide your
> acceptance.
> > It would be nice to see myself contributing in
> reversible as much as possible.
> >
> > the questions asked by Hui, have already been
> clarified.
> > please see the below mail.
> >
> > Regards,
> > Oza.
>
> Hi Oza,
>
> I know you have been waiting a long time, and I
> appologize.
> It is unfortunate that some submissions take a long time
> to
> review, but you are not being singled out. It took
> over a
> year for Teawater's process record patches to get into
> gdb.
>
> I certainly hope that it will take less than that for
> yours,
> but please remember that the volunteer maintainers here
> all
> have full time jobs with their own priorities and
> deadlines.
>
> We're doing the best we can.
>
> Michael
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
@ 2009-06-24 16:22 paawan oza
0 siblings, 0 replies; 28+ messages in thread
From: paawan oza @ 2009-06-24 16:22 UTC (permalink / raw)
To: Hui Zhu; +Cc: Mark Kettenis, gdb-patches
Gentle reminder for the reply for following mail.
--- On Mon, 6/15/09, paawan oza <paawan1982@yahoo.com> wrote:
> From: paawan oza <paawan1982@yahoo.com>
> Subject: Re: Submition of i386.record.floating.point.patch
> To: "Hui Zhu" <teawater@gmail.com>
> Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>, gdb-patches@sourceware.org
> Date: Monday, June 15, 2009, 8:34 PM
> Hi Hui,
>
> I have already clarified the things.
>
> 1 -> all floating point registers (such as FTAG, FCTRL,
> FSTATUS) are required to record because of insn such as
> (FFREE)
> 2 -> gdb already has a support of all the FPU registers
> including FTAG, FSTATUS, FCTRL etc...
>
> more importantly, patch works and properly tested with with
> all possible scenerios.
> I am eagerly waiting for the patch's acceptance by gdb
> community : )
>
> please do the needful, If you have any specific sugestion
> please elaborate and I will definately improve upon it.
> please respond.
>
> Regards,
> Oza.
>
>
>
> > --- On Fri, 6/12/09, Hui Zhu <teawater@gmail.com>
> > wrote:
> >
> > > From: Hui Zhu <teawater@gmail.com>
> > > Subject: Re: Submition of
> > i386.record.floating.point.patch
> > > To: "paawan oza" <paawan1982@yahoo.com>
> > > Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>,
> > gdb-patches@sourceware.org
> > > Date: Friday, June 12, 2009, 10:49 AM
> > > Even if you think i386 need this
> > > register, it should not be the part
> > > of process record patch.
> > > You can send a patch to make i386 support this
> > register
> > > first.
> > >
> > > Hui
> > >
> > > On Thu, Jun 11, 2009 at 22:59, paawan oza<paawan1982@yahoo.com>
> > > wrote:
> > > >
> > > > yes. I know.
> > > > I clarified that i386 also need FTAG,
> FSTATUS,
> > FCTRL,
> > > registers...
> > > > I am also waiting for the clarification
> from
> > Mark.
> > > > Regards,
> > > > Oza.
> > > >
> > > > --- On Thu, 6/11/09, Hui Zhu <teawater@gmail.com>
> > > wrote:
> > > >
> > > >> From: Hui Zhu <teawater@gmail.com>
> > > >> Subject: Re: Submition of
> > > i386.record.floating.point.patch
> > > >> To: "paawan oza" <paawan1982@yahoo.com>
> > > >> Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>,
> > > gdb-patches@sourceware.org
> > > >> Date: Thursday, June 11, 2009, 1:15 PM
> > > >> I had post my idea about your patch
> > > >> in before.
> > > >>
> > > >> Thanks,
> > > >> Hui
> > > >>
> > > >> On Thu, Jun 11, 2009 at 15:37, paawan
> > oza<paawan1982@yahoo.com>
> > > >> wrote:
> > > >> >
> > > >> > Hi Hui,
> > > >> > Have you/any-body reviewed
> floating
> > point
> > > patch ?
> > > >> > I am waiting for the review
> comments,
> > and
> > > also the
> > > >> clarification from Mark.
> > > >> > please reply.
> > > >> > Regards,
> > > >> > Oza.
> > > >> >
> > > >> > --- On Fri, 6/5/09, Hui Zhu <teawater@gmail.com>
> > > >> wrote:
> > > >> >
> > > >> >> From: Hui Zhu <teawater@gmail.com>
> > > >> >> Subject: Re: Submition of
> > > >> i386.record.floating.point.patch
> > > >> >> To: "Mark Kettenis" <mark.kettenis@xs4all.nl>
> > > >> >> Cc: gdb-patches@sourceware.org,
> > > >> paawan1982@yahoo.com
> > > >> >> Date: Friday, June 5, 2009,
> 8:28 AM
> > > >> >> That is great. Thanks Mark.
> > > >> >>
> > > >> >> Hui
> > > >> >>
> > > >> >> On Fri, Jun 5, 2009 at 10:56,
> Mark
> > > Kettenis<mark.kettenis@xs4all.nl>
> > > >> >> wrote:
> > > >> >> >> Date: Fri, 5 Jun 2009
> > 10:50:25
> > > +0800
> > > >> >> >> From: Hui Zhu <teawater@gmail.com>
> > > >> >> >>
> > > >> >> >> Could someone help us
> > about
> > > this?
> > > >> >> >
> > > >> >> > I should be able to, but
> I'm
> > > currently
> > > >> travelling.
> > > >> >> Should be back next week.
> > > >> >> >
> > > >> >>
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >>
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >
> >
> >
>
>
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
@ 2009-06-15 15:04 paawan oza
0 siblings, 0 replies; 28+ messages in thread
From: paawan oza @ 2009-06-15 15:04 UTC (permalink / raw)
To: Hui Zhu; +Cc: Mark Kettenis, gdb-patches
Hi Hui,
I have already clarified the things.
1 -> all floating point registers (such as FTAG, FCTRL, FSTATUS) are required to record because of insn such as (FFREE)
2 -> gdb already has a support of all the FPU registers including FTAG, FSTATUS, FCTRL etc...
more importantly, patch works and properly tested with with all possible scenerios.
I am eagerly waiting for the patch's acceptance by gdb community : )
please do the needful, If you have any specific sugestion ple4ase elaborate and I will definately improve upon it.
please respond.
Regards,
Oza.
> --- On Fri, 6/12/09, Hui Zhu <teawater@gmail.com>
> wrote:
>
> > From: Hui Zhu <teawater@gmail.com>
> > Subject: Re: Submition of
> i386.record.floating.point.patch
> > To: "paawan oza" <paawan1982@yahoo.com>
> > Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>,
> gdb-patches@sourceware.org
> > Date: Friday, June 12, 2009, 10:49 AM
> > Even if you think i386 need this
> > register, it should not be the part
> > of process record patch.
> > You can send a patch to make i386 support this
> register
> > first.
> >
> > Hui
> >
> > On Thu, Jun 11, 2009 at 22:59, paawan oza<paawan1982@yahoo.com>
> > wrote:
> > >
> > > yes. I know.
> > > I clarified that i386 also need FTAG, FSTATUS,
> FCTRL,
> > registers...
> > > I am also waiting for the clarification from
> Mark.
> > > Regards,
> > > Oza.
> > >
> > > --- On Thu, 6/11/09, Hui Zhu <teawater@gmail.com>
> > wrote:
> > >
> > >> From: Hui Zhu <teawater@gmail.com>
> > >> Subject: Re: Submition of
> > i386.record.floating.point.patch
> > >> To: "paawan oza" <paawan1982@yahoo.com>
> > >> Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>,
> > gdb-patches@sourceware.org
> > >> Date: Thursday, June 11, 2009, 1:15 PM
> > >> I had post my idea about your patch
> > >> in before.
> > >>
> > >> Thanks,
> > >> Hui
> > >>
> > >> On Thu, Jun 11, 2009 at 15:37, paawan
> oza<paawan1982@yahoo.com>
> > >> wrote:
> > >> >
> > >> > Hi Hui,
> > >> > Have you/any-body reviewed floating
> point
> > patch ?
> > >> > I am waiting for the review comments,
> and
> > also the
> > >> clarification from Mark.
> > >> > please reply.
> > >> > Regards,
> > >> > Oza.
> > >> >
> > >> > --- On Fri, 6/5/09, Hui Zhu <teawater@gmail.com>
> > >> wrote:
> > >> >
> > >> >> From: Hui Zhu <teawater@gmail.com>
> > >> >> Subject: Re: Submition of
> > >> i386.record.floating.point.patch
> > >> >> To: "Mark Kettenis" <mark.kettenis@xs4all.nl>
> > >> >> Cc: gdb-patches@sourceware.org,
> > >> paawan1982@yahoo.com
> > >> >> Date: Friday, June 5, 2009, 8:28 AM
> > >> >> That is great. Thanks Mark.
> > >> >>
> > >> >> Hui
> > >> >>
> > >> >> On Fri, Jun 5, 2009 at 10:56, Mark
> > Kettenis<mark.kettenis@xs4all.nl>
> > >> >> wrote:
> > >> >> >> Date: Fri, 5 Jun 2009
> 10:50:25
> > +0800
> > >> >> >> From: Hui Zhu <teawater@gmail.com>
> > >> >> >>
> > >> >> >> Could someone help us
> about
> > this?
> > >> >> >
> > >> >> > I should be able to, but I'm
> > currently
> > >> travelling.
> > >> >> Should be back next week.
> > >> >> >
> > >> >>
> > >> >
> > >> >
> > >> >
> > >> >
> > >>
> > >
> > >
> > >
> > >
> >
>
>
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
@ 2009-06-12 16:47 paawan oza
0 siblings, 0 replies; 28+ messages in thread
From: paawan oza @ 2009-06-12 16:47 UTC (permalink / raw)
To: Hui Zhu; +Cc: Mark Kettenis, gdb-patches
Hi Hui,
please find my comments below.
>Even if you think i386 need this register, it should not be the part
>of process record patch.
Oza : insns like FFREE changes register like FTAG.
so we need to record it.
The patch concentrates on any insn which has potential to change any of the FPU environment registers and stack.
> You can send a patch to make i386 support this register
> first.
Oza: gdb already has support for i386 for those(fpu) registers.
command -> [info float/info all-registers]
give all floating point registers including whole x87 FPU environment.
regards,
Oza.
--- On Fri, 6/12/09, Hui Zhu <teawater@gmail.com> wrote:
> From: Hui Zhu <teawater@gmail.com>
> Subject: Re: Submition of i386.record.floating.point.patch
> To: "paawan oza" <paawan1982@yahoo.com>
> Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>, gdb-patches@sourceware.org
> Date: Friday, June 12, 2009, 10:49 AM
> Even if you think i386 need this
> register, it should not be the part
> of process record patch.
> You can send a patch to make i386 support this register
> first.
>
> Hui
>
> On Thu, Jun 11, 2009 at 22:59, paawan oza<paawan1982@yahoo.com>
> wrote:
> >
> > yes. I know.
> > I clarified that i386 also need FTAG, FSTATUS, FCTRL,
> registers...
> > I am also waiting for the clarification from Mark.
> > Regards,
> > Oza.
> >
> > --- On Thu, 6/11/09, Hui Zhu <teawater@gmail.com>
> wrote:
> >
> >> From: Hui Zhu <teawater@gmail.com>
> >> Subject: Re: Submition of
> i386.record.floating.point.patch
> >> To: "paawan oza" <paawan1982@yahoo.com>
> >> Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>,
> gdb-patches@sourceware.org
> >> Date: Thursday, June 11, 2009, 1:15 PM
> >> I had post my idea about your patch
> >> in before.
> >>
> >> Thanks,
> >> Hui
> >>
> >> On Thu, Jun 11, 2009 at 15:37, paawan oza<paawan1982@yahoo.com>
> >> wrote:
> >> >
> >> > Hi Hui,
> >> > Have you/any-body reviewed floating point
> patch ?
> >> > I am waiting for the review comments, and
> also the
> >> clarification from Mark.
> >> > please reply.
> >> > Regards,
> >> > Oza.
> >> >
> >> > --- On Fri, 6/5/09, Hui Zhu <teawater@gmail.com>
> >> wrote:
> >> >
> >> >> From: Hui Zhu <teawater@gmail.com>
> >> >> Subject: Re: Submition of
> >> i386.record.floating.point.patch
> >> >> To: "Mark Kettenis" <mark.kettenis@xs4all.nl>
> >> >> Cc: gdb-patches@sourceware.org,
> >> paawan1982@yahoo.com
> >> >> Date: Friday, June 5, 2009, 8:28 AM
> >> >> That is great. Thanks Mark.
> >> >>
> >> >> Hui
> >> >>
> >> >> On Fri, Jun 5, 2009 at 10:56, Mark
> Kettenis<mark.kettenis@xs4all.nl>
> >> >> wrote:
> >> >> >> Date: Fri, 5 Jun 2009 10:50:25
> +0800
> >> >> >> From: Hui Zhu <teawater@gmail.com>
> >> >> >>
> >> >> >> Could someone help us about
> this?
> >> >> >
> >> >> > I should be able to, but I'm
> currently
> >> travelling.
> >> >> Should be back next week.
> >> >> >
> >> >>
> >> >
> >> >
> >> >
> >> >
> >>
> >
> >
> >
> >
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
@ 2009-06-11 15:18 paawan oza
0 siblings, 0 replies; 28+ messages in thread
From: paawan oza @ 2009-06-11 15:18 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches
Hi Hui,
please see the gdb output below, which gives us hint that we require all the floating point registers for i386, which you had suggested to separate and move it to amd64.
please see the last command "info float" which gives status, tag, control registers
(gdb) n
92 printf("result is %f\n",result);
(gdb)
result is 495830.968750
94 result = no1 - no2 - no3 - no4;
(gdb)
95 printf("result is %f\n",result);
(gdb)
result is -181.778748
98 asm ("fld %0" : :"m"(*float_memory));
(gdb)
99 asm ("fchs");
(gdb)
102 asm ("fld %0" : :"m"(*float_memory));
(gdb)
103 asm ("f2xm1");
(gdb)
105 asm ("fyl2x");
(gdb)
107 asm ("fld %0" : :"m"(*float_memory));
(gdb)
108 asm ("fxtract");
(gdb)
110 asm ("fld %0" : :"m"(*float_memory));
(gdb)
111 asm ("fprem1");
(gdb) info float
R7: Valid 0xc00a8026ae9a2fe9e7c1 -2050.417627513087141
R6: Valid 0x40028000000000000000 +8
R5: Valid 0x3fff8020c50000000000 +1.001000046730041504
=>R4: Valid 0x40078020c50000000000 +256.256011962890625
R3: Empty 0x00000000000000000000
R2: Empty 0x00000000000000000000
R1: Empty 0x00000000000000000000
R0: Empty 0x00000000000000000000
Status Word: 0x2020 PE
TOP: 4
Control Word: 0x037f IM DM ZM OM UM PM
PC: Extended Precision (64-bits)
RC: Round to nearest
Tag Word: 0x00ff
Instruction Pointer: 0x73:0x0804897e
Operand Pointer: 0x7b:0x0804a008
Opcode:
Regards,
Oza.
--- On Fri, 6/5/09, Hui Zhu <teawater@gmail.com> wrote:
> From: Hui Zhu <teawater@gmail.com>
> Subject: Re: Submition of i386.record.floating.point.patch
> To: "paawan oza" <paawan1982@yahoo.com>
> Cc: gdb-patches@sourceware.org
> Date: Friday, June 5, 2009, 3:48 AM
> >> diff -urN
> gdb.orig/i386-tdep.h gdb.new/i386-tdep.h
> >> --- gdb.orig/i386-tdep.h 2009-05-17
> 17:56:44.000000000 -0400
> >> +++ gdb.new/i386-tdep.h 2009-05-31
> 16:33:14.000000000 -0400
> >> @@ -145,7 +145,22 @@
> >> I386_ES_REGNUM, /* %es */
> >> I386_FS_REGNUM, /* %fs */
> >> I386_GS_REGNUM, /* %gs */
> >> - I386_ST0_REGNUM /* %st(0)
> */
> >> + I386_ST0_REGNUM, /* %st(0)
> */
> >> + I386_ST1_REGNUM, /* %st(1)
> */
> >> + I386_ST2_REGNUM, /* %st(2)
> */
> >> + I386_ST3_REGNUM, /* %st(3)
> */
> >> + I386_ST4_REGNUM, /* %st(4)
> */
> >> + I386_ST5_REGNUM, /* %st(5)
> */
> >> + I386_ST6_REGNUM, /* %st(6)
> */
> >> + I386_ST7_REGNUM, /* %st(7)
> */
> >> + I386_FCTRL, /*
> floating point env regs : FCTRL-FOP */
> >> + I386_FSTAT,
> >> + I386_FTAG,
> >> + I386_FISEG,
> >> + I386_FIOFF,
> >> + I386_FOSEG,
> >> + I386_FOOFF,
> >> + I386_FOP
> >> };
> >>
> >
> > About this part, I think this is my mistake. I
> didn't take fp work
> > for now very clear (Or I am still not clear with x86
> fp).
> > FCTRL, FOP and so on are the fp reg of amd64. For
> now, prec is still
> > not support amd64 (I am working on it).
> > And amd64's support are in amd64-tedp.... files.
> Change i386_regnum
> > is not a good idea.
> >
> > I suggest you divide fp patch to 2 parts. One is for
> i386, the other for amd64.
> > For now, just send i386 patch for review. And send
> amd64 patch when
> > prec support amd64.
> >
> >
> >
>
> What do you think about my idea?
>
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: Submition of i386.record.floating.point.patch
@ 2009-06-11 15:00 paawan oza
2009-06-12 5:19 ` Hui Zhu
0 siblings, 1 reply; 28+ messages in thread
From: paawan oza @ 2009-06-11 15:00 UTC (permalink / raw)
To: Hui Zhu; +Cc: Mark Kettenis, gdb-patches
yes. I know.
I clarified that i386 also need FTAG, FSTATUS, FCTRL, registers...
I am also waiting for the clarification from Mark.
Regards,
Oza.
--- On Thu, 6/11/09, Hui Zhu <teawater@gmail.com> wrote:
> From: Hui Zhu <teawater@gmail.com>
> Subject: Re: Submition of i386.record.floating.point.patch
> To: "paawan oza" <paawan1982@yahoo.com>
> Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>, gdb-patches@sourceware.org
> Date: Thursday, June 11, 2009, 1:15 PM
> I had post my idea about your patch
> in before.
>
> Thanks,
> Hui
>
> On Thu, Jun 11, 2009 at 15:37, paawan oza<paawan1982@yahoo.com>
> wrote:
> >
> > Hi Hui,
> > Have you/any-body reviewed floating point patch ?
> > I am waiting for the review comments, and also the
> clarification from Mark.
> > please reply.
> > Regards,
> > Oza.
> >
> > --- On Fri, 6/5/09, Hui Zhu <teawater@gmail.com>
> wrote:
> >
> >> From: Hui Zhu <teawater@gmail.com>
> >> Subject: Re: Submition of
> i386.record.floating.point.patch
> >> To: "Mark Kettenis" <mark.kettenis@xs4all.nl>
> >> Cc: gdb-patches@sourceware.org,
> paawan1982@yahoo.com
> >> Date: Friday, June 5, 2009, 8:28 AM
> >> That is great. Thanks Mark.
> >>
> >> Hui
> >>
> >> On Fri, Jun 5, 2009 at 10:56, Mark Kettenis<mark.kettenis@xs4all.nl>
> >> wrote:
> >> >> Date: Fri, 5 Jun 2009 10:50:25 +0800
> >> >> From: Hui Zhu <teawater@gmail.com>
> >> >>
> >> >> Could someone help us about this?
> >> >
> >> > I should be able to, but I'm currently
> travelling.
> >> Should be back next week.
> >> >
> >>
> >
> >
> >
> >
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
2009-06-11 15:00 paawan oza
@ 2009-06-12 5:19 ` Hui Zhu
0 siblings, 0 replies; 28+ messages in thread
From: Hui Zhu @ 2009-06-12 5:19 UTC (permalink / raw)
To: paawan oza; +Cc: Mark Kettenis, gdb-patches
Even if you think i386 need this register, it should not be the part
of process record patch.
You can send a patch to make i386 support this register first.
Hui
On Thu, Jun 11, 2009 at 22:59, paawan oza<paawan1982@yahoo.com> wrote:
>
> yes. I know.
> I clarified that i386 also need FTAG, FSTATUS, FCTRL, registers...
> I am also waiting for the clarification from Mark.
> Regards,
> Oza.
>
> --- On Thu, 6/11/09, Hui Zhu <teawater@gmail.com> wrote:
>
>> From: Hui Zhu <teawater@gmail.com>
>> Subject: Re: Submition of i386.record.floating.point.patch
>> To: "paawan oza" <paawan1982@yahoo.com>
>> Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>, gdb-patches@sourceware.org
>> Date: Thursday, June 11, 2009, 1:15 PM
>> I had post my idea about your patch
>> in before.
>>
>> Thanks,
>> Hui
>>
>> On Thu, Jun 11, 2009 at 15:37, paawan oza<paawan1982@yahoo.com>
>> wrote:
>> >
>> > Hi Hui,
>> > Have you/any-body reviewed floating point patch ?
>> > I am waiting for the review comments, and also the
>> clarification from Mark.
>> > please reply.
>> > Regards,
>> > Oza.
>> >
>> > --- On Fri, 6/5/09, Hui Zhu <teawater@gmail.com>
>> wrote:
>> >
>> >> From: Hui Zhu <teawater@gmail.com>
>> >> Subject: Re: Submition of
>> i386.record.floating.point.patch
>> >> To: "Mark Kettenis" <mark.kettenis@xs4all.nl>
>> >> Cc: gdb-patches@sourceware.org,
>> paawan1982@yahoo.com
>> >> Date: Friday, June 5, 2009, 8:28 AM
>> >> That is great. Thanks Mark.
>> >>
>> >> Hui
>> >>
>> >> On Fri, Jun 5, 2009 at 10:56, Mark Kettenis<mark.kettenis@xs4all.nl>
>> >> wrote:
>> >> >> Date: Fri, 5 Jun 2009 10:50:25 +0800
>> >> >> From: Hui Zhu <teawater@gmail.com>
>> >> >>
>> >> >> Could someone help us about this?
>> >> >
>> >> > I should be able to, but I'm currently
>> travelling.
>> >> Should be back next week.
>> >> >
>> >>
>> >
>> >
>> >
>> >
>>
>
>
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
@ 2009-06-11 7:37 paawan oza
2009-06-11 7:45 ` Hui Zhu
0 siblings, 1 reply; 28+ messages in thread
From: paawan oza @ 2009-06-11 7:37 UTC (permalink / raw)
To: Mark Kettenis, Hui Zhu; +Cc: gdb-patches
Hi Hui,
Have you/any-body reviewed floating point patch ?
I am waiting for the review comments, and also the clarification from Mark.
please reply.
Regards,
Oza.
--- On Fri, 6/5/09, Hui Zhu <teawater@gmail.com> wrote:
> From: Hui Zhu <teawater@gmail.com>
> Subject: Re: Submition of i386.record.floating.point.patch
> To: "Mark Kettenis" <mark.kettenis@xs4all.nl>
> Cc: gdb-patches@sourceware.org, paawan1982@yahoo.com
> Date: Friday, June 5, 2009, 8:28 AM
> That is great. Thanks Mark.
>
> Hui
>
> On Fri, Jun 5, 2009 at 10:56, Mark Kettenis<mark.kettenis@xs4all.nl>
> wrote:
> >> Date: Fri, 5 Jun 2009 10:50:25 +0800
> >> From: Hui Zhu <teawater@gmail.com>
> >>
> >> Could someone help us about this?
> >
> > I should be able to, but I'm currently travelling.
> Should be back next week.
> >
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
2009-06-11 7:37 paawan oza
@ 2009-06-11 7:45 ` Hui Zhu
0 siblings, 0 replies; 28+ messages in thread
From: Hui Zhu @ 2009-06-11 7:45 UTC (permalink / raw)
To: paawan oza; +Cc: Mark Kettenis, gdb-patches
I had post my idea about your patch in before.
Thanks,
Hui
On Thu, Jun 11, 2009 at 15:37, paawan oza<paawan1982@yahoo.com> wrote:
>
> Hi Hui,
> Have you/any-body reviewed floating point patch ?
> I am waiting for the review comments, and also the clarification from Mark.
> please reply.
> Regards,
> Oza.
>
> --- On Fri, 6/5/09, Hui Zhu <teawater@gmail.com> wrote:
>
>> From: Hui Zhu <teawater@gmail.com>
>> Subject: Re: Submition of i386.record.floating.point.patch
>> To: "Mark Kettenis" <mark.kettenis@xs4all.nl>
>> Cc: gdb-patches@sourceware.org, paawan1982@yahoo.com
>> Date: Friday, June 5, 2009, 8:28 AM
>> That is great. Thanks Mark.
>>
>> Hui
>>
>> On Fri, Jun 5, 2009 at 10:56, Mark Kettenis<mark.kettenis@xs4all.nl>
>> wrote:
>> >> Date: Fri, 5 Jun 2009 10:50:25 +0800
>> >> From: Hui Zhu <teawater@gmail.com>
>> >>
>> >> Could someone help us about this?
>> >
>> > I should be able to, but I'm currently travelling.
>> Should be back next week.
>> >
>>
>
>
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
@ 2009-06-08 16:21 paawan oza
0 siblings, 0 replies; 28+ messages in thread
From: paawan oza @ 2009-06-08 16:21 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches, Hui Zhu
Hi Mark,
Gentle reminder for clarifying floating point mentioned in below mail.
Regards,
Oza.
--- On Fri, 6/5/09, Hui Zhu <teawater@gmail.com> wrote:
> From: Hui Zhu <teawater@gmail.com>
> Subject: Re: Submition of i386.record.floating.point.patch
> To: "Mark Kettenis" <mark.kettenis@xs4all.nl>
> Cc: gdb-patches@sourceware.org, paawan1982@yahoo.com
> Date: Friday, June 5, 2009, 8:28 AM
> That is great. Thanks Mark.
>
> Hui
>
> On Fri, Jun 5, 2009 at 10:56, Mark Kettenis<mark.kettenis@xs4all.nl>
> wrote:
> >> Date: Fri, 5 Jun 2009 10:50:25 +0800
> >> From: Hui Zhu <teawater@gmail.com>
> >>
> >> Could someone help us about this?
> >
> > I should be able to, but I'm currently travelling.
> Should be back next week.
> >
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
@ 2009-06-05 12:05 paawan oza
0 siblings, 0 replies; 28+ messages in thread
From: paawan oza @ 2009-06-05 12:05 UTC (permalink / raw)
To: Mark Kettenis, Hui Zhu; +Cc: gdb-patches
Hi Hui and Mark,
I am referring to : Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 2A, which talks about floating point insns, changing FPU stack and other registers such as tag, status etc.
@Hui :
as you suggested I have re-written the test_floats to test the patch throughly. (which I have already sent)
I will be waiting for your review comments, and clarification from Mark.
I am going start working on MMX insn support for i386.
Regards,
Oza.
--- On Fri, 6/5/09, Hui Zhu <teawater@gmail.com> wrote:
> From: Hui Zhu <teawater@gmail.com>
> Subject: Re: Submition of i386.record.floating.point.patch
> To: "Mark Kettenis" <mark.kettenis@xs4all.nl>
> Cc: gdb-patches@sourceware.org, paawan1982@yahoo.com
> Date: Friday, June 5, 2009, 8:28 AM
> That is great. Thanks Mark.
>
> Hui
>
> On Fri, Jun 5, 2009 at 10:56, Mark Kettenis<mark.kettenis@xs4all.nl>
> wrote:
> >> Date: Fri, 5 Jun 2009 10:50:25 +0800
> >> From: Hui Zhu <teawater@gmail.com>
> >>
> >> Could someone help us about this?
> >
> > I should be able to, but I'm currently travelling.
> Should be back next week.
> >
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
@ 2009-06-05 2:41 paawan oza
2009-06-05 2:50 ` Hui Zhu
0 siblings, 1 reply; 28+ messages in thread
From: paawan oza @ 2009-06-05 2:41 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches
Hi Hui,
I think, FCTRL, FTAG, FOP are part of i386 also.
for e.g.
FFREE insn, changes only tag register.
frstor affetcs whole FPU environment.
The FPU operating environment consists of the FPU control word, status word, tag
word, instruction pointer, data pointer, and last opcode.
we need them for i386 too.
I have sent the test_float.c in my previous mail, where you will find all these registers getting changed and tested.
Regards,
Oza.
--- On Fri, 6/5/09, Hui Zhu <teawater@gmail.com> wrote:
> From: Hui Zhu <teawater@gmail.com>
> Subject: Re: Submition of i386.record.floating.point.patch
> To: "paawan oza" <paawan1982@yahoo.com>
> Cc: gdb-patches@sourceware.org
> Date: Friday, June 5, 2009, 3:48 AM
> >> diff -urN
> gdb.orig/i386-tdep.h gdb.new/i386-tdep.h
> >> --- gdb.orig/i386-tdep.h 2009-05-17
> 17:56:44.000000000 -0400
> >> +++ gdb.new/i386-tdep.h 2009-05-31
> 16:33:14.000000000 -0400
> >> @@ -145,7 +145,22 @@
> >> I386_ES_REGNUM, /* %es */
> >> I386_FS_REGNUM, /* %fs */
> >> I386_GS_REGNUM, /* %gs */
> >> - I386_ST0_REGNUM /* %st(0)
> */
> >> + I386_ST0_REGNUM, /* %st(0)
> */
> >> + I386_ST1_REGNUM, /* %st(1)
> */
> >> + I386_ST2_REGNUM, /* %st(2)
> */
> >> + I386_ST3_REGNUM, /* %st(3)
> */
> >> + I386_ST4_REGNUM, /* %st(4)
> */
> >> + I386_ST5_REGNUM, /* %st(5)
> */
> >> + I386_ST6_REGNUM, /* %st(6)
> */
> >> + I386_ST7_REGNUM, /* %st(7)
> */
> >> + I386_FCTRL, /*
> floating point env regs : FCTRL-FOP */
> >> + I386_FSTAT,
> >> + I386_FTAG,
> >> + I386_FISEG,
> >> + I386_FIOFF,
> >> + I386_FOSEG,
> >> + I386_FOOFF,
> >> + I386_FOP
> >> };
> >>
> >
> > About this part, I think this is my mistake. I
> didn't take fp work
> > for now very clear (Or I am still not clear with x86
> fp).
> > FCTRL, FOP and so on are the fp reg of amd64. For
> now, prec is still
> > not support amd64 (I am working on it).
> > And amd64's support are in amd64-tedp.... files.
> Change i386_regnum
> > is not a good idea.
> >
> > I suggest you divide fp patch to 2 parts. One is for
> i386, the other for amd64.
> > For now, just send i386 patch for review. And send
> amd64 patch when
> > prec support amd64.
> >
> >
> >
>
> What do you think about my idea?
>
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: Submition of i386.record.floating.point.patch
2009-06-05 2:41 paawan oza
@ 2009-06-05 2:50 ` Hui Zhu
2009-06-05 2:56 ` Mark Kettenis
0 siblings, 1 reply; 28+ messages in thread
From: Hui Zhu @ 2009-06-05 2:50 UTC (permalink / raw)
To: gdb-patches; +Cc: paawan oza
Could someone help us about this?
Thanks,
Hui
On Fri, Jun 5, 2009 at 10:41, paawan oza<paawan1982@yahoo.com> wrote:
>
> Hi Hui,
> I think, FCTRL, FTAG, FOP are part of i386 also.
> for e.g.
> FFREE insn, changes only tag register.
> frstor affetcs whole FPU environment.
> The FPU operating environment consists of the FPU control word, status word, tag
> word, instruction pointer, data pointer, and last opcode.
> we need them for i386 too.
> I have sent the test_float.c in my previous mail, where you will find all these registers getting changed and tested.
> Regards,
> Oza.
>
>
>
> --- On Fri, 6/5/09, Hui Zhu <teawater@gmail.com> wrote:
>
>> From: Hui Zhu <teawater@gmail.com>
>> Subject: Re: Submition of i386.record.floating.point.patch
>> To: "paawan oza" <paawan1982@yahoo.com>
>> Cc: gdb-patches@sourceware.org
>> Date: Friday, June 5, 2009, 3:48 AM
>> >> diff -urN
>> gdb.orig/i386-tdep.h gdb.new/i386-tdep.h
>> >> --- gdb.orig/i386-tdep.h 2009-05-17
>> 17:56:44.000000000 -0400
>> >> +++ gdb.new/i386-tdep.h 2009-05-31
>> 16:33:14.000000000 -0400
>> >> @@ -145,7 +145,22 @@
>> >> I386_ES_REGNUM, /* %es */
>> >> I386_FS_REGNUM, /* %fs */
>> >> I386_GS_REGNUM, /* %gs */
>> >> - I386_ST0_REGNUM /* %st(0)
>> */
>> >> + I386_ST0_REGNUM, /* %st(0)
>> */
>> >> + I386_ST1_REGNUM, /* %st(1)
>> */
>> >> + I386_ST2_REGNUM, /* %st(2)
>> */
>> >> + I386_ST3_REGNUM, /* %st(3)
>> */
>> >> + I386_ST4_REGNUM, /* %st(4)
>> */
>> >> + I386_ST5_REGNUM, /* %st(5)
>> */
>> >> + I386_ST6_REGNUM, /* %st(6)
>> */
>> >> + I386_ST7_REGNUM, /* %st(7)
>> */
>> >> + I386_FCTRL, /*
>> floating point env regs : FCTRL-FOP */
>> >> + I386_FSTAT,
>> >> + I386_FTAG,
>> >> + I386_FISEG,
>> >> + I386_FIOFF,
>> >> + I386_FOSEG,
>> >> + I386_FOOFF,
>> >> + I386_FOP
>> >> };
>> >>
>> >
>> > About this part, I think this is my mistake. I
>> didn't take fp work
>> > for now very clear (Or I am still not clear with x86
>> fp).
>> > FCTRL, FOP and so on are the fp reg of amd64. For
>> now, prec is still
>> > not support amd64 (I am working on it).
>> > And amd64's support are in amd64-tedp.... files.
>> Change i386_regnum
>> > is not a good idea.
>> >
>> > I suggest you divide fp patch to 2 parts. One is for
>> i386, the other for amd64.
>> > For now, just send i386 patch for review. And send
>> amd64 patch when
>> > prec support amd64.
>> >
>> >
>> >
>>
>> What do you think about my idea?
>>
>
>
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
2009-06-05 2:50 ` Hui Zhu
@ 2009-06-05 2:56 ` Mark Kettenis
2009-06-05 2:58 ` Hui Zhu
0 siblings, 1 reply; 28+ messages in thread
From: Mark Kettenis @ 2009-06-05 2:56 UTC (permalink / raw)
To: teawater; +Cc: gdb-patches, paawan1982
> Date: Fri, 5 Jun 2009 10:50:25 +0800
> From: Hui Zhu <teawater@gmail.com>
>
> Could someone help us about this?
I should be able to, but I'm currently travelling. Should be back next week.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
2009-06-05 2:56 ` Mark Kettenis
@ 2009-06-05 2:58 ` Hui Zhu
0 siblings, 0 replies; 28+ messages in thread
From: Hui Zhu @ 2009-06-05 2:58 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches, paawan1982
That is great. Thanks Mark.
Hui
On Fri, Jun 5, 2009 at 10:56, Mark Kettenis<mark.kettenis@xs4all.nl> wrote:
>> Date: Fri, 5 Jun 2009 10:50:25 +0800
>> From: Hui Zhu <teawater@gmail.com>
>>
>> Could someone help us about this?
>
> I should be able to, but I'm currently travelling. Should be back next week.
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Submition of i386.record.floating.point.patch
@ 2009-06-03 4:03 paawan oza
0 siblings, 0 replies; 28+ messages in thread
From: paawan oza @ 2009-06-03 4:03 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches
Hi Hui,
I am not sure,
but as I understood you are asking for more example programs ?
-> the example program what I have written, includes most of the basic floating point assmebly isns.
-> only one thing is ; I have referred d8-df opcode map in appendix-B intel insn manual, which assures us that I havent missed anything and it should work for the rest of the insns as well.
-> the insn like FRSTOR, FLDENV might not have been tested.
-> or may be I can test some more insns, by writing gcc inline assembly as far as possible. I am not sure how much it can be assured.
What do you say ?
Regards,
Oza.
--- On Wed, 6/3/09, Hui Zhu <teawater@gmail.com> wrote:
> From: Hui Zhu <teawater@gmail.com>
> Subject: Re: Submition of i386.record.floating.point.patch
> To: "paawan oza" <paawan1982@yahoo.com>
> Cc: gdb-patches@sourceware.org
> Date: Wednesday, June 3, 2009, 8:27 AM
> On Wed, Jun 3, 2009 at 01:58, paawan
> oza <paawan1982@yahoo.com>
> wrote:
> > Hi Hui,
> >
> > I think, you have applied the old patch which I had
> sent earlier with in tar format.
> > the correct patch was in the email body.
> >
> > I am attaching correct patch, please find it
> attached.
> > the patch is tested against the example program which
> I have sent.
> >
>
> OK. It works.
> Could you post some example about howto make sure it works
> OK?
>
> >
> >
> > --- On Tue, 6/2/09, Hui Zhu <teawater@gmail.com>
> wrote:
> >
> >> From: Hui Zhu <teawater@gmail.com>
> >> Subject: Re: Submition of
> i386.record.floating.point.patch
> >> To: "paawan oza" <paawan1982@yahoo.com>
> >> Cc: gdb-patches@sourceware.org
> >> Date: Tuesday, June 2, 2009, 12:27 PM
> >> On Mon, Jun 1, 2009 at 22:54, paawan
> >> oza <paawan1982@yahoo.com>
> >> wrote:
> >> >
> >> > Hi,
> >> >
> >> > I am sorry for the inconvenience caused last
> time,
> >> during patch submition.
> >> > this time I am trying to post everything in
> email
> >> body.
> >> >
> >> >
> >>
> ******************************************************
> >> > ChangeLog:
> >> >
> >>
> ******************************************************
> >> > Current: gdb-6.8.50.20090531
> >> > 2009-05-31 Oza <paawan1982@yahoo.com>
> >> >
> >> > * i386-tdep.c: Support for
> floating point
> >> recording.
> >> > * i386-tdep.h: floating point
> registers
> >> enumaration added.
> >> >
> >>
> -------------------------------------------------------
> >> >
> >> >
> >>
> ******************************************************
> >> > README:
> >> >
> >>
> ******************************************************
> >> > Patch description:
> >> >
> >> > -> Provides floating point support for
> i386
> >> (reversible debugging:record-replay)
> >> > -> previously gdb was not recording
> floating point
> >> registers, now all the floating point registers
> which are
> >> likely to be changed by floating point
> instructions, are
> >> recorded and replayed.
> >> > -> the patch intends to provide the full
> support
> >> for all i386 floating point instructions.
> >> >
> >>
> ---------------------------------------------------------
> >> >
> >> >
> >> >
> >> >
> >>
> ******************************************************
> >> > Patch:i386-record-floats.patch
> >> >
> >>
> ******************************************************
> >> > diff -urN gdb.orig/i386-tdep.c
> gdb.new/i386-tdep.c
> >> > --- gdb.orig/i386-tdep.c
> 2009-05-29
> >> 17:08:40.000000000 -0400
> >> > +++ gdb.new/i386-tdep.c 2009-06-01
> 20:02:23.000000000
> >> -0400
> >> > @@ -543,6 +543,9 @@
> >> > /* The maximum number of saved registers.
> This
> >> should include all
> >> > registers mentioned above, and %eip.
> */
> >> > #define I386_NUM_SAVED_REGS
> I386_NUM_GREGS
> >> > +#define I386_SAVE_FPU_REGS
> 0xFFFD
> >> > +#define I386_SAVE_FPU_ENV
> 0xFFFE
> >> > +#define I386_SAVE_FPU_ENV_REG_STACK
> 0xFFFF
> >> >
> >> > struct i386_frame_cache
> >> > {
> >> > @@ -2985,6 +2988,54 @@
> >> > return 0;
> >> > }
> >> >
> >> > +/* Record the value of floating point
> registers which
> >> will be changed by the current instruction
> >> > + to "record_arch_list".
> >> > + return -1 if something is wrong. */
> >> > +
> >> > +static int i386_record_floats(struct
> i386_record_s
> >> *ir, uint32_t iregnum)
> >> > +{
> >> > + int i;
> >> > +
> >> > + /* Oza : push/pop of fpu stack is going
> to happen
> >> > + currently we store st0-st7 registers,
> but we
> >> need not store all registers all the time.
> >> > + using fstatus, we use 11-13 bits
> which gives
> >> us stack top and hence we optimize our storage.
> */
> >> > + if (I386_SAVE_FPU_REGS == iregnum)
> >> > + {
> >> > + for
> >> (i=I386_ST0_REGNUM;i<=I386_ST7_REGNUM;i++)
> >> > + {
> >> > + if (record_arch_list_add_reg
> >> (ir->regcache,i))
> >> > + return -1;
> >> > + }
> >> > + }
> >> > + else if (I386_SAVE_FPU_ENV == iregnum)
> >> > + {
> >> > + for
> (i=I386_FCTRL;i<=I386_FOP;i++)
> >> > + {
> >> > + if (record_arch_list_add_reg
> >> (ir->regcache,i))
> >> > + return -1;
> >> > + }
> >> > + }
> >> > + else if (I386_SAVE_FPU_ENV_REG_STACK ==
> iregnum)
> >> > + {
> >> > + for
> (i=I386_ST0_REGNUM;i<=I386_FOP;i++)
> >> > + {
> >> > + if (record_arch_list_add_reg
> >> (ir->regcache,i))
> >> > + return -1;
> >> > + }
> >> > + }
> >> > + else if (iregnum >= I386_ST0_REGNUM
> &&
> >> iregnum <= I386_FOP)
> >> > + {
> >> > + if (record_arch_list_add_reg
> >> (ir->regcache,iregnum))
> >> > + return -1;
> >> > + }
> >> > + else
> >> > + {
> >> > + /* param Error */
> >> > + return -1;
> >> > + }
> >> > + return 0;
> >> > +}
> >> > +
> >> > /* Parse the current instruction and record
> the
> >> values of the registers and
> >> > memory that will be changed in current
> >> instruction to "record_arch_list".
> >> > Return -1 if something wrong. */
> >> > @@ -4035,7 +4086,6 @@
> >> > break;
> >> >
> >> > /* floats */
> >> > - /* It just record the memory change
> of
> >> instrcution. */
> >> > case 0xd8:
> >> > case 0xd9:
> >> > case 0xda:
> >> > @@ -4056,39 +4106,49 @@
> >> > return -1;
> >> > switch (ir.reg)
> >> > {
> >> > - case 0x00:
> >> > - case 0x01:
> >> > case 0x02:
> >> > - case 0x03:
> >> > + case 0x12:
> >> > + case 0x22:
> >> > + case 0x32:
> >> > + /* for FCOM, FICOM
> nothing to do
> >> */
> >> > + break;
> >> > + case 0x03:
> >> > + case 0x13:
> >> > + case 0x23:
> >> > + case 0x33:
> >> > + /* FCOMP, FICOMP pop FPU
> stack,
> >> store all */
> >> > + if
> (i386_record_floats(&ir,
> >> I386_SAVE_FPU_REGS))
> >> > + return -1;
> >> > + break;
> >> > + case 0x00:
> >> > + case 0x01:
> >> > case 0x04:
> >> > case 0x05:
> >> > case 0x06:
> >> > case 0x07:
> >> > case 0x10:
> >> > - case 0x11:
> >> > - case 0x12:
> >> > - case 0x13:
> >> > + case 0x11:
> >> > case 0x14:
> >> > case 0x15:
> >> > case 0x16:
> >> > case 0x17:
> >> > case 0x20:
> >> > case 0x21:
> >> > - case 0x22:
> >> > - case 0x23:
> >> > case 0x24:
> >> > case 0x25:
> >> > case 0x26:
> >> > case 0x27:
> >> > case 0x30:
> >> > case 0x31:
> >> > - case 0x32:
> >> > - case 0x33:
> >> > case 0x34:
> >> > case 0x35:
> >> > case 0x36:
> >> > case 0x37:
> >> > - break;
> >> > + /* FADD, FMUL, FSUB,
> FSUBR, FDIV,
> >> FDIVR, FIADD, FIMUL, FISUB, FISUBR, FIDIV, FIDIVR
> >> > + ModR/M.reg is an
> extension of
> >> code, always affects st(0) register */
> >> > + if
> (i386_record_floats(&ir,
> >> I386_ST0_REGNUM))
> >> > + return -1;
> >> > + break;
> >> > case 0x08:
> >> > case 0x0a:
> >> > case 0x0b:
> >> > @@ -4096,6 +4156,7 @@
> >> > case 0x19:
> >> > case 0x1a:
> >> > case 0x1b:
> >> > + case 0x1d:
> >> > case 0x28:
> >> > case 0x29:
> >> > case 0x2a:
> >> > @@ -4103,11 +4164,16 @@
> >> > case 0x38:
> >> > case 0x39:
> >> > case 0x3a:
> >> > - case 0x3b:
> >> > + case 0x3b:
> >> > + case 0x3c:
> >> > + case 0x3d:
> >> > switch (ir.reg & 7)
> >> > {
> >> > case 0:
> >> > - break;
> >> > + /* FLD, FILD */
> >> > + if
> >> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> >> > + return -1;
> >> > + break;
> >> > case 1:
> >> > switch (ir.reg
> >> 4)
> >> > {
> >> > @@ -4120,6 +4186,7 @@
> >> > return
> -1;
> >> > break;
> >> > case 3:
> >> > + break;
> >> > default:
> >> > if
> >> (record_arch_list_add_mem (addr, 2))
> >> > return
> -1;
> >> > @@ -4130,15 +4197,42 @@
> >> > switch (ir.reg
> >> 4)
> >> > {
> >> > case 0:
> >> > + if
> >> (record_arch_list_add_mem (addr, 4))
> >> > + return
> -1;
> >> > + if (3 ==
> (ir.reg &
> >> 7))
> >> > + {
> >> > + /* FSTP
> m32fp */
> >> > + if
> >> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> >> > + return
> -1;
> >> > + }
> >> > + break;
> >> > case 1:
> >> > if
> >> (record_arch_list_add_mem (addr, 4))
> >> > return
> -1;
> >> > + if ((3 ==
> (ir.reg
> >> & 7)) || (5 == (ir.reg & 7)) || (7 ==
> (ir.reg &
> >> 7)))
> >> > + {
> >> > + /* FSTP
> */
> >> > + if
> >> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> >> > + return
> -1;
> >> > + }
> >> > break;
> >> > case 2:
> >> > if
> >> (record_arch_list_add_mem (addr, 8))
> >> > return
> -1;
> >> > + if (3 ==
> (ir.reg &
> >> 7))
> >> > + {
> >> > + /* FSTP
> m64fp */
> >> > + if
> >> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> >> > + return
> -1;
> >> > + }
> >> > break;
> >> > case 3:
> >> > + if ((3 <=
> (ir.reg
> >> & 7)) && (6 <= (ir.reg & 7)))
> >> > + {
> >> > + /*
> FISTP, FBLD,
> >> FILD, FBSTP */
> >> > + if
> >> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> >> > + return
> -1;
> >> > + }
> >> > default:
> >> > if
> >> (record_arch_list_add_mem (addr, 2))
> >> > return
> -1;
> >> > @@ -4147,54 +4241,71 @@
> >> > break;
> >> > }
> >> > break;
> >> > - case 0x0c:
> >> > - case 0x0d:
> >> > - case 0x1d:
> >> > - case 0x2c:
> >> > - case 0x3c:
> >> > - case 0x3d:
> >> > - break;
> >> > - case 0x0e:
> >> > + case 0x0c:
> >> > + /* FLDENV */
> >> > + if
> (i386_record_floats(&ir,
> >> I386_SAVE_FPU_ENV_REG_STACK))
> >> > + return -1;
> >> > + break;
> >> > + case 0x0d:
> >> > + /* FLDCW */
> >> > + if
> (i386_record_floats(&ir,
> >> I386_FCTRL))
> >> > + return -1;
> >> > + break;
> >> > + case 0x2c:
> >> > + /* FRTSTOR */
> >> > + if
> (i386_record_floats(&ir,
> >> I386_SAVE_FPU_ENV_REG_STACK))
> >> > + return -1;
> >> > + break;
> >> > + case 0x0e:
> >> > if (ir.dflag)
> >> > {
> >> > - if
> (record_arch_list_add_mem
> >> (addr, 28))
> >> > - return -1;
> >> > + if
> (record_arch_list_add_mem
> >> (addr, 28))
> >> > + return -1;
> >> > }
> >> > else
> >> > {
> >> > - if
> (record_arch_list_add_mem
> >> (addr, 14))
> >> > - return -1;
> >> > + if
> (record_arch_list_add_mem
> >> (addr, 14))
> >> > + return -1;
> >> > }
> >> > break;
> >> > - case 0x0f:
> >> > - case 0x2f:
> >> > + case 0x0f:
> >> > + case 0x2f:
> >> > if
> (record_arch_list_add_mem
> >> (addr, 2))
> >> > return -1;
> >> > break;
> >> > - case 0x1f:
> >> > - case 0x3e:
> >> > + case 0x1f:
> >> > + case 0x3e:
> >> > if
> (record_arch_list_add_mem
> >> (addr, 10))
> >> > return -1;
> >> > + /* FSTP, FBSTP */
> >> > + if
> (i386_record_floats(&ir,
> >> I386_SAVE_FPU_REGS))
> >> > + return -1;
> >> > break;
> >> > - case 0x2e:
> >> > + case 0x2e:
> >> > if (ir.dflag)
> >> > {
> >> > - if
> (record_arch_list_add_mem
> >> (addr, 28))
> >> > - return -1;
> >> > - addr += 28;
> >> > + if
> (record_arch_list_add_mem
> >> (addr, 28))
> >> > + return -1;
> >> > + addr += 28;
> >> > }
> >> > else
> >> > {
> >> > - if
> (record_arch_list_add_mem
> >> (addr, 14))
> >> > - return -1;
> >> > - addr += 14;
> >> > + if
> (record_arch_list_add_mem
> >> (addr, 14))
> >> > + return -1;
> >> > + addr += 14;
> >> > }
> >> > if
> (record_arch_list_add_mem
> >> (addr, 80))
> >> > return -1;
> >> > + /* FSAVE */
> >> > + if
> (i386_record_floats(&ir,
> >> I386_SAVE_FPU_ENV_REG_STACK))
> >> > + return -1;
> >> > break;
> >> > - case 0x3f:
> >> > + case 0x3f:
> >> > if
> (record_arch_list_add_mem
> >> (addr, 8))
> >> > return -1;
> >> > + /* FISTP */
> >> > + if
> (i386_record_floats(&ir,
> >> I386_SAVE_FPU_REGS))
> >> > + return -1;
> >> > break;
> >> > default:
> >> > ir.addr -= 2;
> >> > @@ -4202,9 +4313,180 @@
> >> > goto no_support;
> >> > break;
> >> > }
> >> > - }
> >> > + }
> >> > + /* opcode is an extension of
> modR/M byte
> >> */
> >> > + else
> >> > + {
> >> > + switch (opcode)
> >> > + {
> >> > + case 0xd8:
> >> > + if
> (i386_record_floats(&ir,
> >> I386_ST0_REGNUM))
> >> > + return -1;
> >> > + break;
> >> > + case 0xd9:
> >> > + if (0x0c == (ir.modrm
> >>
> >> 4))
> >> > + {
> >> > + if ((ir.modrm
> & 0x0f)
> >> <= 7)
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> >> > + return -1;
> >> > + }
> >> > + else
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM))
> >> > + return -1;
> >> > + /* if only
> st(0) is
> >> changing, then we have already recorded */
> >> > + if ((ir.modrm
> &
> >> 0x0f) - 0x08)
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM +
> ((ir.modrm
> >> & 0x0f) - 0x08)))
> >> > + return
> -1;
> >> > + }
> >> > + }
> >> > + }
> >> > + else
> >> > + {
> >> > + switch(ir.modrm)
> >> > + {
> >> > + case 0xe0:
> >> > + case 0xe1:
> >> > + case 0xf0:
> >> > + case 0xf5:
> >> > + case 0xf8:
> >> > + case 0xfa:
> >> > + case 0xfc:
> >> > + case 0xfe:
> >> > + case 0xff:
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM))
> >> > + return -1;
> >> > + break;
> >> > + case 0xf1:
> >> > + case 0xf2:
> >> > + case 0xf3:
> >> > + case 0xf4:
> >> > + case 0xf6:
> >> > + case 0xf7:
> >> > + case 0xe8:
> >> > + case 0xe9:
> >> > + case 0xea:
> >> > + case 0xeb:
> >> > + case 0xec:
> >> > + case 0xed:
> >> > + case 0xee:
> >> > + case 0xf9:
> >> > + case 0xfb:
> >> > + if
> >> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> >> > + return -1;
> >> > + break;
> >> > + case 0xfd:
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM))
> >> > + return -1;
> >> > + if
> >> (i386_record_floats(&ir, I386_ST1_REGNUM))
> >> > + return -1;
> >> > + break;
> >> > + }
> >> > + }
> >> > + break;
> >> > + case 0xda:
> >> > + if (0xe9 == ir.modrm)
> >> > + {
> >> > + if
> (i386_record_floats(&ir,
> >> I386_SAVE_FPU_REGS))
> >> > + return -1;
> >> > + }
> >> > + else if ((0x0c ==
> ir.modrm
> >> >> 4) || (0x0d == ir.modrm >> 4))
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM))
> >> > + return -1;
> >> > + if (((ir.modrm &
> 0x0f)
> >> > 0) && ((ir.modrm & 0x0f) <=
> 7))
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM +
> (ir.modrm
> >> & 0x0f)))
> >> > + return -1;
> >> > + }
> >> > + else if ((ir.modrm
> &
> >> 0x0f) - 0x08)
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM +
> ((ir.modrm
> >> & 0x0f) - 0x08)))
> >> > + return -1;
> >> > + }
> >> > + }
> >> > + break;
> >> > + case 0xdb:
> >> > + if (0xe3 == ir.modrm)
> >> > + {
> >> > + if
> (i386_record_floats(&ir,
> >> I386_SAVE_FPU_ENV))
> >> > + return -1;
> >> > + }
> >> > + else if ((0x0c ==
> ir.modrm
> >> >> 4) || (0x0d == ir.modrm >> 4))
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM))
> >> > + return -1;
> >> > + if (((ir.modrm &
> 0x0f)
> >> > 0) && ((ir.modrm & 0x0f) <=
> 7))
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM +
> (ir.modrm
> >> & 0x0f)))
> >> > + return -1;
> >> > + }
> >> > + else if ((ir.modrm
> &
> >> 0x0f) - 0x08)
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM +
> ((ir.modrm
> >> & 0x0f) - 0x08)))
> >> > + return -1;
> >> > + }
> >> > + }
> >> > + break;
> >> > + case 0xdc:
> >> > + if ((0x0c == ir.modrm
> >>
> >> 4) || (0x0d == ir.modrm >> 4) || (0x0f ==
> ir.modrm
> >> >> 4))
> >> > + {
> >> > + if ((ir.modrm &
> 0x0f)
> >> <= 7)
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM +
> (ir.modrm
> >> & 0x0f)))
> >> > + return -1;
> >> > + }
> >> > + else
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM +
> ((ir.modrm
> >> & 0x0f) - 0x08)))
> >> > + return -1;
> >> > + }
> >> > + }
> >> > + break;
> >> > + case 0xdd:
> >> > + if (0x0c == ir.modrm
> >>
> >> 4)
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir,I386_FTAG))
> >> > + return -1;
> >> > + }
> >> > + else if ((0x0d ==
> ir.modrm
> >> >> 4) || (0x0e == ir.modrm >> 4))
> >> > + {
> >> > + if ((ir.modrm
> & 0x0f)
> >> <= 7)
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_ST0_REGNUM +
> (ir.modrm
> >> & 0x0f)))
> >> > + return
> -1;
> >> > + }
> >> > + else
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> >> > + return
> -1;
> >> > + }
> >> > + }
> >> > + break;
> >> > + case 0xde:
> >> > + if ((0x0c == ir.modrm
> >>
> >> 4) || (0x0e == ir.modrm >> 4) || (0x0f ==
> ir.modrm
> >> >> 4) || (0xd9 == ir.modrm))
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> >> > + return -1;
> >> > + }
> >> > + break;
> >> > + case 0xdf:
> >> > + if (0xe0 == ir.modrm)
> >> > + {
> >> > + if
> >> (record_arch_list_add_reg (ir.regcache,
> I386_EAX_REGNUM))
> >> > + return -1;
> >> > + }
> >> > + else if ((0x0f ==
> ir.modrm
> >> >> 4) || (0x0e == ir.modrm >> 4))
> >> > + {
> >> > + if
> >> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> >> > + return -1;
> >> > + }
> >> > + break;
> >> > + }
> >> > + }
> >> > break;
> >> > -
> >> > /* string ops */
> >> > /* movsS */
> >> > case 0xa4:
> >> > @@ -4623,10 +4905,17 @@
> >> > /* fwait */
> >> > /* XXX */
> >> > case 0x9b:
> >> > - printf_unfiltered (_("Process
> record doesn't
> >> support instruction "
> >> > -
> "fwait.\n"));
> >> > - ir.addr -= 1;
> >> > - goto no_support;
> >> > + if (target_read_memory (ir.addr,
> &tmpu8,
> >> 1))
> >> > + {
> >> > + if (record_debug)
> >> > + printf_unfiltered
> (_("Process record:
> >> error reading memory at "
> >> > +
> "addr
> >> 0x%s len = 1.\n"),
> >> > +
> paddr_nz
> >> (ir.addr));
> >> > + return -1;
> >> > + }
> >> > + opcode = (uint32_t) tmpu8;
> >> > + ir.addr++;
> >> > + goto reswitch;
> >> > break;
> >> >
> >> > /* int3 */
> >> > diff -urN gdb.orig/i386-tdep.h
> gdb.new/i386-tdep.h
> >> > --- gdb.orig/i386-tdep.h
> 2009-05-17
> >> 17:56:44.000000000 -0400
> >> > +++ gdb.new/i386-tdep.h 2009-05-31
> 16:33:14.000000000
> >> -0400
> >> > @@ -145,7 +145,22 @@
> >> > I386_ES_REGNUM, /* %es
> */
> >> > I386_FS_REGNUM, /* %fs
> */
> >> > I386_GS_REGNUM, /* %gs
> */
> >> > - I386_ST0_REGNUM /*
> %st(0) */
> >> > + I386_ST0_REGNUM, /*
> %st(0) */
> >> > + I386_ST1_REGNUM, /*
> %st(1) */
> >> > + I386_ST2_REGNUM, /*
> %st(2) */
> >> > + I386_ST3_REGNUM, /*
> %st(3) */
> >> > + I386_ST4_REGNUM, /*
> %st(4) */
> >> > + I386_ST5_REGNUM, /*
> %st(5) */
> >> > + I386_ST6_REGNUM, /*
> %st(6) */
> >> > + I386_ST7_REGNUM, /*
> %st(7) */
> >> > + I386_FCTRL, /*
> floating
> >> point env regs : FCTRL-FOP */
> >> > + I386_FSTAT,
> >> > + I386_FTAG,
> >> > + I386_FISEG,
> >> > + I386_FIOFF,
> >> > + I386_FOSEG,
> >> > + I386_FOOFF,
> >> > + I386_FOP
> >> > };
> >> >
> >>
> >> About this part, I think this is my mistake. I
> didn't
> >> take fp work
> >> for now very clear (Or I am still not clear with
> x86 fp).
> >> FCTRL, FOP and so on are the fp reg of amd64.
> For
> >> now, prec is still
> >> not support amd64 (I am working on it).
> >> And amd64's support are in amd64-tedp.... files.
> >> Change i386_regnum
> >> is not a good idea.
> >>
> >> I suggest you divide fp patch to 2 parts. One is
> for i386,
> >> the other for amd64.
> >> For now, just send i386 patch for review. And
> send
> >> amd64 patch when
> >> prec support amd64.
> >>
>
> What do you think about my idea?
>
>
> Thanks,
> Hui
>
>
> >>
> >>
> >> > #define I386_NUM_GREGS 16
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> *******************************************************
> >> > test-example which does basic verification
> for the
> >> patch.
> >> >
> >>
> *******************************************************
> >> >
> >> > #include <stdio.h>
> >> > #include <math.h>
> >> >
> >> > int main()
> >> > {
> >> > float
> no1,no2,no3,no4,no5,no6,no7;
> >> > double x = 100.345, y = 25.7789;
> >> > long double ldx =
> 88888888888888888888.88,
> >> ldy = 9999999999999999999.99;
> >> > float result,resultd,resultld;
> >> > no1 = 10.45;
> >> > no2 = 20.77;
> >> > no3 = 156.89874646;
> >> > no4 = 14.56;
> >> > no5 = 11.11;
> >> > no6 = 66.77;
> >> > no7 = 88.88;
> >> >
> >> > result = no1 + no2 + no3 + no4 +
> no5 + no6
> >> + no7;
> >> > printf("result is %f\n",result);
> >> >
> >> > result = fmodf(no2,no1);
> >> > printf("result is %f\n",result);
> >> >
> >> > resultd = fmod(x,y);
> >> > printf("result is %f\n",resultd);
> >> >
> >> > resultld = fmodl(ldy,ldy);
> >> > printf("result is
> %f\n",resultld);
> >> >
> >> > result = fabsf(no1);
> >> > printf("result is %f\n",result);
> >> >
> >> > result = no3 / no4;
> >> > printf("result is %f\n",result);
> >> >
> >> > result = no1 * no2 * no3 * no4;
> >> > printf("result is %f\n",result);
> >> >
> >> > result = sin(30);
> >> > printf("result is %f\n",result);
> >> >
> >> > result = cos(30);
> >> > printf("result is %f\n",result);
> >> >
> >> > result = tan(30);
> >> > printf("result is %f\n",result);
> >> >
> >> > result = atan(30);
> >> > printf("result is %f\n",result);
> >> >
> >> > result = sqrt(no3);
> >> > printf("result is %f\n",result);
> >> >
> >> > result = log10(no3);
> >> > printf("result is %f\n",result);
> >> >
> >> > result = log(no3);
> >> > printf("result is %f\n",result);
> >> >
> >> > result = exp10(no3);
> >> > printf("result is %f\n",result);
> >> >
> >> > result = exp(no3);
> >> > printf("result is %f\n",result);
> >> >
> >> > ldy = 88888888888888888888.88;
> >> > if (ldx == ldy)
> >> > ldy =
> 7777777777777777777777777777.777;
> >> > else
> >> > ldy =
> 666666666666666666666666666.666;
> >> >
> >> > }
> >>
> >> With this example, what I got is:
> >> gdb ./a.out
> >> GNU gdb (GDB) 6.8.50.20090602-cvs
> >> Copyright (C) 2009 Free Software Foundation, Inc.
> >> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> >> 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:
> >> <http://www.gnu.org/software/gdb/bugs/>...
> >> 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/bgdb/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 0x8048608: file 1.c,
> line 7.
> >> Starting program:
> /home/teawater/gdb/bgdb/gdb/a.out
> >>
> >> Temporary breakpoint 1, main () at 1.c:7
> >> 7 double
> >> x = 100.345, y = 25.7789;
> >> (gdb) record
> >> (gdb) c
> >> Continuing.
> >> result is 369.438751
> >> Process record doesn't support instruction fwait.
> >> Process record doesn't support instruction 0x9b at
> address
> >> 0xb7fa35fa.
> >> Process record: failed to record execution log.
> >>
> >> Program received signal SIGTRAP, Trace/breakpoint
> trap.
> >> 0xb7fa35fa in ?? () from
> /lib/tls/i686/cmov/libm.so.6
> >> (gdb)
> >>
> >>
> >> Thanks,
> >> Hui
> >>
> >
> >
> >
>
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: Submition of i386.record.floating.point.patch
@ 2009-06-02 17:58 paawan oza
2009-06-03 2:58 ` Hui Zhu
0 siblings, 1 reply; 28+ messages in thread
From: paawan oza @ 2009-06-02 17:58 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 26444 bytes --]
Hi Hui,
I think, you have applied the old patch which I had sent earlier with in tar format.
the correct patch was in the email body.
I am attaching correct patch, please find it attached.
the patch is tested against the example program which I have sent.
Regards,
Oza.
--- On Tue, 6/2/09, Hui Zhu <teawater@gmail.com> wrote:
> From: Hui Zhu <teawater@gmail.com>
> Subject: Re: Submition of i386.record.floating.point.patch
> To: "paawan oza" <paawan1982@yahoo.com>
> Cc: gdb-patches@sourceware.org
> Date: Tuesday, June 2, 2009, 12:27 PM
> On Mon, Jun 1, 2009 at 22:54, paawan
> oza <paawan1982@yahoo.com>
> wrote:
> >
> > Hi,
> >
> > I am sorry for the inconvenience caused last time,
> during patch submition.
> > this time I am trying to post everything in email
> body.
> >
> >
> ******************************************************
> > ChangeLog:
> >
> ******************************************************
> > Current: gdb-6.8.50.20090531
> > 2009-05-31 Oza <paawan1982@yahoo.com>
> >
> > * i386-tdep.c: Support for floating point
> recording.
> > * i386-tdep.h: floating point registers
> enumaration added.
> >
> -------------------------------------------------------
> >
> >
> ******************************************************
> > README:
> >
> ******************************************************
> > Patch description:
> >
> > -> Provides floating point support for i386
> (reversible debugging:record-replay)
> > -> previously gdb was not recording floating point
> registers, now all the floating point registers which are
> likely to be changed by floating point instructions, are
> recorded and replayed.
> > -> the patch intends to provide the full support
> for all i386 floating point instructions.
> >
> ---------------------------------------------------------
> >
> >
> >
> >
> ******************************************************
> > Patch:i386-record-floats.patch
> >
> ******************************************************
> > diff -urN gdb.orig/i386-tdep.c gdb.new/i386-tdep.c
> > --- gdb.orig/i386-tdep.c 2009-05-29
> 17:08:40.000000000 -0400
> > +++ gdb.new/i386-tdep.c 2009-06-01 20:02:23.000000000
> -0400
> > @@ -543,6 +543,9 @@
> > /* The maximum number of saved registers. This
> should include all
> > registers mentioned above, and %eip. */
> > #define I386_NUM_SAVED_REGS I386_NUM_GREGS
> > +#define I386_SAVE_FPU_REGS 0xFFFD
> > +#define I386_SAVE_FPU_ENV 0xFFFE
> > +#define I386_SAVE_FPU_ENV_REG_STACK 0xFFFF
> >
> > struct i386_frame_cache
> > {
> > @@ -2985,6 +2988,54 @@
> > return 0;
> > }
> >
> > +/* Record the value of floating point registers which
> will be changed by the current instruction
> > + to "record_arch_list".
> > + return -1 if something is wrong. */
> > +
> > +static int i386_record_floats(struct i386_record_s
> *ir, uint32_t iregnum)
> > +{
> > + int i;
> > +
> > + /* Oza : push/pop of fpu stack is going to happen
> > + currently we store st0-st7 registers, but we
> need not store all registers all the time.
> > + using fstatus, we use 11-13 bits which gives
> us stack top and hence we optimize our storage. */
> > + if (I386_SAVE_FPU_REGS == iregnum)
> > + {
> > + for
> (i=I386_ST0_REGNUM;i<=I386_ST7_REGNUM;i++)
> > + {
> > + if (record_arch_list_add_reg
> (ir->regcache,i))
> > + return -1;
> > + }
> > + }
> > + else if (I386_SAVE_FPU_ENV == iregnum)
> > + {
> > + for (i=I386_FCTRL;i<=I386_FOP;i++)
> > + {
> > + if (record_arch_list_add_reg
> (ir->regcache,i))
> > + return -1;
> > + }
> > + }
> > + else if (I386_SAVE_FPU_ENV_REG_STACK == iregnum)
> > + {
> > + for (i=I386_ST0_REGNUM;i<=I386_FOP;i++)
> > + {
> > + if (record_arch_list_add_reg
> (ir->regcache,i))
> > + return -1;
> > + }
> > + }
> > + else if (iregnum >= I386_ST0_REGNUM &&
> iregnum <= I386_FOP)
> > + {
> > + if (record_arch_list_add_reg
> (ir->regcache,iregnum))
> > + return -1;
> > + }
> > + else
> > + {
> > + /* param Error */
> > + return -1;
> > + }
> > + return 0;
> > +}
> > +
> > /* Parse the current instruction and record the
> values of the registers and
> > memory that will be changed in current
> instruction to "record_arch_list".
> > Return -1 if something wrong. */
> > @@ -4035,7 +4086,6 @@
> > break;
> >
> > /* floats */
> > - /* It just record the memory change of
> instrcution. */
> > case 0xd8:
> > case 0xd9:
> > case 0xda:
> > @@ -4056,39 +4106,49 @@
> > return -1;
> > switch (ir.reg)
> > {
> > - case 0x00:
> > - case 0x01:
> > case 0x02:
> > - case 0x03:
> > + case 0x12:
> > + case 0x22:
> > + case 0x32:
> > + /* for FCOM, FICOM nothing to do
> */
> > + break;
> > + case 0x03:
> > + case 0x13:
> > + case 0x23:
> > + case 0x33:
> > + /* FCOMP, FICOMP pop FPU stack,
> store all */
> > + if (i386_record_floats(&ir,
> I386_SAVE_FPU_REGS))
> > + return -1;
> > + break;
> > + case 0x00:
> > + case 0x01:
> > case 0x04:
> > case 0x05:
> > case 0x06:
> > case 0x07:
> > case 0x10:
> > - case 0x11:
> > - case 0x12:
> > - case 0x13:
> > + case 0x11:
> > case 0x14:
> > case 0x15:
> > case 0x16:
> > case 0x17:
> > case 0x20:
> > case 0x21:
> > - case 0x22:
> > - case 0x23:
> > case 0x24:
> > case 0x25:
> > case 0x26:
> > case 0x27:
> > case 0x30:
> > case 0x31:
> > - case 0x32:
> > - case 0x33:
> > case 0x34:
> > case 0x35:
> > case 0x36:
> > case 0x37:
> > - break;
> > + /* FADD, FMUL, FSUB, FSUBR, FDIV,
> FDIVR, FIADD, FIMUL, FISUB, FISUBR, FIDIV, FIDIVR
> > + ModR/M.reg is an extension of
> code, always affects st(0) register */
> > + if (i386_record_floats(&ir,
> I386_ST0_REGNUM))
> > + return -1;
> > + break;
> > case 0x08:
> > case 0x0a:
> > case 0x0b:
> > @@ -4096,6 +4156,7 @@
> > case 0x19:
> > case 0x1a:
> > case 0x1b:
> > + case 0x1d:
> > case 0x28:
> > case 0x29:
> > case 0x2a:
> > @@ -4103,11 +4164,16 @@
> > case 0x38:
> > case 0x39:
> > case 0x3a:
> > - case 0x3b:
> > + case 0x3b:
> > + case 0x3c:
> > + case 0x3d:
> > switch (ir.reg & 7)
> > {
> > case 0:
> > - break;
> > + /* FLD, FILD */
> > + if
> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> > + return -1;
> > + break;
> > case 1:
> > switch (ir.reg >> 4)
> > {
> > @@ -4120,6 +4186,7 @@
> > return -1;
> > break;
> > case 3:
> > + break;
> > default:
> > if
> (record_arch_list_add_mem (addr, 2))
> > return -1;
> > @@ -4130,15 +4197,42 @@
> > switch (ir.reg >> 4)
> > {
> > case 0:
> > + if
> (record_arch_list_add_mem (addr, 4))
> > + return -1;
> > + if (3 == (ir.reg &
> 7))
> > + {
> > + /* FSTP m32fp */
> > + if
> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> > + return -1;
> > + }
> > + break;
> > case 1:
> > if
> (record_arch_list_add_mem (addr, 4))
> > return -1;
> > + if ((3 == (ir.reg
> & 7)) || (5 == (ir.reg & 7)) || (7 == (ir.reg &
> 7)))
> > + {
> > + /* FSTP */
> > + if
> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> > + return -1;
> > + }
> > break;
> > case 2:
> > if
> (record_arch_list_add_mem (addr, 8))
> > return -1;
> > + if (3 == (ir.reg &
> 7))
> > + {
> > + /* FSTP m64fp */
> > + if
> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> > + return -1;
> > + }
> > break;
> > case 3:
> > + if ((3 <= (ir.reg
> & 7)) && (6 <= (ir.reg & 7)))
> > + {
> > + /* FISTP, FBLD,
> FILD, FBSTP */
> > + if
> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> > + return -1;
> > + }
> > default:
> > if
> (record_arch_list_add_mem (addr, 2))
> > return -1;
> > @@ -4147,54 +4241,71 @@
> > break;
> > }
> > break;
> > - case 0x0c:
> > - case 0x0d:
> > - case 0x1d:
> > - case 0x2c:
> > - case 0x3c:
> > - case 0x3d:
> > - break;
> > - case 0x0e:
> > + case 0x0c:
> > + /* FLDENV */
> > + if (i386_record_floats(&ir,
> I386_SAVE_FPU_ENV_REG_STACK))
> > + return -1;
> > + break;
> > + case 0x0d:
> > + /* FLDCW */
> > + if (i386_record_floats(&ir,
> I386_FCTRL))
> > + return -1;
> > + break;
> > + case 0x2c:
> > + /* FRTSTOR */
> > + if (i386_record_floats(&ir,
> I386_SAVE_FPU_ENV_REG_STACK))
> > + return -1;
> > + break;
> > + case 0x0e:
> > if (ir.dflag)
> > {
> > - if (record_arch_list_add_mem
> (addr, 28))
> > - return -1;
> > + if (record_arch_list_add_mem
> (addr, 28))
> > + return -1;
> > }
> > else
> > {
> > - if (record_arch_list_add_mem
> (addr, 14))
> > - return -1;
> > + if (record_arch_list_add_mem
> (addr, 14))
> > + return -1;
> > }
> > break;
> > - case 0x0f:
> > - case 0x2f:
> > + case 0x0f:
> > + case 0x2f:
> > if (record_arch_list_add_mem
> (addr, 2))
> > return -1;
> > break;
> > - case 0x1f:
> > - case 0x3e:
> > + case 0x1f:
> > + case 0x3e:
> > if (record_arch_list_add_mem
> (addr, 10))
> > return -1;
> > + /* FSTP, FBSTP */
> > + if (i386_record_floats(&ir,
> I386_SAVE_FPU_REGS))
> > + return -1;
> > break;
> > - case 0x2e:
> > + case 0x2e:
> > if (ir.dflag)
> > {
> > - if (record_arch_list_add_mem
> (addr, 28))
> > - return -1;
> > - addr += 28;
> > + if (record_arch_list_add_mem
> (addr, 28))
> > + return -1;
> > + addr += 28;
> > }
> > else
> > {
> > - if (record_arch_list_add_mem
> (addr, 14))
> > - return -1;
> > - addr += 14;
> > + if (record_arch_list_add_mem
> (addr, 14))
> > + return -1;
> > + addr += 14;
> > }
> > if (record_arch_list_add_mem
> (addr, 80))
> > return -1;
> > + /* FSAVE */
> > + if (i386_record_floats(&ir,
> I386_SAVE_FPU_ENV_REG_STACK))
> > + return -1;
> > break;
> > - case 0x3f:
> > + case 0x3f:
> > if (record_arch_list_add_mem
> (addr, 8))
> > return -1;
> > + /* FISTP */
> > + if (i386_record_floats(&ir,
> I386_SAVE_FPU_REGS))
> > + return -1;
> > break;
> > default:
> > ir.addr -= 2;
> > @@ -4202,9 +4313,180 @@
> > goto no_support;
> > break;
> > }
> > - }
> > + }
> > + /* opcode is an extension of modR/M byte
> */
> > + else
> > + {
> > + switch (opcode)
> > + {
> > + case 0xd8:
> > + if (i386_record_floats(&ir,
> I386_ST0_REGNUM))
> > + return -1;
> > + break;
> > + case 0xd9:
> > + if (0x0c == (ir.modrm >>
> 4))
> > + {
> > + if ((ir.modrm & 0x0f)
> <= 7)
> > + {
> > + if
> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> > + return -1;
> > + }
> > + else
> > + {
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM))
> > + return -1;
> > + /* if only st(0) is
> changing, then we have already recorded */
> > + if ((ir.modrm &
> 0x0f) - 0x08)
> > + {
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm
> & 0x0f) - 0x08)))
> > + return -1;
> > + }
> > + }
> > + }
> > + else
> > + {
> > + switch(ir.modrm)
> > + {
> > + case 0xe0:
> > + case 0xe1:
> > + case 0xf0:
> > + case 0xf5:
> > + case 0xf8:
> > + case 0xfa:
> > + case 0xfc:
> > + case 0xfe:
> > + case 0xff:
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM))
> > + return -1;
> > + break;
> > + case 0xf1:
> > + case 0xf2:
> > + case 0xf3:
> > + case 0xf4:
> > + case 0xf6:
> > + case 0xf7:
> > + case 0xe8:
> > + case 0xe9:
> > + case 0xea:
> > + case 0xeb:
> > + case 0xec:
> > + case 0xed:
> > + case 0xee:
> > + case 0xf9:
> > + case 0xfb:
> > + if
> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> > + return -1;
> > + break;
> > + case 0xfd:
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM))
> > + return -1;
> > + if
> (i386_record_floats(&ir, I386_ST1_REGNUM))
> > + return -1;
> > + break;
> > + }
> > + }
> > + break;
> > + case 0xda:
> > + if (0xe9 == ir.modrm)
> > + {
> > + if (i386_record_floats(&ir,
> I386_SAVE_FPU_REGS))
> > + return -1;
> > + }
> > + else if ((0x0c == ir.modrm
> >> 4) || (0x0d == ir.modrm >> 4))
> > + {
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM))
> > + return -1;
> > + if (((ir.modrm & 0x0f)
> > 0) && ((ir.modrm & 0x0f) <= 7))
> > + {
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm
> & 0x0f)))
> > + return -1;
> > + }
> > + else if ((ir.modrm &
> 0x0f) - 0x08)
> > + {
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm
> & 0x0f) - 0x08)))
> > + return -1;
> > + }
> > + }
> > + break;
> > + case 0xdb:
> > + if (0xe3 == ir.modrm)
> > + {
> > + if (i386_record_floats(&ir,
> I386_SAVE_FPU_ENV))
> > + return -1;
> > + }
> > + else if ((0x0c == ir.modrm
> >> 4) || (0x0d == ir.modrm >> 4))
> > + {
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM))
> > + return -1;
> > + if (((ir.modrm & 0x0f)
> > 0) && ((ir.modrm & 0x0f) <= 7))
> > + {
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm
> & 0x0f)))
> > + return -1;
> > + }
> > + else if ((ir.modrm &
> 0x0f) - 0x08)
> > + {
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm
> & 0x0f) - 0x08)))
> > + return -1;
> > + }
> > + }
> > + break;
> > + case 0xdc:
> > + if ((0x0c == ir.modrm >>
> 4) || (0x0d == ir.modrm >> 4) || (0x0f == ir.modrm
> >> 4))
> > + {
> > + if ((ir.modrm & 0x0f)
> <= 7)
> > + {
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm
> & 0x0f)))
> > + return -1;
> > + }
> > + else
> > + {
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm
> & 0x0f) - 0x08)))
> > + return -1;
> > + }
> > + }
> > + break;
> > + case 0xdd:
> > + if (0x0c == ir.modrm >>
> 4)
> > + {
> > + if
> (i386_record_floats(&ir,I386_FTAG))
> > + return -1;
> > + }
> > + else if ((0x0d == ir.modrm
> >> 4) || (0x0e == ir.modrm >> 4))
> > + {
> > + if ((ir.modrm & 0x0f)
> <= 7)
> > + {
> > + if
> (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm
> & 0x0f)))
> > + return -1;
> > + }
> > + else
> > + {
> > + if
> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> > + return -1;
> > + }
> > + }
> > + break;
> > + case 0xde:
> > + if ((0x0c == ir.modrm >>
> 4) || (0x0e == ir.modrm >> 4) || (0x0f == ir.modrm
> >> 4) || (0xd9 == ir.modrm))
> > + {
> > + if
> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> > + return -1;
> > + }
> > + break;
> > + case 0xdf:
> > + if (0xe0 == ir.modrm)
> > + {
> > + if
> (record_arch_list_add_reg (ir.regcache, I386_EAX_REGNUM))
> > + return -1;
> > + }
> > + else if ((0x0f == ir.modrm
> >> 4) || (0x0e == ir.modrm >> 4))
> > + {
> > + if
> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> > + return -1;
> > + }
> > + break;
> > + }
> > + }
> > break;
> > -
> > /* string ops */
> > /* movsS */
> > case 0xa4:
> > @@ -4623,10 +4905,17 @@
> > /* fwait */
> > /* XXX */
> > case 0x9b:
> > - printf_unfiltered (_("Process record doesn't
> support instruction "
> > - "fwait.\n"));
> > - ir.addr -= 1;
> > - goto no_support;
> > + if (target_read_memory (ir.addr, &tmpu8,
> 1))
> > + {
> > + if (record_debug)
> > + printf_unfiltered (_("Process record:
> error reading memory at "
> > + "addr
> 0x%s len = 1.\n"),
> > + paddr_nz
> (ir.addr));
> > + return -1;
> > + }
> > + opcode = (uint32_t) tmpu8;
> > + ir.addr++;
> > + goto reswitch;
> > break;
> >
> > /* int3 */
> > diff -urN gdb.orig/i386-tdep.h gdb.new/i386-tdep.h
> > --- gdb.orig/i386-tdep.h 2009-05-17
> 17:56:44.000000000 -0400
> > +++ gdb.new/i386-tdep.h 2009-05-31 16:33:14.000000000
> -0400
> > @@ -145,7 +145,22 @@
> > I386_ES_REGNUM, /* %es */
> > I386_FS_REGNUM, /* %fs */
> > I386_GS_REGNUM, /* %gs */
> > - I386_ST0_REGNUM /* %st(0) */
> > + I386_ST0_REGNUM, /* %st(0) */
> > + I386_ST1_REGNUM, /* %st(1) */
> > + I386_ST2_REGNUM, /* %st(2) */
> > + I386_ST3_REGNUM, /* %st(3) */
> > + I386_ST4_REGNUM, /* %st(4) */
> > + I386_ST5_REGNUM, /* %st(5) */
> > + I386_ST6_REGNUM, /* %st(6) */
> > + I386_ST7_REGNUM, /* %st(7) */
> > + I386_FCTRL, /* floating
> point env regs : FCTRL-FOP */
> > + I386_FSTAT,
> > + I386_FTAG,
> > + I386_FISEG,
> > + I386_FIOFF,
> > + I386_FOSEG,
> > + I386_FOOFF,
> > + I386_FOP
> > };
> >
>
> About this part, I think this is my mistake. I didn't
> take fp work
> for now very clear (Or I am still not clear with x86 fp).
> FCTRL, FOP and so on are the fp reg of amd64. For
> now, prec is still
> not support amd64 (I am working on it).
> And amd64's support are in amd64-tedp.... files.
> Change i386_regnum
> is not a good idea.
>
> I suggest you divide fp patch to 2 parts. One is for i386,
> the other for amd64.
> For now, just send i386 patch for review. And send
> amd64 patch when
> prec support amd64.
>
>
>
> > #define I386_NUM_GREGS 16
> >
> >
> >
> >
> >
> *******************************************************
> > test-example which does basic verification for the
> patch.
> >
> *******************************************************
> >
> > #include <stdio.h>
> > #include <math.h>
> >
> > int main()
> > {
> > float no1,no2,no3,no4,no5,no6,no7;
> > double x = 100.345, y = 25.7789;
> > long double ldx = 88888888888888888888.88,
> ldy = 9999999999999999999.99;
> > float result,resultd,resultld;
> > no1 = 10.45;
> > no2 = 20.77;
> > no3 = 156.89874646;
> > no4 = 14.56;
> > no5 = 11.11;
> > no6 = 66.77;
> > no7 = 88.88;
> >
> > result = no1 + no2 + no3 + no4 + no5 + no6
> + no7;
> > printf("result is %f\n",result);
> >
> > result = fmodf(no2,no1);
> > printf("result is %f\n",result);
> >
> > resultd = fmod(x,y);
> > printf("result is %f\n",resultd);
> >
> > resultld = fmodl(ldy,ldy);
> > printf("result is %f\n",resultld);
> >
> > result = fabsf(no1);
> > printf("result is %f\n",result);
> >
> > result = no3 / no4;
> > printf("result is %f\n",result);
> >
> > result = no1 * no2 * no3 * no4;
> > printf("result is %f\n",result);
> >
> > result = sin(30);
> > printf("result is %f\n",result);
> >
> > result = cos(30);
> > printf("result is %f\n",result);
> >
> > result = tan(30);
> > printf("result is %f\n",result);
> >
> > result = atan(30);
> > printf("result is %f\n",result);
> >
> > result = sqrt(no3);
> > printf("result is %f\n",result);
> >
> > result = log10(no3);
> > printf("result is %f\n",result);
> >
> > result = log(no3);
> > printf("result is %f\n",result);
> >
> > result = exp10(no3);
> > printf("result is %f\n",result);
> >
> > result = exp(no3);
> > printf("result is %f\n",result);
> >
> > ldy = 88888888888888888888.88;
> > if (ldx == ldy)
> > ldy = 7777777777777777777777777777.777;
> > else
> > ldy = 666666666666666666666666666.666;
> >
> > }
>
> With this example, what I got is:
> gdb ./a.out
> GNU gdb (GDB) 6.8.50.20090602-cvs
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> 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:
> <http://www.gnu.org/software/gdb/bugs/>...
> 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/bgdb/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 0x8048608: file 1.c, line 7.
> Starting program: /home/teawater/gdb/bgdb/gdb/a.out
>
> Temporary breakpoint 1, main () at 1.c:7
> 7 double
> x = 100.345, y = 25.7789;
> (gdb) record
> (gdb) c
> Continuing.
> result is 369.438751
> Process record doesn't support instruction fwait.
> Process record doesn't support instruction 0x9b at address
> 0xb7fa35fa.
> Process record: failed to record execution log.
>
> Program received signal SIGTRAP, Trace/breakpoint trap.
> 0xb7fa35fa in ?? () from /lib/tls/i686/cmov/libm.so.6
> (gdb)
>
>
> Thanks,
> Hui
>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: i386-record-floats.patch --]
[-- Type: text/x-patch; name="i386-record-floats.patch", Size: 16155 bytes --]
diff -urN gdb.orig/i386-tdep.c gdb.new/i386-tdep.c
--- gdb.orig/i386-tdep.c 2009-05-29 17:08:40.000000000 -0400
+++ gdb.new/i386-tdep.c 2009-06-01 20:02:23.000000000 -0400
@@ -543,6 +543,9 @@
/* The maximum number of saved registers. This should include all
registers mentioned above, and %eip. */
#define I386_NUM_SAVED_REGS I386_NUM_GREGS
+#define I386_SAVE_FPU_REGS 0xFFFD
+#define I386_SAVE_FPU_ENV 0xFFFE
+#define I386_SAVE_FPU_ENV_REG_STACK 0xFFFF
struct i386_frame_cache
{
@@ -2985,6 +2988,54 @@
return 0;
}
+/* Record the value of floating point registers which will be changed by the current instruction
+ to "record_arch_list".
+ return -1 if something is wrong. */
+
+static int i386_record_floats(struct i386_record_s *ir, uint32_t iregnum)
+{
+ int i;
+
+ /* Oza : push/pop of fpu stack is going to happen
+ currently we store st0-st7 registers, but we need not store all registers all the time.
+ using fstatus, we use 11-13 bits which gives us stack top and hence we optimize our storage. */
+ if (I386_SAVE_FPU_REGS == iregnum)
+ {
+ for (i=I386_ST0_REGNUM;i<=I386_ST7_REGNUM;i++)
+ {
+ if (record_arch_list_add_reg (ir->regcache,i))
+ return -1;
+ }
+ }
+ else if (I386_SAVE_FPU_ENV == iregnum)
+ {
+ for (i=I386_FCTRL;i<=I386_FOP;i++)
+ {
+ if (record_arch_list_add_reg (ir->regcache,i))
+ return -1;
+ }
+ }
+ else if (I386_SAVE_FPU_ENV_REG_STACK == iregnum)
+ {
+ for (i=I386_ST0_REGNUM;i<=I386_FOP;i++)
+ {
+ if (record_arch_list_add_reg (ir->regcache,i))
+ return -1;
+ }
+ }
+ else if (iregnum >= I386_ST0_REGNUM && iregnum <= I386_FOP)
+ {
+ if (record_arch_list_add_reg (ir->regcache,iregnum))
+ return -1;
+ }
+ else
+ {
+ /* param Error */
+ return -1;
+ }
+ return 0;
+}
+
/* Parse the current instruction and record the values of the registers and
memory that will be changed in current instruction to "record_arch_list".
Return -1 if something wrong. */
@@ -4035,7 +4086,6 @@
break;
/* floats */
- /* It just record the memory change of instrcution. */
case 0xd8:
case 0xd9:
case 0xda:
@@ -4056,39 +4106,49 @@
return -1;
switch (ir.reg)
{
- case 0x00:
- case 0x01:
case 0x02:
- case 0x03:
+ case 0x12:
+ case 0x22:
+ case 0x32:
+ /* for FCOM, FICOM nothing to do */
+ break;
+ case 0x03:
+ case 0x13:
+ case 0x23:
+ case 0x33:
+ /* FCOMP, FICOMP pop FPU stack, store all */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ break;
+ case 0x00:
+ case 0x01:
case 0x04:
case 0x05:
case 0x06:
case 0x07:
case 0x10:
- case 0x11:
- case 0x12:
- case 0x13:
+ case 0x11:
case 0x14:
case 0x15:
case 0x16:
case 0x17:
case 0x20:
case 0x21:
- case 0x22:
- case 0x23:
case 0x24:
case 0x25:
case 0x26:
case 0x27:
case 0x30:
case 0x31:
- case 0x32:
- case 0x33:
case 0x34:
case 0x35:
case 0x36:
case 0x37:
- break;
+ /* FADD, FMUL, FSUB, FSUBR, FDIV, FDIVR, FIADD, FIMUL, FISUB, FISUBR, FIDIV, FIDIVR
+ ModR/M.reg is an extension of code, always affects st(0) register */
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ break;
case 0x08:
case 0x0a:
case 0x0b:
@@ -4096,6 +4156,7 @@
case 0x19:
case 0x1a:
case 0x1b:
+ case 0x1d:
case 0x28:
case 0x29:
case 0x2a:
@@ -4103,11 +4164,16 @@
case 0x38:
case 0x39:
case 0x3a:
- case 0x3b:
+ case 0x3b:
+ case 0x3c:
+ case 0x3d:
switch (ir.reg & 7)
{
case 0:
- break;
+ /* FLD, FILD */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ break;
case 1:
switch (ir.reg >> 4)
{
@@ -4120,6 +4186,7 @@
return -1;
break;
case 3:
+ break;
default:
if (record_arch_list_add_mem (addr, 2))
return -1;
@@ -4130,15 +4197,42 @@
switch (ir.reg >> 4)
{
case 0:
+ if (record_arch_list_add_mem (addr, 4))
+ return -1;
+ if (3 == (ir.reg & 7))
+ {
+ /* FSTP m32fp */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
+ break;
case 1:
if (record_arch_list_add_mem (addr, 4))
return -1;
+ if ((3 == (ir.reg & 7)) || (5 == (ir.reg & 7)) || (7 == (ir.reg & 7)))
+ {
+ /* FSTP */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
break;
case 2:
if (record_arch_list_add_mem (addr, 8))
return -1;
+ if (3 == (ir.reg & 7))
+ {
+ /* FSTP m64fp */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
break;
case 3:
+ if ((3 <= (ir.reg & 7)) && (6 <= (ir.reg & 7)))
+ {
+ /* FISTP, FBLD, FILD, FBSTP */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
default:
if (record_arch_list_add_mem (addr, 2))
return -1;
@@ -4147,54 +4241,71 @@
break;
}
break;
- case 0x0c:
- case 0x0d:
- case 0x1d:
- case 0x2c:
- case 0x3c:
- case 0x3d:
- break;
- case 0x0e:
+ case 0x0c:
+ /* FLDENV */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_ENV_REG_STACK))
+ return -1;
+ break;
+ case 0x0d:
+ /* FLDCW */
+ if (i386_record_floats(&ir, I386_FCTRL))
+ return -1;
+ break;
+ case 0x2c:
+ /* FRTSTOR */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_ENV_REG_STACK))
+ return -1;
+ break;
+ case 0x0e:
if (ir.dflag)
{
- if (record_arch_list_add_mem (addr, 28))
- return -1;
+ if (record_arch_list_add_mem (addr, 28))
+ return -1;
}
else
{
- if (record_arch_list_add_mem (addr, 14))
- return -1;
+ if (record_arch_list_add_mem (addr, 14))
+ return -1;
}
break;
- case 0x0f:
- case 0x2f:
+ case 0x0f:
+ case 0x2f:
if (record_arch_list_add_mem (addr, 2))
return -1;
break;
- case 0x1f:
- case 0x3e:
+ case 0x1f:
+ case 0x3e:
if (record_arch_list_add_mem (addr, 10))
return -1;
+ /* FSTP, FBSTP */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
break;
- case 0x2e:
+ case 0x2e:
if (ir.dflag)
{
- if (record_arch_list_add_mem (addr, 28))
- return -1;
- addr += 28;
+ if (record_arch_list_add_mem (addr, 28))
+ return -1;
+ addr += 28;
}
else
{
- if (record_arch_list_add_mem (addr, 14))
- return -1;
- addr += 14;
+ if (record_arch_list_add_mem (addr, 14))
+ return -1;
+ addr += 14;
}
if (record_arch_list_add_mem (addr, 80))
return -1;
+ /* FSAVE */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_ENV_REG_STACK))
+ return -1;
break;
- case 0x3f:
+ case 0x3f:
if (record_arch_list_add_mem (addr, 8))
return -1;
+ /* FISTP */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
break;
default:
ir.addr -= 2;
@@ -4202,9 +4313,180 @@
goto no_support;
break;
}
- }
+ }
+ /* opcode is an extension of modR/M byte */
+ else
+ {
+ switch (opcode)
+ {
+ case 0xd8:
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ break;
+ case 0xd9:
+ if (0x0c == (ir.modrm >> 4))
+ {
+ if ((ir.modrm & 0x0f) <= 7)
+ {
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
+ else
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ /* if only st(0) is changing, then we have already recorded */
+ if ((ir.modrm & 0x0f) - 0x08)
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm & 0x0f) - 0x08)))
+ return -1;
+ }
+ }
+ }
+ else
+ {
+ switch(ir.modrm)
+ {
+ case 0xe0:
+ case 0xe1:
+ case 0xf0:
+ case 0xf5:
+ case 0xf8:
+ case 0xfa:
+ case 0xfc:
+ case 0xfe:
+ case 0xff:
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ break;
+ case 0xf1:
+ case 0xf2:
+ case 0xf3:
+ case 0xf4:
+ case 0xf6:
+ case 0xf7:
+ case 0xe8:
+ case 0xe9:
+ case 0xea:
+ case 0xeb:
+ case 0xec:
+ case 0xed:
+ case 0xee:
+ case 0xf9:
+ case 0xfb:
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ break;
+ case 0xfd:
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ if (i386_record_floats(&ir, I386_ST1_REGNUM))
+ return -1;
+ break;
+ }
+ }
+ break;
+ case 0xda:
+ if (0xe9 == ir.modrm)
+ {
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
+ else if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4))
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ if (((ir.modrm & 0x0f) > 0) && ((ir.modrm & 0x0f) <= 7))
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm & 0x0f)))
+ return -1;
+ }
+ else if ((ir.modrm & 0x0f) - 0x08)
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm & 0x0f) - 0x08)))
+ return -1;
+ }
+ }
+ break;
+ case 0xdb:
+ if (0xe3 == ir.modrm)
+ {
+ if (i386_record_floats(&ir, I386_SAVE_FPU_ENV))
+ return -1;
+ }
+ else if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4))
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ if (((ir.modrm & 0x0f) > 0) && ((ir.modrm & 0x0f) <= 7))
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm & 0x0f)))
+ return -1;
+ }
+ else if ((ir.modrm & 0x0f) - 0x08)
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm & 0x0f) - 0x08)))
+ return -1;
+ }
+ }
+ break;
+ case 0xdc:
+ if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4) || (0x0f == ir.modrm >> 4))
+ {
+ if ((ir.modrm & 0x0f) <= 7)
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm & 0x0f)))
+ return -1;
+ }
+ else
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm & 0x0f) - 0x08)))
+ return -1;
+ }
+ }
+ break;
+ case 0xdd:
+ if (0x0c == ir.modrm >> 4)
+ {
+ if (i386_record_floats(&ir,I386_FTAG))
+ return -1;
+ }
+ else if ((0x0d == ir.modrm >> 4) || (0x0e == ir.modrm >> 4))
+ {
+ if ((ir.modrm & 0x0f) <= 7)
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm & 0x0f)))
+ return -1;
+ }
+ else
+ {
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
+ }
+ break;
+ case 0xde:
+ if ((0x0c == ir.modrm >> 4) || (0x0e == ir.modrm >> 4) || (0x0f == ir.modrm >> 4) || (0xd9 == ir.modrm))
+ {
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
+ break;
+ case 0xdf:
+ if (0xe0 == ir.modrm)
+ {
+ if (record_arch_list_add_reg (ir.regcache, I386_EAX_REGNUM))
+ return -1;
+ }
+ else if ((0x0f == ir.modrm >> 4) || (0x0e == ir.modrm >> 4))
+ {
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
+ break;
+ }
+ }
break;
-
/* string ops */
/* movsS */
case 0xa4:
@@ -4623,10 +4905,17 @@
/* fwait */
/* XXX */
case 0x9b:
- printf_unfiltered (_("Process record doesn't support instruction "
- "fwait.\n"));
- ir.addr -= 1;
- goto no_support;
+ if (target_read_memory (ir.addr, &tmpu8, 1))
+ {
+ if (record_debug)
+ printf_unfiltered (_("Process record: error reading memory at "
+ "addr 0x%s len = 1.\n"),
+ paddr_nz (ir.addr));
+ return -1;
+ }
+ opcode = (uint32_t) tmpu8;
+ ir.addr++;
+ goto reswitch;
break;
/* int3 */
diff -urN gdb.orig/i386-tdep.h gdb.new/i386-tdep.h
--- gdb.orig/i386-tdep.h 2009-05-17 17:56:44.000000000 -0400
+++ gdb.new/i386-tdep.h 2009-05-31 16:33:14.000000000 -0400
@@ -145,7 +145,22 @@
I386_ES_REGNUM, /* %es */
I386_FS_REGNUM, /* %fs */
I386_GS_REGNUM, /* %gs */
- I386_ST0_REGNUM /* %st(0) */
+ I386_ST0_REGNUM, /* %st(0) */
+ I386_ST1_REGNUM, /* %st(1) */
+ I386_ST2_REGNUM, /* %st(2) */
+ I386_ST3_REGNUM, /* %st(3) */
+ I386_ST4_REGNUM, /* %st(4) */
+ I386_ST5_REGNUM, /* %st(5) */
+ I386_ST6_REGNUM, /* %st(6) */
+ I386_ST7_REGNUM, /* %st(7) */
+ I386_FCTRL, /* floating point env regs : FCTRL-FOP */
+ I386_FSTAT,
+ I386_FTAG,
+ I386_FISEG,
+ I386_FIOFF,
+ I386_FOSEG,
+ I386_FOOFF,
+ I386_FOP
};
#define I386_NUM_GREGS 16
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: Submition of i386.record.floating.point.patch
2009-06-02 17:58 paawan oza
@ 2009-06-03 2:58 ` Hui Zhu
0 siblings, 0 replies; 28+ messages in thread
From: Hui Zhu @ 2009-06-03 2:58 UTC (permalink / raw)
To: paawan oza; +Cc: gdb-patches
On Wed, Jun 3, 2009 at 01:58, paawan oza <paawan1982@yahoo.com> wrote:
> Hi Hui,
>
> I think, you have applied the old patch which I had sent earlier with in tar format.
> the correct patch was in the email body.
>
> I am attaching correct patch, please find it attached.
> the patch is tested against the example program which I have sent.
>
OK. It works.
Could you post some example about howto make sure it works OK?
>
>
> --- On Tue, 6/2/09, Hui Zhu <teawater@gmail.com> wrote:
>
>> From: Hui Zhu <teawater@gmail.com>
>> Subject: Re: Submition of i386.record.floating.point.patch
>> To: "paawan oza" <paawan1982@yahoo.com>
>> Cc: gdb-patches@sourceware.org
>> Date: Tuesday, June 2, 2009, 12:27 PM
>> On Mon, Jun 1, 2009 at 22:54, paawan
>> oza <paawan1982@yahoo.com>
>> wrote:
>> >
>> > Hi,
>> >
>> > I am sorry for the inconvenience caused last time,
>> during patch submition.
>> > this time I am trying to post everything in email
>> body.
>> >
>> >
>> ******************************************************
>> > ChangeLog:
>> >
>> ******************************************************
>> > Current: gdb-6.8.50.20090531
>> > 2009-05-31 Oza <paawan1982@yahoo.com>
>> >
>> > * i386-tdep.c: Support for floating point
>> recording.
>> > * i386-tdep.h: floating point registers
>> enumaration added.
>> >
>> -------------------------------------------------------
>> >
>> >
>> ******************************************************
>> > README:
>> >
>> ******************************************************
>> > Patch description:
>> >
>> > -> Provides floating point support for i386
>> (reversible debugging:record-replay)
>> > -> previously gdb was not recording floating point
>> registers, now all the floating point registers which are
>> likely to be changed by floating point instructions, are
>> recorded and replayed.
>> > -> the patch intends to provide the full support
>> for all i386 floating point instructions.
>> >
>> ---------------------------------------------------------
>> >
>> >
>> >
>> >
>> ******************************************************
>> > Patch:i386-record-floats.patch
>> >
>> ******************************************************
>> > diff -urN gdb.orig/i386-tdep.c gdb.new/i386-tdep.c
>> > --- gdb.orig/i386-tdep.c 2009-05-29
>> 17:08:40.000000000 -0400
>> > +++ gdb.new/i386-tdep.c 2009-06-01 20:02:23.000000000
>> -0400
>> > @@ -543,6 +543,9 @@
>> > /* The maximum number of saved registers. This
>> should include all
>> > registers mentioned above, and %eip. */
>> > #define I386_NUM_SAVED_REGS I386_NUM_GREGS
>> > +#define I386_SAVE_FPU_REGS 0xFFFD
>> > +#define I386_SAVE_FPU_ENV 0xFFFE
>> > +#define I386_SAVE_FPU_ENV_REG_STACK 0xFFFF
>> >
>> > struct i386_frame_cache
>> > {
>> > @@ -2985,6 +2988,54 @@
>> > return 0;
>> > }
>> >
>> > +/* Record the value of floating point registers which
>> will be changed by the current instruction
>> > + to "record_arch_list".
>> > + return -1 if something is wrong. */
>> > +
>> > +static int i386_record_floats(struct i386_record_s
>> *ir, uint32_t iregnum)
>> > +{
>> > + int i;
>> > +
>> > + /* Oza : push/pop of fpu stack is going to happen
>> > + currently we store st0-st7 registers, but we
>> need not store all registers all the time.
>> > + using fstatus, we use 11-13 bits which gives
>> us stack top and hence we optimize our storage. */
>> > + if (I386_SAVE_FPU_REGS == iregnum)
>> > + {
>> > + for
>> (i=I386_ST0_REGNUM;i<=I386_ST7_REGNUM;i++)
>> > + {
>> > + if (record_arch_list_add_reg
>> (ir->regcache,i))
>> > + return -1;
>> > + }
>> > + }
>> > + else if (I386_SAVE_FPU_ENV == iregnum)
>> > + {
>> > + for (i=I386_FCTRL;i<=I386_FOP;i++)
>> > + {
>> > + if (record_arch_list_add_reg
>> (ir->regcache,i))
>> > + return -1;
>> > + }
>> > + }
>> > + else if (I386_SAVE_FPU_ENV_REG_STACK == iregnum)
>> > + {
>> > + for (i=I386_ST0_REGNUM;i<=I386_FOP;i++)
>> > + {
>> > + if (record_arch_list_add_reg
>> (ir->regcache,i))
>> > + return -1;
>> > + }
>> > + }
>> > + else if (iregnum >= I386_ST0_REGNUM &&
>> iregnum <= I386_FOP)
>> > + {
>> > + if (record_arch_list_add_reg
>> (ir->regcache,iregnum))
>> > + return -1;
>> > + }
>> > + else
>> > + {
>> > + /* param Error */
>> > + return -1;
>> > + }
>> > + return 0;
>> > +}
>> > +
>> > /* Parse the current instruction and record the
>> values of the registers and
>> > memory that will be changed in current
>> instruction to "record_arch_list".
>> > Return -1 if something wrong. */
>> > @@ -4035,7 +4086,6 @@
>> > break;
>> >
>> > /* floats */
>> > - /* It just record the memory change of
>> instrcution. */
>> > case 0xd8:
>> > case 0xd9:
>> > case 0xda:
>> > @@ -4056,39 +4106,49 @@
>> > return -1;
>> > switch (ir.reg)
>> > {
>> > - case 0x00:
>> > - case 0x01:
>> > case 0x02:
>> > - case 0x03:
>> > + case 0x12:
>> > + case 0x22:
>> > + case 0x32:
>> > + /* for FCOM, FICOM nothing to do
>> */
>> > + break;
>> > + case 0x03:
>> > + case 0x13:
>> > + case 0x23:
>> > + case 0x33:
>> > + /* FCOMP, FICOMP pop FPU stack,
>> store all */
>> > + if (i386_record_floats(&ir,
>> I386_SAVE_FPU_REGS))
>> > + return -1;
>> > + break;
>> > + case 0x00:
>> > + case 0x01:
>> > case 0x04:
>> > case 0x05:
>> > case 0x06:
>> > case 0x07:
>> > case 0x10:
>> > - case 0x11:
>> > - case 0x12:
>> > - case 0x13:
>> > + case 0x11:
>> > case 0x14:
>> > case 0x15:
>> > case 0x16:
>> > case 0x17:
>> > case 0x20:
>> > case 0x21:
>> > - case 0x22:
>> > - case 0x23:
>> > case 0x24:
>> > case 0x25:
>> > case 0x26:
>> > case 0x27:
>> > case 0x30:
>> > case 0x31:
>> > - case 0x32:
>> > - case 0x33:
>> > case 0x34:
>> > case 0x35:
>> > case 0x36:
>> > case 0x37:
>> > - break;
>> > + /* FADD, FMUL, FSUB, FSUBR, FDIV,
>> FDIVR, FIADD, FIMUL, FISUB, FISUBR, FIDIV, FIDIVR
>> > + ModR/M.reg is an extension of
>> code, always affects st(0) register */
>> > + if (i386_record_floats(&ir,
>> I386_ST0_REGNUM))
>> > + return -1;
>> > + break;
>> > case 0x08:
>> > case 0x0a:
>> > case 0x0b:
>> > @@ -4096,6 +4156,7 @@
>> > case 0x19:
>> > case 0x1a:
>> > case 0x1b:
>> > + case 0x1d:
>> > case 0x28:
>> > case 0x29:
>> > case 0x2a:
>> > @@ -4103,11 +4164,16 @@
>> > case 0x38:
>> > case 0x39:
>> > case 0x3a:
>> > - case 0x3b:
>> > + case 0x3b:
>> > + case 0x3c:
>> > + case 0x3d:
>> > switch (ir.reg & 7)
>> > {
>> > case 0:
>> > - break;
>> > + /* FLD, FILD */
>> > + if
>> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
>> > + return -1;
>> > + break;
>> > case 1:
>> > switch (ir.reg >> 4)
>> > {
>> > @@ -4120,6 +4186,7 @@
>> > return -1;
>> > break;
>> > case 3:
>> > + break;
>> > default:
>> > if
>> (record_arch_list_add_mem (addr, 2))
>> > return -1;
>> > @@ -4130,15 +4197,42 @@
>> > switch (ir.reg >> 4)
>> > {
>> > case 0:
>> > + if
>> (record_arch_list_add_mem (addr, 4))
>> > + return -1;
>> > + if (3 == (ir.reg &
>> 7))
>> > + {
>> > + /* FSTP m32fp */
>> > + if
>> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
>> > + return -1;
>> > + }
>> > + break;
>> > case 1:
>> > if
>> (record_arch_list_add_mem (addr, 4))
>> > return -1;
>> > + if ((3 == (ir.reg
>> & 7)) || (5 == (ir.reg & 7)) || (7 == (ir.reg &
>> 7)))
>> > + {
>> > + /* FSTP */
>> > + if
>> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
>> > + return -1;
>> > + }
>> > break;
>> > case 2:
>> > if
>> (record_arch_list_add_mem (addr, 8))
>> > return -1;
>> > + if (3 == (ir.reg &
>> 7))
>> > + {
>> > + /* FSTP m64fp */
>> > + if
>> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
>> > + return -1;
>> > + }
>> > break;
>> > case 3:
>> > + if ((3 <= (ir.reg
>> & 7)) && (6 <= (ir.reg & 7)))
>> > + {
>> > + /* FISTP, FBLD,
>> FILD, FBSTP */
>> > + if
>> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
>> > + return -1;
>> > + }
>> > default:
>> > if
>> (record_arch_list_add_mem (addr, 2))
>> > return -1;
>> > @@ -4147,54 +4241,71 @@
>> > break;
>> > }
>> > break;
>> > - case 0x0c:
>> > - case 0x0d:
>> > - case 0x1d:
>> > - case 0x2c:
>> > - case 0x3c:
>> > - case 0x3d:
>> > - break;
>> > - case 0x0e:
>> > + case 0x0c:
>> > + /* FLDENV */
>> > + if (i386_record_floats(&ir,
>> I386_SAVE_FPU_ENV_REG_STACK))
>> > + return -1;
>> > + break;
>> > + case 0x0d:
>> > + /* FLDCW */
>> > + if (i386_record_floats(&ir,
>> I386_FCTRL))
>> > + return -1;
>> > + break;
>> > + case 0x2c:
>> > + /* FRTSTOR */
>> > + if (i386_record_floats(&ir,
>> I386_SAVE_FPU_ENV_REG_STACK))
>> > + return -1;
>> > + break;
>> > + case 0x0e:
>> > if (ir.dflag)
>> > {
>> > - if (record_arch_list_add_mem
>> (addr, 28))
>> > - return -1;
>> > + if (record_arch_list_add_mem
>> (addr, 28))
>> > + return -1;
>> > }
>> > else
>> > {
>> > - if (record_arch_list_add_mem
>> (addr, 14))
>> > - return -1;
>> > + if (record_arch_list_add_mem
>> (addr, 14))
>> > + return -1;
>> > }
>> > break;
>> > - case 0x0f:
>> > - case 0x2f:
>> > + case 0x0f:
>> > + case 0x2f:
>> > if (record_arch_list_add_mem
>> (addr, 2))
>> > return -1;
>> > break;
>> > - case 0x1f:
>> > - case 0x3e:
>> > + case 0x1f:
>> > + case 0x3e:
>> > if (record_arch_list_add_mem
>> (addr, 10))
>> > return -1;
>> > + /* FSTP, FBSTP */
>> > + if (i386_record_floats(&ir,
>> I386_SAVE_FPU_REGS))
>> > + return -1;
>> > break;
>> > - case 0x2e:
>> > + case 0x2e:
>> > if (ir.dflag)
>> > {
>> > - if (record_arch_list_add_mem
>> (addr, 28))
>> > - return -1;
>> > - addr += 28;
>> > + if (record_arch_list_add_mem
>> (addr, 28))
>> > + return -1;
>> > + addr += 28;
>> > }
>> > else
>> > {
>> > - if (record_arch_list_add_mem
>> (addr, 14))
>> > - return -1;
>> > - addr += 14;
>> > + if (record_arch_list_add_mem
>> (addr, 14))
>> > + return -1;
>> > + addr += 14;
>> > }
>> > if (record_arch_list_add_mem
>> (addr, 80))
>> > return -1;
>> > + /* FSAVE */
>> > + if (i386_record_floats(&ir,
>> I386_SAVE_FPU_ENV_REG_STACK))
>> > + return -1;
>> > break;
>> > - case 0x3f:
>> > + case 0x3f:
>> > if (record_arch_list_add_mem
>> (addr, 8))
>> > return -1;
>> > + /* FISTP */
>> > + if (i386_record_floats(&ir,
>> I386_SAVE_FPU_REGS))
>> > + return -1;
>> > break;
>> > default:
>> > ir.addr -= 2;
>> > @@ -4202,9 +4313,180 @@
>> > goto no_support;
>> > break;
>> > }
>> > - }
>> > + }
>> > + /* opcode is an extension of modR/M byte
>> */
>> > + else
>> > + {
>> > + switch (opcode)
>> > + {
>> > + case 0xd8:
>> > + if (i386_record_floats(&ir,
>> I386_ST0_REGNUM))
>> > + return -1;
>> > + break;
>> > + case 0xd9:
>> > + if (0x0c == (ir.modrm >>
>> 4))
>> > + {
>> > + if ((ir.modrm & 0x0f)
>> <= 7)
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
>> > + return -1;
>> > + }
>> > + else
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM))
>> > + return -1;
>> > + /* if only st(0) is
>> changing, then we have already recorded */
>> > + if ((ir.modrm &
>> 0x0f) - 0x08)
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm
>> & 0x0f) - 0x08)))
>> > + return -1;
>> > + }
>> > + }
>> > + }
>> > + else
>> > + {
>> > + switch(ir.modrm)
>> > + {
>> > + case 0xe0:
>> > + case 0xe1:
>> > + case 0xf0:
>> > + case 0xf5:
>> > + case 0xf8:
>> > + case 0xfa:
>> > + case 0xfc:
>> > + case 0xfe:
>> > + case 0xff:
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM))
>> > + return -1;
>> > + break;
>> > + case 0xf1:
>> > + case 0xf2:
>> > + case 0xf3:
>> > + case 0xf4:
>> > + case 0xf6:
>> > + case 0xf7:
>> > + case 0xe8:
>> > + case 0xe9:
>> > + case 0xea:
>> > + case 0xeb:
>> > + case 0xec:
>> > + case 0xed:
>> > + case 0xee:
>> > + case 0xf9:
>> > + case 0xfb:
>> > + if
>> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
>> > + return -1;
>> > + break;
>> > + case 0xfd:
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM))
>> > + return -1;
>> > + if
>> (i386_record_floats(&ir, I386_ST1_REGNUM))
>> > + return -1;
>> > + break;
>> > + }
>> > + }
>> > + break;
>> > + case 0xda:
>> > + if (0xe9 == ir.modrm)
>> > + {
>> > + if (i386_record_floats(&ir,
>> I386_SAVE_FPU_REGS))
>> > + return -1;
>> > + }
>> > + else if ((0x0c == ir.modrm
>> >> 4) || (0x0d == ir.modrm >> 4))
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM))
>> > + return -1;
>> > + if (((ir.modrm & 0x0f)
>> > 0) && ((ir.modrm & 0x0f) <= 7))
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm
>> & 0x0f)))
>> > + return -1;
>> > + }
>> > + else if ((ir.modrm &
>> 0x0f) - 0x08)
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm
>> & 0x0f) - 0x08)))
>> > + return -1;
>> > + }
>> > + }
>> > + break;
>> > + case 0xdb:
>> > + if (0xe3 == ir.modrm)
>> > + {
>> > + if (i386_record_floats(&ir,
>> I386_SAVE_FPU_ENV))
>> > + return -1;
>> > + }
>> > + else if ((0x0c == ir.modrm
>> >> 4) || (0x0d == ir.modrm >> 4))
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM))
>> > + return -1;
>> > + if (((ir.modrm & 0x0f)
>> > 0) && ((ir.modrm & 0x0f) <= 7))
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm
>> & 0x0f)))
>> > + return -1;
>> > + }
>> > + else if ((ir.modrm &
>> 0x0f) - 0x08)
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm
>> & 0x0f) - 0x08)))
>> > + return -1;
>> > + }
>> > + }
>> > + break;
>> > + case 0xdc:
>> > + if ((0x0c == ir.modrm >>
>> 4) || (0x0d == ir.modrm >> 4) || (0x0f == ir.modrm
>> >> 4))
>> > + {
>> > + if ((ir.modrm & 0x0f)
>> <= 7)
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm
>> & 0x0f)))
>> > + return -1;
>> > + }
>> > + else
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm
>> & 0x0f) - 0x08)))
>> > + return -1;
>> > + }
>> > + }
>> > + break;
>> > + case 0xdd:
>> > + if (0x0c == ir.modrm >>
>> 4)
>> > + {
>> > + if
>> (i386_record_floats(&ir,I386_FTAG))
>> > + return -1;
>> > + }
>> > + else if ((0x0d == ir.modrm
>> >> 4) || (0x0e == ir.modrm >> 4))
>> > + {
>> > + if ((ir.modrm & 0x0f)
>> <= 7)
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm
>> & 0x0f)))
>> > + return -1;
>> > + }
>> > + else
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
>> > + return -1;
>> > + }
>> > + }
>> > + break;
>> > + case 0xde:
>> > + if ((0x0c == ir.modrm >>
>> 4) || (0x0e == ir.modrm >> 4) || (0x0f == ir.modrm
>> >> 4) || (0xd9 == ir.modrm))
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
>> > + return -1;
>> > + }
>> > + break;
>> > + case 0xdf:
>> > + if (0xe0 == ir.modrm)
>> > + {
>> > + if
>> (record_arch_list_add_reg (ir.regcache, I386_EAX_REGNUM))
>> > + return -1;
>> > + }
>> > + else if ((0x0f == ir.modrm
>> >> 4) || (0x0e == ir.modrm >> 4))
>> > + {
>> > + if
>> (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
>> > + return -1;
>> > + }
>> > + break;
>> > + }
>> > + }
>> > break;
>> > -
>> > /* string ops */
>> > /* movsS */
>> > case 0xa4:
>> > @@ -4623,10 +4905,17 @@
>> > /* fwait */
>> > /* XXX */
>> > case 0x9b:
>> > - printf_unfiltered (_("Process record doesn't
>> support instruction "
>> > - "fwait.\n"));
>> > - ir.addr -= 1;
>> > - goto no_support;
>> > + if (target_read_memory (ir.addr, &tmpu8,
>> 1))
>> > + {
>> > + if (record_debug)
>> > + printf_unfiltered (_("Process record:
>> error reading memory at "
>> > + "addr
>> 0x%s len = 1.\n"),
>> > + paddr_nz
>> (ir.addr));
>> > + return -1;
>> > + }
>> > + opcode = (uint32_t) tmpu8;
>> > + ir.addr++;
>> > + goto reswitch;
>> > break;
>> >
>> > /* int3 */
>> > diff -urN gdb.orig/i386-tdep.h gdb.new/i386-tdep.h
>> > --- gdb.orig/i386-tdep.h 2009-05-17
>> 17:56:44.000000000 -0400
>> > +++ gdb.new/i386-tdep.h 2009-05-31 16:33:14.000000000
>> -0400
>> > @@ -145,7 +145,22 @@
>> > I386_ES_REGNUM, /* %es */
>> > I386_FS_REGNUM, /* %fs */
>> > I386_GS_REGNUM, /* %gs */
>> > - I386_ST0_REGNUM /* %st(0) */
>> > + I386_ST0_REGNUM, /* %st(0) */
>> > + I386_ST1_REGNUM, /* %st(1) */
>> > + I386_ST2_REGNUM, /* %st(2) */
>> > + I386_ST3_REGNUM, /* %st(3) */
>> > + I386_ST4_REGNUM, /* %st(4) */
>> > + I386_ST5_REGNUM, /* %st(5) */
>> > + I386_ST6_REGNUM, /* %st(6) */
>> > + I386_ST7_REGNUM, /* %st(7) */
>> > + I386_FCTRL, /* floating
>> point env regs : FCTRL-FOP */
>> > + I386_FSTAT,
>> > + I386_FTAG,
>> > + I386_FISEG,
>> > + I386_FIOFF,
>> > + I386_FOSEG,
>> > + I386_FOOFF,
>> > + I386_FOP
>> > };
>> >
>>
>> About this part, I think this is my mistake. I didn't
>> take fp work
>> for now very clear (Or I am still not clear with x86 fp).
>> FCTRL, FOP and so on are the fp reg of amd64. For
>> now, prec is still
>> not support amd64 (I am working on it).
>> And amd64's support are in amd64-tedp.... files.
>> Change i386_regnum
>> is not a good idea.
>>
>> I suggest you divide fp patch to 2 parts. One is for i386,
>> the other for amd64.
>> For now, just send i386 patch for review. And send
>> amd64 patch when
>> prec support amd64.
>>
What do you think about my idea?
Thanks,
Hui
>>
>>
>> > #define I386_NUM_GREGS 16
>> >
>> >
>> >
>> >
>> >
>> *******************************************************
>> > test-example which does basic verification for the
>> patch.
>> >
>> *******************************************************
>> >
>> > #include <stdio.h>
>> > #include <math.h>
>> >
>> > int main()
>> > {
>> > float no1,no2,no3,no4,no5,no6,no7;
>> > double x = 100.345, y = 25.7789;
>> > long double ldx = 88888888888888888888.88,
>> ldy = 9999999999999999999.99;
>> > float result,resultd,resultld;
>> > no1 = 10.45;
>> > no2 = 20.77;
>> > no3 = 156.89874646;
>> > no4 = 14.56;
>> > no5 = 11.11;
>> > no6 = 66.77;
>> > no7 = 88.88;
>> >
>> > result = no1 + no2 + no3 + no4 + no5 + no6
>> + no7;
>> > printf("result is %f\n",result);
>> >
>> > result = fmodf(no2,no1);
>> > printf("result is %f\n",result);
>> >
>> > resultd = fmod(x,y);
>> > printf("result is %f\n",resultd);
>> >
>> > resultld = fmodl(ldy,ldy);
>> > printf("result is %f\n",resultld);
>> >
>> > result = fabsf(no1);
>> > printf("result is %f\n",result);
>> >
>> > result = no3 / no4;
>> > printf("result is %f\n",result);
>> >
>> > result = no1 * no2 * no3 * no4;
>> > printf("result is %f\n",result);
>> >
>> > result = sin(30);
>> > printf("result is %f\n",result);
>> >
>> > result = cos(30);
>> > printf("result is %f\n",result);
>> >
>> > result = tan(30);
>> > printf("result is %f\n",result);
>> >
>> > result = atan(30);
>> > printf("result is %f\n",result);
>> >
>> > result = sqrt(no3);
>> > printf("result is %f\n",result);
>> >
>> > result = log10(no3);
>> > printf("result is %f\n",result);
>> >
>> > result = log(no3);
>> > printf("result is %f\n",result);
>> >
>> > result = exp10(no3);
>> > printf("result is %f\n",result);
>> >
>> > result = exp(no3);
>> > printf("result is %f\n",result);
>> >
>> > ldy = 88888888888888888888.88;
>> > if (ldx == ldy)
>> > ldy = 7777777777777777777777777777.777;
>> > else
>> > ldy = 666666666666666666666666666.666;
>> >
>> > }
>>
>> With this example, what I got is:
>> gdb ./a.out
>> GNU gdb (GDB) 6.8.50.20090602-cvs
>> Copyright (C) 2009 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
>> 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:
>> <http://www.gnu.org/software/gdb/bugs/>...
>> 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/bgdb/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 0x8048608: file 1.c, line 7.
>> Starting program: /home/teawater/gdb/bgdb/gdb/a.out
>>
>> Temporary breakpoint 1, main () at 1.c:7
>> 7 double
>> x = 100.345, y = 25.7789;
>> (gdb) record
>> (gdb) c
>> Continuing.
>> result is 369.438751
>> Process record doesn't support instruction fwait.
>> Process record doesn't support instruction 0x9b at address
>> 0xb7fa35fa.
>> Process record: failed to record execution log.
>>
>> Program received signal SIGTRAP, Trace/breakpoint trap.
>> 0xb7fa35fa in ?? () from /lib/tls/i686/cmov/libm.so.6
>> (gdb)
>>
>>
>> Thanks,
>> Hui
>>
>
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Submition of i386.record.floating.point.patch
@ 2009-06-01 14:55 paawan oza
2009-06-02 6:58 ` Hui Zhu
0 siblings, 1 reply; 28+ messages in thread
From: paawan oza @ 2009-06-01 14:55 UTC (permalink / raw)
To: gdb-patches; +Cc: Hui Zhu
Hi,
I am sorry for the inconvenience caused last time, during patch submition.
this time I am trying to post everything in email body.
******************************************************
ChangeLog:
******************************************************
Current: gdb-6.8.50.20090531
2009-05-31 Oza <paawan1982@yahoo.com>
* i386-tdep.c: Support for floating point recording.
* i386-tdep.h: floating point registers enumaration added.
-------------------------------------------------------
******************************************************
README:
******************************************************
Patch description:
-> Provides floating point support for i386 (reversible debugging:record-replay)
-> previously gdb was not recording floating point registers, now all the floating point registers which are likely to be changed by floating point instructions, are recorded and replayed.
-> the patch intends to provide the full support for all i386 floating point instructions.
---------------------------------------------------------
******************************************************
Patch:i386-record-floats.patch
******************************************************
diff -urN gdb.orig/i386-tdep.c gdb.new/i386-tdep.c
--- gdb.orig/i386-tdep.c 2009-05-29 17:08:40.000000000 -0400
+++ gdb.new/i386-tdep.c 2009-06-01 20:02:23.000000000 -0400
@@ -543,6 +543,9 @@
/* The maximum number of saved registers. This should include all
registers mentioned above, and %eip. */
#define I386_NUM_SAVED_REGS I386_NUM_GREGS
+#define I386_SAVE_FPU_REGS 0xFFFD
+#define I386_SAVE_FPU_ENV 0xFFFE
+#define I386_SAVE_FPU_ENV_REG_STACK 0xFFFF
struct i386_frame_cache
{
@@ -2985,6 +2988,54 @@
return 0;
}
+/* Record the value of floating point registers which will be changed by the current instruction
+ to "record_arch_list".
+ return -1 if something is wrong. */
+
+static int i386_record_floats(struct i386_record_s *ir, uint32_t iregnum)
+{
+ int i;
+
+ /* Oza : push/pop of fpu stack is going to happen
+ currently we store st0-st7 registers, but we need not store all registers all the time.
+ using fstatus, we use 11-13 bits which gives us stack top and hence we optimize our storage. */
+ if (I386_SAVE_FPU_REGS == iregnum)
+ {
+ for (i=I386_ST0_REGNUM;i<=I386_ST7_REGNUM;i++)
+ {
+ if (record_arch_list_add_reg (ir->regcache,i))
+ return -1;
+ }
+ }
+ else if (I386_SAVE_FPU_ENV == iregnum)
+ {
+ for (i=I386_FCTRL;i<=I386_FOP;i++)
+ {
+ if (record_arch_list_add_reg (ir->regcache,i))
+ return -1;
+ }
+ }
+ else if (I386_SAVE_FPU_ENV_REG_STACK == iregnum)
+ {
+ for (i=I386_ST0_REGNUM;i<=I386_FOP;i++)
+ {
+ if (record_arch_list_add_reg (ir->regcache,i))
+ return -1;
+ }
+ }
+ else if (iregnum >= I386_ST0_REGNUM && iregnum <= I386_FOP)
+ {
+ if (record_arch_list_add_reg (ir->regcache,iregnum))
+ return -1;
+ }
+ else
+ {
+ /* param Error */
+ return -1;
+ }
+ return 0;
+}
+
/* Parse the current instruction and record the values of the registers and
memory that will be changed in current instruction to "record_arch_list".
Return -1 if something wrong. */
@@ -4035,7 +4086,6 @@
break;
/* floats */
- /* It just record the memory change of instrcution. */
case 0xd8:
case 0xd9:
case 0xda:
@@ -4056,39 +4106,49 @@
return -1;
switch (ir.reg)
{
- case 0x00:
- case 0x01:
case 0x02:
- case 0x03:
+ case 0x12:
+ case 0x22:
+ case 0x32:
+ /* for FCOM, FICOM nothing to do */
+ break;
+ case 0x03:
+ case 0x13:
+ case 0x23:
+ case 0x33:
+ /* FCOMP, FICOMP pop FPU stack, store all */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ break;
+ case 0x00:
+ case 0x01:
case 0x04:
case 0x05:
case 0x06:
case 0x07:
case 0x10:
- case 0x11:
- case 0x12:
- case 0x13:
+ case 0x11:
case 0x14:
case 0x15:
case 0x16:
case 0x17:
case 0x20:
case 0x21:
- case 0x22:
- case 0x23:
case 0x24:
case 0x25:
case 0x26:
case 0x27:
case 0x30:
case 0x31:
- case 0x32:
- case 0x33:
case 0x34:
case 0x35:
case 0x36:
case 0x37:
- break;
+ /* FADD, FMUL, FSUB, FSUBR, FDIV, FDIVR, FIADD, FIMUL, FISUB, FISUBR, FIDIV, FIDIVR
+ ModR/M.reg is an extension of code, always affects st(0) register */
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ break;
case 0x08:
case 0x0a:
case 0x0b:
@@ -4096,6 +4156,7 @@
case 0x19:
case 0x1a:
case 0x1b:
+ case 0x1d:
case 0x28:
case 0x29:
case 0x2a:
@@ -4103,11 +4164,16 @@
case 0x38:
case 0x39:
case 0x3a:
- case 0x3b:
+ case 0x3b:
+ case 0x3c:
+ case 0x3d:
switch (ir.reg & 7)
{
case 0:
- break;
+ /* FLD, FILD */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ break;
case 1:
switch (ir.reg >> 4)
{
@@ -4120,6 +4186,7 @@
return -1;
break;
case 3:
+ break;
default:
if (record_arch_list_add_mem (addr, 2))
return -1;
@@ -4130,15 +4197,42 @@
switch (ir.reg >> 4)
{
case 0:
+ if (record_arch_list_add_mem (addr, 4))
+ return -1;
+ if (3 == (ir.reg & 7))
+ {
+ /* FSTP m32fp */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
+ break;
case 1:
if (record_arch_list_add_mem (addr, 4))
return -1;
+ if ((3 == (ir.reg & 7)) || (5 == (ir.reg & 7)) || (7 == (ir.reg & 7)))
+ {
+ /* FSTP */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
break;
case 2:
if (record_arch_list_add_mem (addr, 8))
return -1;
+ if (3 == (ir.reg & 7))
+ {
+ /* FSTP m64fp */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
break;
case 3:
+ if ((3 <= (ir.reg & 7)) && (6 <= (ir.reg & 7)))
+ {
+ /* FISTP, FBLD, FILD, FBSTP */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
default:
if (record_arch_list_add_mem (addr, 2))
return -1;
@@ -4147,54 +4241,71 @@
break;
}
break;
- case 0x0c:
- case 0x0d:
- case 0x1d:
- case 0x2c:
- case 0x3c:
- case 0x3d:
- break;
- case 0x0e:
+ case 0x0c:
+ /* FLDENV */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_ENV_REG_STACK))
+ return -1;
+ break;
+ case 0x0d:
+ /* FLDCW */
+ if (i386_record_floats(&ir, I386_FCTRL))
+ return -1;
+ break;
+ case 0x2c:
+ /* FRTSTOR */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_ENV_REG_STACK))
+ return -1;
+ break;
+ case 0x0e:
if (ir.dflag)
{
- if (record_arch_list_add_mem (addr, 28))
- return -1;
+ if (record_arch_list_add_mem (addr, 28))
+ return -1;
}
else
{
- if (record_arch_list_add_mem (addr, 14))
- return -1;
+ if (record_arch_list_add_mem (addr, 14))
+ return -1;
}
break;
- case 0x0f:
- case 0x2f:
+ case 0x0f:
+ case 0x2f:
if (record_arch_list_add_mem (addr, 2))
return -1;
break;
- case 0x1f:
- case 0x3e:
+ case 0x1f:
+ case 0x3e:
if (record_arch_list_add_mem (addr, 10))
return -1;
+ /* FSTP, FBSTP */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
break;
- case 0x2e:
+ case 0x2e:
if (ir.dflag)
{
- if (record_arch_list_add_mem (addr, 28))
- return -1;
- addr += 28;
+ if (record_arch_list_add_mem (addr, 28))
+ return -1;
+ addr += 28;
}
else
{
- if (record_arch_list_add_mem (addr, 14))
- return -1;
- addr += 14;
+ if (record_arch_list_add_mem (addr, 14))
+ return -1;
+ addr += 14;
}
if (record_arch_list_add_mem (addr, 80))
return -1;
+ /* FSAVE */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_ENV_REG_STACK))
+ return -1;
break;
- case 0x3f:
+ case 0x3f:
if (record_arch_list_add_mem (addr, 8))
return -1;
+ /* FISTP */
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
break;
default:
ir.addr -= 2;
@@ -4202,9 +4313,180 @@
goto no_support;
break;
}
- }
+ }
+ /* opcode is an extension of modR/M byte */
+ else
+ {
+ switch (opcode)
+ {
+ case 0xd8:
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ break;
+ case 0xd9:
+ if (0x0c == (ir.modrm >> 4))
+ {
+ if ((ir.modrm & 0x0f) <= 7)
+ {
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
+ else
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ /* if only st(0) is changing, then we have already recorded */
+ if ((ir.modrm & 0x0f) - 0x08)
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm & 0x0f) - 0x08)))
+ return -1;
+ }
+ }
+ }
+ else
+ {
+ switch(ir.modrm)
+ {
+ case 0xe0:
+ case 0xe1:
+ case 0xf0:
+ case 0xf5:
+ case 0xf8:
+ case 0xfa:
+ case 0xfc:
+ case 0xfe:
+ case 0xff:
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ break;
+ case 0xf1:
+ case 0xf2:
+ case 0xf3:
+ case 0xf4:
+ case 0xf6:
+ case 0xf7:
+ case 0xe8:
+ case 0xe9:
+ case 0xea:
+ case 0xeb:
+ case 0xec:
+ case 0xed:
+ case 0xee:
+ case 0xf9:
+ case 0xfb:
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ break;
+ case 0xfd:
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ if (i386_record_floats(&ir, I386_ST1_REGNUM))
+ return -1;
+ break;
+ }
+ }
+ break;
+ case 0xda:
+ if (0xe9 == ir.modrm)
+ {
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
+ else if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4))
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ if (((ir.modrm & 0x0f) > 0) && ((ir.modrm & 0x0f) <= 7))
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm & 0x0f)))
+ return -1;
+ }
+ else if ((ir.modrm & 0x0f) - 0x08)
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm & 0x0f) - 0x08)))
+ return -1;
+ }
+ }
+ break;
+ case 0xdb:
+ if (0xe3 == ir.modrm)
+ {
+ if (i386_record_floats(&ir, I386_SAVE_FPU_ENV))
+ return -1;
+ }
+ else if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4))
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM))
+ return -1;
+ if (((ir.modrm & 0x0f) > 0) && ((ir.modrm & 0x0f) <= 7))
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm & 0x0f)))
+ return -1;
+ }
+ else if ((ir.modrm & 0x0f) - 0x08)
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm & 0x0f) - 0x08)))
+ return -1;
+ }
+ }
+ break;
+ case 0xdc:
+ if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4) || (0x0f == ir.modrm >> 4))
+ {
+ if ((ir.modrm & 0x0f) <= 7)
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm & 0x0f)))
+ return -1;
+ }
+ else
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm & 0x0f) - 0x08)))
+ return -1;
+ }
+ }
+ break;
+ case 0xdd:
+ if (0x0c == ir.modrm >> 4)
+ {
+ if (i386_record_floats(&ir,I386_FTAG))
+ return -1;
+ }
+ else if ((0x0d == ir.modrm >> 4) || (0x0e == ir.modrm >> 4))
+ {
+ if ((ir.modrm & 0x0f) <= 7)
+ {
+ if (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm & 0x0f)))
+ return -1;
+ }
+ else
+ {
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
+ }
+ break;
+ case 0xde:
+ if ((0x0c == ir.modrm >> 4) || (0x0e == ir.modrm >> 4) || (0x0f == ir.modrm >> 4) || (0xd9 == ir.modrm))
+ {
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
+ break;
+ case 0xdf:
+ if (0xe0 == ir.modrm)
+ {
+ if (record_arch_list_add_reg (ir.regcache, I386_EAX_REGNUM))
+ return -1;
+ }
+ else if ((0x0f == ir.modrm >> 4) || (0x0e == ir.modrm >> 4))
+ {
+ if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
+ return -1;
+ }
+ break;
+ }
+ }
break;
-
/* string ops */
/* movsS */
case 0xa4:
@@ -4623,10 +4905,17 @@
/* fwait */
/* XXX */
case 0x9b:
- printf_unfiltered (_("Process record doesn't support instruction "
- "fwait.\n"));
- ir.addr -= 1;
- goto no_support;
+ if (target_read_memory (ir.addr, &tmpu8, 1))
+ {
+ if (record_debug)
+ printf_unfiltered (_("Process record: error reading memory at "
+ "addr 0x%s len = 1.\n"),
+ paddr_nz (ir.addr));
+ return -1;
+ }
+ opcode = (uint32_t) tmpu8;
+ ir.addr++;
+ goto reswitch;
break;
/* int3 */
diff -urN gdb.orig/i386-tdep.h gdb.new/i386-tdep.h
--- gdb.orig/i386-tdep.h 2009-05-17 17:56:44.000000000 -0400
+++ gdb.new/i386-tdep.h 2009-05-31 16:33:14.000000000 -0400
@@ -145,7 +145,22 @@
I386_ES_REGNUM, /* %es */
I386_FS_REGNUM, /* %fs */
I386_GS_REGNUM, /* %gs */
- I386_ST0_REGNUM /* %st(0) */
+ I386_ST0_REGNUM, /* %st(0) */
+ I386_ST1_REGNUM, /* %st(1) */
+ I386_ST2_REGNUM, /* %st(2) */
+ I386_ST3_REGNUM, /* %st(3) */
+ I386_ST4_REGNUM, /* %st(4) */
+ I386_ST5_REGNUM, /* %st(5) */
+ I386_ST6_REGNUM, /* %st(6) */
+ I386_ST7_REGNUM, /* %st(7) */
+ I386_FCTRL, /* floating point env regs : FCTRL-FOP */
+ I386_FSTAT,
+ I386_FTAG,
+ I386_FISEG,
+ I386_FIOFF,
+ I386_FOSEG,
+ I386_FOOFF,
+ I386_FOP
};
#define I386_NUM_GREGS 16
*******************************************************
test-example which does basic verification for the patch.
*******************************************************
#include <stdio.h>
#include <math.h>
int main()
{
float no1,no2,no3,no4,no5,no6,no7;
double x = 100.345, y = 25.7789;
long double ldx = 88888888888888888888.88, ldy = 9999999999999999999.99;
float result,resultd,resultld;
no1 = 10.45;
no2 = 20.77;
no3 = 156.89874646;
no4 = 14.56;
no5 = 11.11;
no6 = 66.77;
no7 = 88.88;
result = no1 + no2 + no3 + no4 + no5 + no6 + no7;
printf("result is %f\n",result);
result = fmodf(no2,no1);
printf("result is %f\n",result);
resultd = fmod(x,y);
printf("result is %f\n",resultd);
resultld = fmodl(ldy,ldy);
printf("result is %f\n",resultld);
result = fabsf(no1);
printf("result is %f\n",result);
result = no3 / no4;
printf("result is %f\n",result);
result = no1 * no2 * no3 * no4;
printf("result is %f\n",result);
result = sin(30);
printf("result is %f\n",result);
result = cos(30);
printf("result is %f\n",result);
result = tan(30);
printf("result is %f\n",result);
result = atan(30);
printf("result is %f\n",result);
result = sqrt(no3);
printf("result is %f\n",result);
result = log10(no3);
printf("result is %f\n",result);
result = log(no3);
printf("result is %f\n",result);
result = exp10(no3);
printf("result is %f\n",result);
result = exp(no3);
printf("result is %f\n",result);
ldy = 88888888888888888888.88;
if (ldx == ldy)
ldy = 7777777777777777777777777777.777;
else
ldy = 666666666666666666666666666.666;
}
please send the review comments for the patch.
Regards,
Oza.
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: Submition of i386.record.floating.point.patch
2009-06-01 14:55 paawan oza
@ 2009-06-02 6:58 ` Hui Zhu
2009-06-04 22:18 ` Hui Zhu
0 siblings, 1 reply; 28+ messages in thread
From: Hui Zhu @ 2009-06-02 6:58 UTC (permalink / raw)
To: paawan oza; +Cc: gdb-patches
On Mon, Jun 1, 2009 at 22:54, paawan oza <paawan1982@yahoo.com> wrote:
>
> Hi,
>
> I am sorry for the inconvenience caused last time, during patch submition.
> this time I am trying to post everything in email body.
>
> ******************************************************
> ChangeLog:
> ******************************************************
> Current: gdb-6.8.50.20090531
> 2009-05-31 Oza <paawan1982@yahoo.com>
>
> * i386-tdep.c: Support for floating point recording.
> * i386-tdep.h: floating point registers enumaration added.
> -------------------------------------------------------
>
> ******************************************************
> README:
> ******************************************************
> Patch description:
>
> -> Provides floating point support for i386 (reversible debugging:record-replay)
> -> previously gdb was not recording floating point registers, now all the floating point registers which are likely to be changed by floating point instructions, are recorded and replayed.
> -> the patch intends to provide the full support for all i386 floating point instructions.
> ---------------------------------------------------------
>
>
>
> ******************************************************
> Patch:i386-record-floats.patch
> ******************************************************
> diff -urN gdb.orig/i386-tdep.c gdb.new/i386-tdep.c
> --- gdb.orig/i386-tdep.c 2009-05-29 17:08:40.000000000 -0400
> +++ gdb.new/i386-tdep.c 2009-06-01 20:02:23.000000000 -0400
> @@ -543,6 +543,9 @@
> /* The maximum number of saved registers. This should include all
> registers mentioned above, and %eip. */
> #define I386_NUM_SAVED_REGS I386_NUM_GREGS
> +#define I386_SAVE_FPU_REGS 0xFFFD
> +#define I386_SAVE_FPU_ENV 0xFFFE
> +#define I386_SAVE_FPU_ENV_REG_STACK 0xFFFF
>
> struct i386_frame_cache
> {
> @@ -2985,6 +2988,54 @@
> return 0;
> }
>
> +/* Record the value of floating point registers which will be changed by the current instruction
> + to "record_arch_list".
> + return -1 if something is wrong. */
> +
> +static int i386_record_floats(struct i386_record_s *ir, uint32_t iregnum)
> +{
> + int i;
> +
> + /* Oza : push/pop of fpu stack is going to happen
> + currently we store st0-st7 registers, but we need not store all registers all the time.
> + using fstatus, we use 11-13 bits which gives us stack top and hence we optimize our storage. */
> + if (I386_SAVE_FPU_REGS == iregnum)
> + {
> + for (i=I386_ST0_REGNUM;i<=I386_ST7_REGNUM;i++)
> + {
> + if (record_arch_list_add_reg (ir->regcache,i))
> + return -1;
> + }
> + }
> + else if (I386_SAVE_FPU_ENV == iregnum)
> + {
> + for (i=I386_FCTRL;i<=I386_FOP;i++)
> + {
> + if (record_arch_list_add_reg (ir->regcache,i))
> + return -1;
> + }
> + }
> + else if (I386_SAVE_FPU_ENV_REG_STACK == iregnum)
> + {
> + for (i=I386_ST0_REGNUM;i<=I386_FOP;i++)
> + {
> + if (record_arch_list_add_reg (ir->regcache,i))
> + return -1;
> + }
> + }
> + else if (iregnum >= I386_ST0_REGNUM && iregnum <= I386_FOP)
> + {
> + if (record_arch_list_add_reg (ir->regcache,iregnum))
> + return -1;
> + }
> + else
> + {
> + /* param Error */
> + return -1;
> + }
> + return 0;
> +}
> +
> /* Parse the current instruction and record the values of the registers and
> memory that will be changed in current instruction to "record_arch_list".
> Return -1 if something wrong. */
> @@ -4035,7 +4086,6 @@
> break;
>
> /* floats */
> - /* It just record the memory change of instrcution. */
> case 0xd8:
> case 0xd9:
> case 0xda:
> @@ -4056,39 +4106,49 @@
> return -1;
> switch (ir.reg)
> {
> - case 0x00:
> - case 0x01:
> case 0x02:
> - case 0x03:
> + case 0x12:
> + case 0x22:
> + case 0x32:
> + /* for FCOM, FICOM nothing to do */
> + break;
> + case 0x03:
> + case 0x13:
> + case 0x23:
> + case 0x33:
> + /* FCOMP, FICOMP pop FPU stack, store all */
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> + break;
> + case 0x00:
> + case 0x01:
> case 0x04:
> case 0x05:
> case 0x06:
> case 0x07:
> case 0x10:
> - case 0x11:
> - case 0x12:
> - case 0x13:
> + case 0x11:
> case 0x14:
> case 0x15:
> case 0x16:
> case 0x17:
> case 0x20:
> case 0x21:
> - case 0x22:
> - case 0x23:
> case 0x24:
> case 0x25:
> case 0x26:
> case 0x27:
> case 0x30:
> case 0x31:
> - case 0x32:
> - case 0x33:
> case 0x34:
> case 0x35:
> case 0x36:
> case 0x37:
> - break;
> + /* FADD, FMUL, FSUB, FSUBR, FDIV, FDIVR, FIADD, FIMUL, FISUB, FISUBR, FIDIV, FIDIVR
> + ModR/M.reg is an extension of code, always affects st(0) register */
> + if (i386_record_floats(&ir, I386_ST0_REGNUM))
> + return -1;
> + break;
> case 0x08:
> case 0x0a:
> case 0x0b:
> @@ -4096,6 +4156,7 @@
> case 0x19:
> case 0x1a:
> case 0x1b:
> + case 0x1d:
> case 0x28:
> case 0x29:
> case 0x2a:
> @@ -4103,11 +4164,16 @@
> case 0x38:
> case 0x39:
> case 0x3a:
> - case 0x3b:
> + case 0x3b:
> + case 0x3c:
> + case 0x3d:
> switch (ir.reg & 7)
> {
> case 0:
> - break;
> + /* FLD, FILD */
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> + break;
> case 1:
> switch (ir.reg >> 4)
> {
> @@ -4120,6 +4186,7 @@
> return -1;
> break;
> case 3:
> + break;
> default:
> if (record_arch_list_add_mem (addr, 2))
> return -1;
> @@ -4130,15 +4197,42 @@
> switch (ir.reg >> 4)
> {
> case 0:
> + if (record_arch_list_add_mem (addr, 4))
> + return -1;
> + if (3 == (ir.reg & 7))
> + {
> + /* FSTP m32fp */
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> + }
> + break;
> case 1:
> if (record_arch_list_add_mem (addr, 4))
> return -1;
> + if ((3 == (ir.reg & 7)) || (5 == (ir.reg & 7)) || (7 == (ir.reg & 7)))
> + {
> + /* FSTP */
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> + }
> break;
> case 2:
> if (record_arch_list_add_mem (addr, 8))
> return -1;
> + if (3 == (ir.reg & 7))
> + {
> + /* FSTP m64fp */
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> + }
> break;
> case 3:
> + if ((3 <= (ir.reg & 7)) && (6 <= (ir.reg & 7)))
> + {
> + /* FISTP, FBLD, FILD, FBSTP */
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> + }
> default:
> if (record_arch_list_add_mem (addr, 2))
> return -1;
> @@ -4147,54 +4241,71 @@
> break;
> }
> break;
> - case 0x0c:
> - case 0x0d:
> - case 0x1d:
> - case 0x2c:
> - case 0x3c:
> - case 0x3d:
> - break;
> - case 0x0e:
> + case 0x0c:
> + /* FLDENV */
> + if (i386_record_floats(&ir, I386_SAVE_FPU_ENV_REG_STACK))
> + return -1;
> + break;
> + case 0x0d:
> + /* FLDCW */
> + if (i386_record_floats(&ir, I386_FCTRL))
> + return -1;
> + break;
> + case 0x2c:
> + /* FRTSTOR */
> + if (i386_record_floats(&ir, I386_SAVE_FPU_ENV_REG_STACK))
> + return -1;
> + break;
> + case 0x0e:
> if (ir.dflag)
> {
> - if (record_arch_list_add_mem (addr, 28))
> - return -1;
> + if (record_arch_list_add_mem (addr, 28))
> + return -1;
> }
> else
> {
> - if (record_arch_list_add_mem (addr, 14))
> - return -1;
> + if (record_arch_list_add_mem (addr, 14))
> + return -1;
> }
> break;
> - case 0x0f:
> - case 0x2f:
> + case 0x0f:
> + case 0x2f:
> if (record_arch_list_add_mem (addr, 2))
> return -1;
> break;
> - case 0x1f:
> - case 0x3e:
> + case 0x1f:
> + case 0x3e:
> if (record_arch_list_add_mem (addr, 10))
> return -1;
> + /* FSTP, FBSTP */
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> break;
> - case 0x2e:
> + case 0x2e:
> if (ir.dflag)
> {
> - if (record_arch_list_add_mem (addr, 28))
> - return -1;
> - addr += 28;
> + if (record_arch_list_add_mem (addr, 28))
> + return -1;
> + addr += 28;
> }
> else
> {
> - if (record_arch_list_add_mem (addr, 14))
> - return -1;
> - addr += 14;
> + if (record_arch_list_add_mem (addr, 14))
> + return -1;
> + addr += 14;
> }
> if (record_arch_list_add_mem (addr, 80))
> return -1;
> + /* FSAVE */
> + if (i386_record_floats(&ir, I386_SAVE_FPU_ENV_REG_STACK))
> + return -1;
> break;
> - case 0x3f:
> + case 0x3f:
> if (record_arch_list_add_mem (addr, 8))
> return -1;
> + /* FISTP */
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> break;
> default:
> ir.addr -= 2;
> @@ -4202,9 +4313,180 @@
> goto no_support;
> break;
> }
> - }
> + }
> + /* opcode is an extension of modR/M byte */
> + else
> + {
> + switch (opcode)
> + {
> + case 0xd8:
> + if (i386_record_floats(&ir, I386_ST0_REGNUM))
> + return -1;
> + break;
> + case 0xd9:
> + if (0x0c == (ir.modrm >> 4))
> + {
> + if ((ir.modrm & 0x0f) <= 7)
> + {
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> + }
> + else
> + {
> + if (i386_record_floats(&ir, I386_ST0_REGNUM))
> + return -1;
> + /* if only st(0) is changing, then we have already recorded */
> + if ((ir.modrm & 0x0f) - 0x08)
> + {
> + if (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm & 0x0f) - 0x08)))
> + return -1;
> + }
> + }
> + }
> + else
> + {
> + switch(ir.modrm)
> + {
> + case 0xe0:
> + case 0xe1:
> + case 0xf0:
> + case 0xf5:
> + case 0xf8:
> + case 0xfa:
> + case 0xfc:
> + case 0xfe:
> + case 0xff:
> + if (i386_record_floats(&ir, I386_ST0_REGNUM))
> + return -1;
> + break;
> + case 0xf1:
> + case 0xf2:
> + case 0xf3:
> + case 0xf4:
> + case 0xf6:
> + case 0xf7:
> + case 0xe8:
> + case 0xe9:
> + case 0xea:
> + case 0xeb:
> + case 0xec:
> + case 0xed:
> + case 0xee:
> + case 0xf9:
> + case 0xfb:
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> + break;
> + case 0xfd:
> + if (i386_record_floats(&ir, I386_ST0_REGNUM))
> + return -1;
> + if (i386_record_floats(&ir, I386_ST1_REGNUM))
> + return -1;
> + break;
> + }
> + }
> + break;
> + case 0xda:
> + if (0xe9 == ir.modrm)
> + {
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> + }
> + else if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4))
> + {
> + if (i386_record_floats(&ir, I386_ST0_REGNUM))
> + return -1;
> + if (((ir.modrm & 0x0f) > 0) && ((ir.modrm & 0x0f) <= 7))
> + {
> + if (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm & 0x0f)))
> + return -1;
> + }
> + else if ((ir.modrm & 0x0f) - 0x08)
> + {
> + if (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm & 0x0f) - 0x08)))
> + return -1;
> + }
> + }
> + break;
> + case 0xdb:
> + if (0xe3 == ir.modrm)
> + {
> + if (i386_record_floats(&ir, I386_SAVE_FPU_ENV))
> + return -1;
> + }
> + else if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4))
> + {
> + if (i386_record_floats(&ir, I386_ST0_REGNUM))
> + return -1;
> + if (((ir.modrm & 0x0f) > 0) && ((ir.modrm & 0x0f) <= 7))
> + {
> + if (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm & 0x0f)))
> + return -1;
> + }
> + else if ((ir.modrm & 0x0f) - 0x08)
> + {
> + if (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm & 0x0f) - 0x08)))
> + return -1;
> + }
> + }
> + break;
> + case 0xdc:
> + if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4) || (0x0f == ir.modrm >> 4))
> + {
> + if ((ir.modrm & 0x0f) <= 7)
> + {
> + if (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm & 0x0f)))
> + return -1;
> + }
> + else
> + {
> + if (i386_record_floats(&ir, I386_ST0_REGNUM + ((ir.modrm & 0x0f) - 0x08)))
> + return -1;
> + }
> + }
> + break;
> + case 0xdd:
> + if (0x0c == ir.modrm >> 4)
> + {
> + if (i386_record_floats(&ir,I386_FTAG))
> + return -1;
> + }
> + else if ((0x0d == ir.modrm >> 4) || (0x0e == ir.modrm >> 4))
> + {
> + if ((ir.modrm & 0x0f) <= 7)
> + {
> + if (i386_record_floats(&ir, I386_ST0_REGNUM + (ir.modrm & 0x0f)))
> + return -1;
> + }
> + else
> + {
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> + }
> + }
> + break;
> + case 0xde:
> + if ((0x0c == ir.modrm >> 4) || (0x0e == ir.modrm >> 4) || (0x0f == ir.modrm >> 4) || (0xd9 == ir.modrm))
> + {
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> + }
> + break;
> + case 0xdf:
> + if (0xe0 == ir.modrm)
> + {
> + if (record_arch_list_add_reg (ir.regcache, I386_EAX_REGNUM))
> + return -1;
> + }
> + else if ((0x0f == ir.modrm >> 4) || (0x0e == ir.modrm >> 4))
> + {
> + if (i386_record_floats(&ir, I386_SAVE_FPU_REGS))
> + return -1;
> + }
> + break;
> + }
> + }
> break;
> -
> /* string ops */
> /* movsS */
> case 0xa4:
> @@ -4623,10 +4905,17 @@
> /* fwait */
> /* XXX */
> case 0x9b:
> - printf_unfiltered (_("Process record doesn't support instruction "
> - "fwait.\n"));
> - ir.addr -= 1;
> - goto no_support;
> + if (target_read_memory (ir.addr, &tmpu8, 1))
> + {
> + if (record_debug)
> + printf_unfiltered (_("Process record: error reading memory at "
> + "addr 0x%s len = 1.\n"),
> + paddr_nz (ir.addr));
> + return -1;
> + }
> + opcode = (uint32_t) tmpu8;
> + ir.addr++;
> + goto reswitch;
> break;
>
> /* int3 */
> diff -urN gdb.orig/i386-tdep.h gdb.new/i386-tdep.h
> --- gdb.orig/i386-tdep.h 2009-05-17 17:56:44.000000000 -0400
> +++ gdb.new/i386-tdep.h 2009-05-31 16:33:14.000000000 -0400
> @@ -145,7 +145,22 @@
> I386_ES_REGNUM, /* %es */
> I386_FS_REGNUM, /* %fs */
> I386_GS_REGNUM, /* %gs */
> - I386_ST0_REGNUM /* %st(0) */
> + I386_ST0_REGNUM, /* %st(0) */
> + I386_ST1_REGNUM, /* %st(1) */
> + I386_ST2_REGNUM, /* %st(2) */
> + I386_ST3_REGNUM, /* %st(3) */
> + I386_ST4_REGNUM, /* %st(4) */
> + I386_ST5_REGNUM, /* %st(5) */
> + I386_ST6_REGNUM, /* %st(6) */
> + I386_ST7_REGNUM, /* %st(7) */
> + I386_FCTRL, /* floating point env regs : FCTRL-FOP */
> + I386_FSTAT,
> + I386_FTAG,
> + I386_FISEG,
> + I386_FIOFF,
> + I386_FOSEG,
> + I386_FOOFF,
> + I386_FOP
> };
>
About this part, I think this is my mistake. I didn't take fp work
for now very clear (Or I am still not clear with x86 fp).
FCTRL, FOP and so on are the fp reg of amd64. For now, prec is still
not support amd64 (I am working on it).
And amd64's support are in amd64-tedp.... files. Change i386_regnum
is not a good idea.
I suggest you divide fp patch to 2 parts. One is for i386, the other for amd64.
For now, just send i386 patch for review. And send amd64 patch when
prec support amd64.
> #define I386_NUM_GREGS 16
>
>
>
>
> *******************************************************
> test-example which does basic verification for the patch.
> *******************************************************
>
> #include <stdio.h>
> #include <math.h>
>
> int main()
> {
> float no1,no2,no3,no4,no5,no6,no7;
> double x = 100.345, y = 25.7789;
> long double ldx = 88888888888888888888.88, ldy = 9999999999999999999.99;
> float result,resultd,resultld;
> no1 = 10.45;
> no2 = 20.77;
> no3 = 156.89874646;
> no4 = 14.56;
> no5 = 11.11;
> no6 = 66.77;
> no7 = 88.88;
>
> result = no1 + no2 + no3 + no4 + no5 + no6 + no7;
> printf("result is %f\n",result);
>
> result = fmodf(no2,no1);
> printf("result is %f\n",result);
>
> resultd = fmod(x,y);
> printf("result is %f\n",resultd);
>
> resultld = fmodl(ldy,ldy);
> printf("result is %f\n",resultld);
>
> result = fabsf(no1);
> printf("result is %f\n",result);
>
> result = no3 / no4;
> printf("result is %f\n",result);
>
> result = no1 * no2 * no3 * no4;
> printf("result is %f\n",result);
>
> result = sin(30);
> printf("result is %f\n",result);
>
> result = cos(30);
> printf("result is %f\n",result);
>
> result = tan(30);
> printf("result is %f\n",result);
>
> result = atan(30);
> printf("result is %f\n",result);
>
> result = sqrt(no3);
> printf("result is %f\n",result);
>
> result = log10(no3);
> printf("result is %f\n",result);
>
> result = log(no3);
> printf("result is %f\n",result);
>
> result = exp10(no3);
> printf("result is %f\n",result);
>
> result = exp(no3);
> printf("result is %f\n",result);
>
> ldy = 88888888888888888888.88;
> if (ldx == ldy)
> ldy = 7777777777777777777777777777.777;
> else
> ldy = 666666666666666666666666666.666;
>
> }
With this example, what I got is:
gdb ./a.out
GNU gdb (GDB) 6.8.50.20090602-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>...
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/bgdb/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 0x8048608: file 1.c, line 7.
Starting program: /home/teawater/gdb/bgdb/gdb/a.out
Temporary breakpoint 1, main () at 1.c:7
7 double x = 100.345, y = 25.7789;
(gdb) record
(gdb) c
Continuing.
result is 369.438751
Process record doesn't support instruction fwait.
Process record doesn't support instruction 0x9b at address 0xb7fa35fa.
Process record: failed to record execution log.
Program received signal SIGTRAP, Trace/breakpoint trap.
0xb7fa35fa in ?? () from /lib/tls/i686/cmov/libm.so.6
(gdb)
Thanks,
Hui
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: Submition of i386.record.floating.point.patch
2009-06-02 6:58 ` Hui Zhu
@ 2009-06-04 22:18 ` Hui Zhu
0 siblings, 0 replies; 28+ messages in thread
From: Hui Zhu @ 2009-06-04 22:18 UTC (permalink / raw)
To: paawan oza; +Cc: gdb-patches
>> diff -urN gdb.orig/i386-tdep.h gdb.new/i386-tdep.h
>> --- gdb.orig/i386-tdep.h 2009-05-17 17:56:44.000000000 -0400
>> +++ gdb.new/i386-tdep.h 2009-05-31 16:33:14.000000000 -0400
>> @@ -145,7 +145,22 @@
>> I386_ES_REGNUM, /* %es */
>> I386_FS_REGNUM, /* %fs */
>> I386_GS_REGNUM, /* %gs */
>> - I386_ST0_REGNUM /* %st(0) */
>> + I386_ST0_REGNUM, /* %st(0) */
>> + I386_ST1_REGNUM, /* %st(1) */
>> + I386_ST2_REGNUM, /* %st(2) */
>> + I386_ST3_REGNUM, /* %st(3) */
>> + I386_ST4_REGNUM, /* %st(4) */
>> + I386_ST5_REGNUM, /* %st(5) */
>> + I386_ST6_REGNUM, /* %st(6) */
>> + I386_ST7_REGNUM, /* %st(7) */
>> + I386_FCTRL, /* floating point env regs : FCTRL-FOP */
>> + I386_FSTAT,
>> + I386_FTAG,
>> + I386_FISEG,
>> + I386_FIOFF,
>> + I386_FOSEG,
>> + I386_FOOFF,
>> + I386_FOP
>> };
>>
>
> About this part, I think this is my mistake. I didn't take fp work
> for now very clear (Or I am still not clear with x86 fp).
> FCTRL, FOP and so on are the fp reg of amd64. For now, prec is still
> not support amd64 (I am working on it).
> And amd64's support are in amd64-tedp.... files. Change i386_regnum
> is not a good idea.
>
> I suggest you divide fp patch to 2 parts. One is for i386, the other for amd64.
> For now, just send i386 patch for review. And send amd64 patch when
> prec support amd64.
>
>
>
What do you think about my idea?
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: submition of i386.record.floating.point.patch
@ 2009-05-31 18:51 paawan oza
2009-06-01 2:50 ` Hui Zhu
0 siblings, 1 reply; 28+ messages in thread
From: paawan oza @ 2009-05-31 18:51 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches
Hi Hui,
I am not sure whether I followed you correctly.
please try to clear the comments in lined below.
> Hi Oza,
>
> Thanks for your works. Before I read your patch, I
> have some ideas
> with your RFA:
>
> 1. Please don't post compress package. I did it in
> before. But it's
> not friendly for review.
Oza : Are you suggesting that, I should send the ChangeLog and README and patch separately without compressing it ?
> 2. Post the readme and changelog to the Email body.
> If you like, post
> the patch to the email body too. A lof of people like
> it.
Oza : email body is "gdb-patches@sourceware.org"
correct ?
> 3. Maybe you can post some test example to test the
> patch.
Oza : I will post a test example, which could do initial verification for the patch.
> I suggest you re-send a rfa that post most thing to email
> body. And
> if you want, you can post the url to
> http://sourceware.org/gdb/wiki/ReversibleDebugging
> "Support i386 more
> better".
Oza : what is RFA? after posting are you suggesting, that I should change
the wiki contents ? and post it to "email-body" ?
Regards,
Oza.
> Thanks,
> Hui
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: submition of i386.record.floating.point.patch
2009-05-31 18:51 submition " paawan oza
@ 2009-06-01 2:50 ` Hui Zhu
0 siblings, 0 replies; 28+ messages in thread
From: Hui Zhu @ 2009-06-01 2:50 UTC (permalink / raw)
To: paawan oza; +Cc: gdb-patches
Email body = text part of Email.
Send test format of everything.
On Mon, Jun 1, 2009 at 02:51, paawan oza <paawan1982@yahoo.com> wrote:
>
> Hi Hui,
>
> I am not sure whether I followed you correctly.
> please try to clear the comments in lined below.
>
>> Hi Oza,
>>
>> Thanks for your works. Before I read your patch, I
>> have some ideas
>> with your RFA:
>>
>> 1. Please don't post compress package. I did it in
>> before. But it's
>> not friendly for review.
>
> Oza : Are you suggesting that, I should send the ChangeLog and README and patch separately without compressing it ?
>
>
>> 2. Post the readme and changelog to the Email body.
>> If you like, post
>> the patch to the email body too. A lof of people like
>> it.
>
> Oza : email body is "gdb-patches@sourceware.org"
> correct ?
>
>> 3. Maybe you can post some test example to test the
>> patch.
>
> Oza : I will post a test example, which could do initial verification for the patch.
>
>> I suggest you re-send a rfa that post most thing to email
>> body. And
>> if you want, you can post the url to
>> http://sourceware.org/gdb/wiki/ReversibleDebugging
>> "Support i386 more
>> better".
>
> Oza : what is RFA? after posting are you suggesting, that I should change
> the wiki contents ? and post it to "email-body" ?
>
> Regards,
> Oza.
>
>> Thanks,
>> Hui
>
>
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* submition of i386.record.floating.point.patch
@ 2009-05-31 11:49 paawan oza
2009-05-31 15:44 ` Hui Zhu
2009-05-31 18:02 ` Mark Kettenis
0 siblings, 2 replies; 28+ messages in thread
From: paawan oza @ 2009-05-31 11:49 UTC (permalink / raw)
To: gdb-patches; +Cc: Hui Zhu
[-- Attachment #1: Type: text/plain, Size: 3543 bytes --]
Hello,
I have been working on reversible debugging-i386 floating point support for last couple of weeks.
I would like to submit the patch for review.
please find the package attached.
package contains following.
1) Description
2) ChangeLog (I am not sure it follows proper formatting)
3) The Patch.
please consider it for review and kindly send your comments.
Regards,
Oza.
--- On Sun, 5/31/09, Hui Zhu <teawater@gmail.com> wrote:
> From: Hui Zhu <teawater@gmail.com>
> Subject: Re: floating point support for i386 done, for record/replay
> To: "paawan oza" <paawan1982@yahoo.com>
> Cc: "gdb ml" <gdb@sourceware.org>
> Date: Sunday, May 31, 2009, 11:02 AM
> I think maybe you can post your patch
> and your example to gdb-patch to
> let people review it.
>
> Hui
>
> On Sun, May 31, 2009 at 01:46, paawan oza <paawan1982@yahoo.com>
> wrote:
> >
> > Hi Hui,
> > I have been going through GNU doc about how I can
> submit the patch (floating point record support).
> > the process looked bit complicated as the patch
> involves more than 15 lines of change.
> > I am not sure how to go ahead, because this is the
> very first time I am contributing.
> > please guide me with that.
> > I will be waiting for your reply.
> > Regards,
> > Oza.
> >
> > --- On Thu, 5/28/09, paawan oza <paawan1982@yahoo.com>
> wrote:
> >
> >> From: paawan oza <paawan1982@yahoo.com>
> >> Subject: i386, floating point support done for
> record/replay
> >> To: "Hui Zhu" <teawater@gmail.com>
> >> Cc: "gdb ml" <gdb@sourceware.org>
> >> Date: Thursday, May 28, 2009, 1:25 PM
> >>
> >> Hi Hui,
> >>
> >> I have finished the implementation part for i386
> floating
> >> point support
> >> for record/replay.
> >> I have tested with some small programs, and it
> gives
> >> results as expected.
> >> (As there are lots of floating point insns, not
> every insn
> >> is tested, but coding is simple)
> >> I am quiet excited about the patch and nervous at
> the same
> >> time, as it is my first contribution : )
> >> I have just concentrated mainly on making the
> things work,
> >> rather than optimizing it.
> >> please feel free to suggest any design change.
> >>
> >> please let me know how I can go ahead.
> >>
> >> Regards,
> >> Oza.
> >>
> >>
> >>
> >>
> >> --- On Sun, 5/24/09, Hui Zhu <teawater@gmail.com>
> >> wrote:
> >>
> >> > From: Hui Zhu <teawater@gmail.com>
> >> > Subject: Re: floating point support i386
> >> implementation partially done
> >> > To: "paawan oza" <paawan1982@yahoo.com>
> >> > Cc: "gdb ml" <gdb@sourceware.org>
> >> > Date: Sunday, May 24, 2009, 9:27 AM
> >> > On Sun, May 24, 2009 at 03:03, paawan
> >> > oza <paawan1982@yahoo.com>
> >> > wrote:
> >> > >
> >> > > Hi Hui,
> >> > >
> >> > > floating point support patch is over for
> the
> >> case
> >> > > where ModR/M Byte is Within 00H to BFH.
> >> > >
> >> > > there are some doubts.
> >> > >
> >> > > 1) the insns like,
> >> > > FRSTOR, FLDENV, FLDCW (which loads
> floating
> >> point
> >> > environment registers like status, control,
> tag etc..
> >> > initializing part)
> >> > > I think we need to record those also,
> upon
> >> executing
> >> > such insns.
> >> > > what is your opinion?
> >> > If this reg can be access by gdb, I think you
> need
> >> deal
> >> > with them.
> >> >
> >> > >
> >> > >
> >> > > otherwise, patch is ready : ),
> >> > > of course I need to work on REG= support
> to
> >> finish the
> >> > rest of the record of FPU support.
> >> > >
> >> > Great!
> >> >
> >> > Thanks,
> >> > Hui
> >> >
> >>
> >>
> >>
> >>
> >
> >
> >
> >
>
[-- Attachment #2: i386.record.float.patch.tar --]
[-- Type: application/x-tar, Size: 20480 bytes --]
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: submition of i386.record.floating.point.patch
2009-05-31 11:49 paawan oza
@ 2009-05-31 15:44 ` Hui Zhu
2009-05-31 18:02 ` Mark Kettenis
1 sibling, 0 replies; 28+ messages in thread
From: Hui Zhu @ 2009-05-31 15:44 UTC (permalink / raw)
To: paawan oza; +Cc: gdb-patches
Hi Oza,
Thanks for your works. Before I read your patch, I have some ideas
with your RFA:
1. Please don't post compress package. I did it in before. But it's
not friendly for review.
2. Post the readme and changelog to the Email body. If you like, post
the patch to the email body too. A lof of people like it.
3. Maybe you can post some test example to test the patch.
I suggest you re-send a rfa that post most thing to email body. And
if you want, you can post the url to
http://sourceware.org/gdb/wiki/ReversibleDebugging "Support i386 more
better".
Thanks,
Hui
On Sun, May 31, 2009 at 19:49, paawan oza <paawan1982@yahoo.com> wrote:
> Hello,
>
> I have been working on reversible debugging-i386 floating point support for last couple of weeks.
> I would like to submit the patch for review.
>
> please find the package attached.
> package contains following.
>
> 1) Description
> 2) ChangeLog (I am not sure it follows proper formatting)
> 3) The Patch.
>
> please consider it for review and kindly send your comments.
>
> Regards,
> Oza.
>
>
>
>
>
>
> --- On Sun, 5/31/09, Hui Zhu <teawater@gmail.com> wrote:
>
>> From: Hui Zhu <teawater@gmail.com>
>> Subject: Re: floating point support for i386 done, for record/replay
>> To: "paawan oza" <paawan1982@yahoo.com>
>> Cc: "gdb ml" <gdb@sourceware.org>
>> Date: Sunday, May 31, 2009, 11:02 AM
>> I think maybe you can post your patch
>> and your example to gdb-patch to
>> let people review it.
>>
>> Hui
>>
>> On Sun, May 31, 2009 at 01:46, paawan oza <paawan1982@yahoo.com>
>> wrote:
>> >
>> > Hi Hui,
>> > I have been going through GNU doc about how I can
>> submit the patch (floating point record support).
>> > the process looked bit complicated as the patch
>> involves more than 15 lines of change.
>> > I am not sure how to go ahead, because this is the
>> very first time I am contributing.
>> > please guide me with that.
>> > I will be waiting for your reply.
>> > Regards,
>> > Oza.
>> >
>> > --- On Thu, 5/28/09, paawan oza <paawan1982@yahoo.com>
>> wrote:
>> >
>> >> From: paawan oza <paawan1982@yahoo.com>
>> >> Subject: i386, floating point support done for
>> record/replay
>> >> To: "Hui Zhu" <teawater@gmail.com>
>> >> Cc: "gdb ml" <gdb@sourceware.org>
>> >> Date: Thursday, May 28, 2009, 1:25 PM
>> >>
>> >> Hi Hui,
>> >>
>> >> I have finished the implementation part for i386
>> floating
>> >> point support
>> >> for record/replay.
>> >> I have tested with some small programs, and it
>> gives
>> >> results as expected.
>> >> (As there are lots of floating point insns, not
>> every insn
>> >> is tested, but coding is simple)
>> >> I am quiet excited about the patch and nervous at
>> the same
>> >> time, as it is my first contribution : )
>> >> I have just concentrated mainly on making the
>> things work,
>> >> rather than optimizing it.
>> >> please feel free to suggest any design change.
>> >>
>> >> please let me know how I can go ahead.
>> >>
>> >> Regards,
>> >> Oza.
>> >>
>> >>
>> >>
>> >>
>> >> --- On Sun, 5/24/09, Hui Zhu <teawater@gmail.com>
>> >> wrote:
>> >>
>> >> > From: Hui Zhu <teawater@gmail.com>
>> >> > Subject: Re: floating point support i386
>> >> implementation partially done
>> >> > To: "paawan oza" <paawan1982@yahoo.com>
>> >> > Cc: "gdb ml" <gdb@sourceware.org>
>> >> > Date: Sunday, May 24, 2009, 9:27 AM
>> >> > On Sun, May 24, 2009 at 03:03, paawan
>> >> > oza <paawan1982@yahoo.com>
>> >> > wrote:
>> >> > >
>> >> > > Hi Hui,
>> >> > >
>> >> > > floating point support patch is over for
>> the
>> >> case
>> >> > > where ModR/M Byte is Within 00H to BFH.
>> >> > >
>> >> > > there are some doubts.
>> >> > >
>> >> > > 1) the insns like,
>> >> > > FRSTOR, FLDENV, FLDCW (which loads
>> floating
>> >> point
>> >> > environment registers like status, control,
>> tag etc..
>> >> > initializing part)
>> >> > > I think we need to record those also,
>> upon
>> >> executing
>> >> > such insns.
>> >> > > what is your opinion?
>> >> > If this reg can be access by gdb, I think you
>> need
>> >> deal
>> >> > with them.
>> >> >
>> >> > >
>> >> > >
>> >> > > otherwise, patch is ready : ),
>> >> > > of course I need to work on REG= support
>> to
>> >> finish the
>> >> > rest of the record of FPU support.
>> >> > >
>> >> > Great!
>> >> >
>> >> > Thanks,
>> >> > Hui
>> >> >
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> >
>>
>
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: submition of i386.record.floating.point.patch
2009-05-31 11:49 paawan oza
2009-05-31 15:44 ` Hui Zhu
@ 2009-05-31 18:02 ` Mark Kettenis
1 sibling, 0 replies; 28+ messages in thread
From: Mark Kettenis @ 2009-05-31 18:02 UTC (permalink / raw)
To: paawan1982; +Cc: gdb-patches, teawater
> Date: Sun, 31 May 2009 04:49:14 -0700 (PDT)
> From: paawan oza <paawan1982@yahoo.com>
>
> Hello,
>
> I have been working on reversible debugging-i386 floating point support for last couple of weeks.
> I would like to submit the patch for review.
>
> please find the package attached.
> package contains following.
>
> 1) Description
> 2) ChangeLog (I am not sure it follows proper formatting)
> 3) The Patch.
>
> please consider it for review and kindly send your comments.
Please post proper diffs (preferably in-line and not as a MIME
attachment) instead of some .tar file.
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2009-07-01 3:02 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-30 13:22 Submition of i386.record.floating.point.patch paawan oza
2009-06-30 18:52 ` Michael Snyder
-- strict thread matches above, loose matches on Subject: below --
2009-07-01 3:02 paawan oza
2009-06-24 16:22 paawan oza
2009-06-15 15:04 paawan oza
2009-06-12 16:47 paawan oza
2009-06-11 15:18 paawan oza
2009-06-11 15:00 paawan oza
2009-06-12 5:19 ` Hui Zhu
2009-06-11 7:37 paawan oza
2009-06-11 7:45 ` Hui Zhu
2009-06-08 16:21 paawan oza
2009-06-05 12:05 paawan oza
2009-06-05 2:41 paawan oza
2009-06-05 2:50 ` Hui Zhu
2009-06-05 2:56 ` Mark Kettenis
2009-06-05 2:58 ` Hui Zhu
2009-06-03 4:03 paawan oza
2009-06-02 17:58 paawan oza
2009-06-03 2:58 ` Hui Zhu
2009-06-01 14:55 paawan oza
2009-06-02 6:58 ` Hui Zhu
2009-06-04 22:18 ` Hui Zhu
2009-05-31 18:51 submition " paawan oza
2009-06-01 2:50 ` Hui Zhu
2009-05-31 11:49 paawan oza
2009-05-31 15:44 ` Hui Zhu
2009-05-31 18:02 ` Mark Kettenis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox