From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21964 invoked by alias); 30 Aug 2009 14:09:51 -0000 Received: (qmail 21955 invoked by uid 22791); 30 Aug 2009 14:09:50 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-iw0-f183.google.com (HELO mail-iw0-f183.google.com) (209.85.223.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 30 Aug 2009 14:09:44 +0000 Received: by iwn13 with SMTP id 13so1425374iwn.12 for ; Sun, 30 Aug 2009 07:09:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.48.210 with SMTP id s18mr4984899ibf.3.1251641382101; Sun, 30 Aug 2009 07:09:42 -0700 (PDT) In-Reply-To: <200908301356.n7UDuO4a006136@brahms.sibelius.xs4all.nl> References: <200908301356.n7UDuO4a006136@brahms.sibelius.xs4all.nl> From: Hui Zhu Date: Sun, 30 Aug 2009 14:20:00 -0000 Message-ID: Subject: Re: [PATCH] Fix cygwin build error with i386-linux-tdep.c To: Mark Kettenis Cc: gdb-patches@sourceware.org, msnyder@vmware.com 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/msg00562.txt.bz2 On Sun, Aug 30, 2009 at 21:56, Mark Kettenis wrote: >> From: Hui Zhu >> Date: Sun, 30 Aug 2009 21:15:22 +0800 >> >> 2009-08-29 =A0Hui Zhu =A0 >> >> =A0 =A0 =A0 * i386-linux-tdep.c (i386_linux_intx80_sysenter_record): Add >> =A0 =A0 =A0 (unsigned) before tmpu32. > > Ugh! =A0Casts like that are ugly. > > This made me look at the code again and realize that what you're doing > in that function is wrong. =A0You should be using > regcache_{raw|cooked}_read_unsigned() instead of regcache_raw_read(). > Then the whole issue of printing an uint32_t goes away. =A0When you do > change the code like that please use a more meaningful variable name > instead of 'tmpu32'. =A0My suggestion would be 'syscall'. For the regcache_raw_read_unsigned, I am not agres with it. void regcache_raw_read_unsigned (struct regcache *regcache, int regnum, ULONGEST *val) { gdb_byte *buf; gdb_assert (regcache !=3D NULL); gdb_assert (regnum >=3D 0 && regnum < regcache->descr->nr_raw_registers); buf =3D alloca (regcache->descr->sizeof_register[regnum]); regcache_raw_read (regcache, regnum, buf); (*val) =3D extract_unsigned_integer (buf, regcache->descr->sizeof_register[regnum], gdbarch_byte_order (regcache->descr->gdbarch)); } It just add a "extract_unsigned_integer". For this code, it in i386-linux-tdep.c. We know that I386_EAX_REGNUM is 32 bits. So we don't need extract_unsigned_integer to set anything. Thanks, Hui > > Cheers, > > Mark > >> Index: gdb/i386-linux-tdep.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- gdb.orig/i386-linux-tdep.c =A0 =A0 =A0 =A02009-08-23 21:17:37.000000= 000 +0800 >> +++ gdb/i386-linux-tdep.c =A0 =A0 2009-08-30 20:19:53.828125000 +0800 >> @@ -374,7 +374,7 @@ >> =A0 =A0if (tmpu32 > 499) >> =A0 =A0 =A0{ >> =A0 =A0 =A0 =A0printf_unfiltered (_("Process record and replay target do= esn't " >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "support syscall n= umber %u\n"), tmpu32); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "support syscall n= umber %u\n"), (unsigned) tmpu32); >> =A0 =A0 =A0 =A0return -1; >> =A0 =A0 =A0} >> >