From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4008 invoked by alias); 5 Sep 2009 20:34:06 -0000 Received: (qmail 4000 invoked by uid 22791); 5 Sep 2009 20:34:06 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 05 Sep 2009 20:34:01 +0000 Received: from mailhost2.vmware.com (mailhost2.vmware.com [10.16.67.167]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id D92FB4007; Sat, 5 Sep 2009 13:33:56 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost2.vmware.com (Postfix) with ESMTP id F29D68E7C8; Sat, 5 Sep 2009 13:33:56 -0700 (PDT) Message-ID: <4AA2CAFA.809@vmware.com> Date: Sat, 05 Sep 2009 20:34:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Hui Zhu CC: Mark Kettenis , "gdb-patches@sourceware.org" , freephp@gmail.com Subject: Re: [PATCH] Fix cygwin build error with i386-linux-tdep.c References: <200908301356.n7UDuO4a006136@brahms.sibelius.xs4all.nl> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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-09/txt/msg00133.txt.bz2 Hui Zhu wrote: > Hi guys, > > I make a new patch that change regcache_raw_read to regcache_raw_read_unsigned. > Please help me review it. > > Thanks, > Hui > > 2009-08-31 Hui Zhu > > * i386-linux-tdep.c (i386_linux_intx80_sysenter_record): Change > regcache_raw_read to regcache_raw_read_unsigned. > > --- > i386-linux-tdep.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > --- a/i386-linux-tdep.c > +++ b/i386-linux-tdep.c > @@ -367,18 +367,18 @@ static int > i386_linux_intx80_sysenter_record (struct regcache *regcache) > { > int ret; > - uint32_t tmpu32; > + ULONGEST num; I like Mark's suggestion of calling it "syscall". Calling it "num" is not much better than calling it "tmp". ;-) Now, talking about signed vs. unsigned vs. casts... You declared it a ULONGEST because that's what regcache_raw_read_unsigned expects, right? -- fair enough. See below. > - regcache_raw_read (regcache, I386_EAX_REGNUM, (gdb_byte *) &tmpu32); > + regcache_raw_read_unsigned (regcache, I386_EAX_REGNUM, &num); > > - if (tmpu32 > 499) > + if (num > 499) > { > printf_unfiltered (_("Process record and replay target doesn't " > - "support syscall number %u\n"), tmpu32); > + "support syscall number %d\n"), (int) num); > return -1; > } > > - ret = record_linux_system_call (tmpu32, regcache, > + ret = record_linux_system_call ((int) num, regcache, > &i386_linux_record_tdep); But here you cast it to int because that's what record_linux_system_call expects, right? And since we know at this point that the value is between 0 and 499, the cast can't really do any harm, so it seems fair. I could suggest casting it to (unsigned int), but it wouldn't really make any difference, would it? Mark -- Jiang -- would that make you guys more comfortable? Or would it be more correct to change the prototype of linux-record-system-call so that it expects an unsigned int? > if (ret) > return ret; >