From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24310 invoked by alias); 29 Aug 2009 05:40:15 -0000 Received: (qmail 24086 invoked by uid 22791); 29 Aug 2009 05:40:13 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_22,J_CHICKENPOX_25,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-yw0-f175.google.com (HELO mail-yw0-f175.google.com) (209.85.211.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 29 Aug 2009 05:40:06 +0000 Received: by ywh5 with SMTP id 5so3475311ywh.13 for ; Fri, 28 Aug 2009 22:40:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.238.12 with SMTP id l12mr3517860ybh.125.1251524404455; Fri, 28 Aug 2009 22:40:04 -0700 (PDT) In-Reply-To: <4A95C927.8020607@vmware.com> References: <4A7BA1DE.6010103@vmware.com> <837hwufkxr.fsf@gnu.org> <83eir1dnqw.fsf@gnu.org> <8363cbenvt.fsf@gnu.org> <4A95C927.8020607@vmware.com> From: Hui Zhu Date: Sat, 29 Aug 2009 06:51:00 -0000 Message-ID: Subject: Re: Bug in i386_process_record? To: Michael Snyder Cc: Eli Zaretskii , "gdb-patches@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-08/txt/msg00531.txt.bz2 On Thu, Aug 27, 2009 at 07:45, Michael Snyder wrote: > Hui Zhu wrote: >> >> On Wed, Aug 26, 2009 at 02:42, Eli Zaretskii wrote: >>>> >>>> From: Hui Zhu >>>> Date: Tue, 25 Aug 2009 13:02:44 +0800 >>>> Cc: msnyder@vmware.com, gdb-patches@sourceware.org >>>> >>>> It seems that the segment (It is not the section) =A0registers in x86 >>>> protect mode is just help MMU to get the physical address. =A0It's >>>> transparent for the user level program. >>> >>> It's transparent if $es and $ds have the same value (which they >>> usually do, AFAIK). >>> >>>> What do you think about remove this warning from this patch? >>> >>> I would indeed do that, if we find that $es and $ds have the same >>> values. =A0Assuming that someone who knows Linux better than I do >>> confirms that these two registers hold the same selector when a normal >>> application is running in user mode. >>> >> >> Thanks for remind me. =A0We cannot get the value of each segment >> register, but we can get each segment register point to. =A0So if the >> value of segment registers, it's means that the value of them is same. >> >> I add some code about it: >> =A0 =A0 =A0 =A0 =A0regcache_raw_read_unsigned (ir.regcache, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0ir.regmap[X86_RECORD_ES_REGNUM], >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0&es); >> =A0 =A0 =A0 =A0 =A0regcache_raw_read_unsigned (ir.regcache, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0ir.regmap[X86_RECORD_DS_REGNUM], >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0&ds); >> =A0 =A0 =A0 =A0 =A0if (ir.aflag && (es !=3D ds)) >> =A0 =A0 =A0 =A0 =A0 =A0{ >> >> After that, we will not get the warning because the es is same with ds >> in user level. >> >> What do you think about it? > > I think it is the best version I have seen so far. > And it seems to follow the conclusions of the discussion. > And I've tested it, and it seems to work. > > I would say wait until end-of-business Friday, and > if there are no more comments, check it in! > Checked in. Thanks, Hui > > > >> 2009-08-26 =A0Hui Zhu =A0 >> >> =A0 =A0 =A0 =A0* i386-tdep.c (i386_process_record): Fix the error of str= ing >> =A0 =A0 =A0 =A0ops instructions's handler. >> --- >> =A0i386-tdep.c | =A0 69 >> ++++++++++++++++++++++++++++-------------------------------- >> =A01 file changed, 33 insertions(+), 36 deletions(-) >> >> --- a/i386-tdep.c >> +++ b/i386-tdep.c >> @@ -4441,50 +4441,47 @@ reswitch: >> =A0 =A0 =A0 /* insS */ >> =A0 =A0 case 0x6c: >> =A0 =A0 case 0x6d: >> - =A0 =A0 =A0if ((opcode & 1) =3D=3D 0) >> - =A0 =A0 =A0 ir.ot =3D OT_BYTE; >> - =A0 =A0 =A0else >> - =A0 =A0 =A0 ir.ot =3D ir.dflag + OT_WORD; >> =A0 =A0 =A0 regcache_raw_read_unsigned (ir.regcache, >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ir.= regmap[X86_RECORD_REDI_REGNUM], >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ir.= regmap[X86_RECORD_RECX_REGNUM], >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &tmp= ulongest); >> - =A0 =A0 =A0if (!ir.aflag) >> - =A0 =A0 =A0 =A0{ >> - =A0 =A0 =A0 =A0 =A0tmpulongest &=3D 0xffff; >> - =A0 =A0 =A0 =A0 =A0/* addr +=3D ((uint32_t) read_register (I386_ES_REG= NUM)) << 4; */ >> - =A0 =A0 =A0 =A0 =A0if (record_debug) >> - =A0 =A0 =A0 =A0 =A0 =A0printf_unfiltered (_("Process record ignores th= e memory >> change " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "of in= struction at address 0x%s because >> " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "it ca= n't get the value of the segment " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "regis= ter.\n"), >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 paddress (= gdbarch, ir.addr)); >> - =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ)) >> + =A0 =A0 =A0if (tmpulongest) >> =A0 =A0 =A0 =A0 { >> - =A0 =A0 =A0 =A0 =A0ULONGEST count, eflags; >> + =A0 =A0 =A0 =A0 =A0ULONGEST es, ds; >> + >> + =A0 =A0 =A0 =A0 =A0if ((opcode & 1) =3D=3D 0) >> + =A0 =A0 =A0 =A0 =A0 ir.ot =3D OT_BYTE; >> + =A0 =A0 =A0 =A0 =A0else >> + =A0 =A0 =A0 =A0 =A0 ir.ot =3D ir.dflag + OT_WORD; >> =A0 =A0 =A0 =A0 =A0 regcache_raw_read_unsigned (ir.regcache, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 ir.regmap[X86_RECORD_REDI_REGNUM], >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0&count); >> - =A0 =A0 =A0 =A0 =A0if (!ir.aflag) >> - =A0 =A0 =A0 =A0 =A0 =A0count &=3D 0xffff; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0&tmpulongest); >> + >> =A0 =A0 =A0 =A0 =A0 regcache_raw_read_unsigned (ir.regcache, >> - >> =A0ir.regmap[X86_RECORD_EFLAGS_REGNUM], >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0&eflags); >> - =A0 =A0 =A0 =A0 =A0if ((eflags >> 10) & 0x1) >> - =A0 =A0 =A0 =A0 =A0 =A0tmpulongest -=3D (count - 1) * (1 << ir.ot); >> - =A0 =A0 =A0 =A0 =A0if (record_arch_list_add_mem (tmpulongest, count * = (1 << >> ir.ot))) >> - =A0 =A0 =A0 =A0 =A0 =A0return -1; >> - =A0 =A0 =A0 =A0 =A0I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGN= UM); >> - =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0else >> - =A0 =A0 =A0 =A0{ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0ir.regmap[X86_RECORD_ES_REGNUM], >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0&es); >> + =A0 =A0 =A0 =A0 =A0regcache_raw_read_unsigned (ir.regcache, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0ir.regmap[X86_RECORD_DS_REGNUM], >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0&ds); >> + =A0 =A0 =A0 =A0 =A0if (ir.aflag && (es !=3D ds)) >> + =A0 =A0 =A0 =A0 =A0 =A0{ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0/* addr +=3D ((uint32_t) read_register (I38= 6_ES_REGNUM)) << >> 4; */ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0if (record_debug) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0printf_unfiltered (_("Process record ig= nores the memory " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0"change of instruction at address >> 0x%s " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0"because it can't get the value of >> the " >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0"ES segment register.\n"), >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pa= ddress (gdbarch, ir.addr)); >> + =A0 =A0 =A0 =A0 =A0 =A0} >> + >> + =A0 =A0 =A0 =A0 =A0if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ)) >> + =A0 =A0 =A0 =A0 =A0 =A0I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RECX_= REGNUM); >> =A0 =A0 =A0 =A0 =A0 if (record_arch_list_add_mem (tmpulongest, 1 << ir.o= t)) >> =A0 =A0 =A0 =A0 =A0 =A0 return -1; >> - =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0if (opcode =3D=3D 0xa4 || opcode =3D=3D 0xa5) >> - =A0 =A0 =A0 =A0I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM); >> - =A0 =A0 =A0I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_REDI_REGNUM); >> - =A0 =A0 =A0I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM); >> + =A0 =A0 =A0 =A0 =A0if (opcode =3D=3D 0xa4 || opcode =3D=3D 0xa5) >> + =A0 =A0 =A0 =A0 =A0 =A0I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RESI_= REGNUM); >> + =A0 =A0 =A0 =A0 =A0I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_REDI_REGN= UM); >> + =A0 =A0 =A0 =A0 =A0I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_RE= GNUM); >> + =A0 =A0 =A0 } >> =A0 =A0 =A0 break; >> >> =A0 =A0 =A0 /* cmpsS */ > >