From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29308 invoked by alias); 30 Aug 2009 14:37:32 -0000 Received: (qmail 29296 invoked by uid 22791); 30 Aug 2009 14:37:31 -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:37:25 +0000 Received: by iwn13 with SMTP id 13so1431101iwn.12 for ; Sun, 30 Aug 2009 07:37:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.126.8 with SMTP id a8mr4983529ibs.15.1251643043102; Sun, 30 Aug 2009 07:37:23 -0700 (PDT) In-Reply-To: References: <200908301356.n7UDuO4a006136@brahms.sibelius.xs4all.nl> From: Hui Zhu Date: Sun, 30 Aug 2009 15:00: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/msg00564.txt.bz2 On Sun, Aug 30, 2009 at 22:09, Hui Zhu wrote: > On Sun, Aug 30, 2009 at 21:56, Mark Kettenis wro= te: >>> 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, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ULONGEST *val) > { > =A0gdb_byte *buf; > =A0gdb_assert (regcache !=3D NULL); > =A0gdb_assert (regnum >=3D 0 && regnum < regcache->descr->nr_raw_register= s); > =A0buf =3D alloca (regcache->descr->sizeof_register[regnum]); > =A0regcache_raw_read (regcache, regnum, buf); > =A0(*val) =3D extract_unsigned_integer > =A0 =A0 =A0 =A0 =A0 =A0 (buf, regcache->descr->sizeof_register[regnum], > =A0 =A0 =A0 =A0 =A0 =A0 =A0gdbarch_byte_order (regcache->descr->gdbarch)); > } > > It just add a "extract_unsigned_integer". =A0For this code, it in > i386-linux-tdep.c. =A0We know that I386_EAX_REGNUM is 32 bits. =A0So we > don't need extract_unsigned_integer to set anything. > > Thanks, > Hui Oops, I forget that we have the byte order trouble. Thanks for remind me. I will fix it. 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.00000= 0000 +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 d= oesn't " >>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "support syscall = number %u\n"), tmpu32); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "support syscall = number %u\n"), (unsigned) tmpu32); >>> =A0 =A0 =A0 =A0return -1; >>> =A0 =A0 =A0} >>> >> >