From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10205 invoked by alias); 10 May 2009 18:07:39 -0000 Received: (qmail 10193 invoked by uid 22791); 10 May 2009 18:07:38 -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 ti-out-0910.google.com (HELO ti-out-0910.google.com) (209.85.142.187) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 10 May 2009 18:07:32 +0000 Received: by ti-out-0910.google.com with SMTP id a1so206691tib.12 for ; Sun, 10 May 2009 11:07:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.110.41.20 with SMTP id o20mr405119tio.16.1241978849399; Sun, 10 May 2009 11:07:29 -0700 (PDT) In-Reply-To: <20090510174809.GA25909@ednor.casa.cgf.cx> References: <20090510174809.GA25909@ednor.casa.cgf.cx> Date: Sun, 10 May 2009 18:07:00 -0000 Message-ID: Subject: Re: [Prec/RFA] fix build error of prec in cygwin From: Hui Zhu To: Hui Zhu , 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-05/txt/msg00195.txt.bz2 On Mon, May 11, 2009 at 01:48, Christopher Faylor wrote: > On Mon, May 11, 2009 at 01:31:18AM +0800, Hui Zhu wrote: >>--- a/i386-linux-tdep.c >>+++ b/i386-linux-tdep.c >>@@ -586,6 +586,14 @@ static int i386_linux_sc_reg_offset[] =3D >> #define I386_LINUX_RECORD_IOCTL_TIOCSHAYESESP =A0 =A0 =A0 =A0 0x545F >> #define I386_LINUX_RECORD_IOCTL_FIOQSIZE =A0 =A0 =A0 =A0 =A0 =A0 =A00x54= 60 >> >>+/* The values of the second argument of system call "sys_fcntl" >>+ =A0 and "sys_fcntl64". =A0The values of these macros were obtained from >>+ =A0 Linux Kernel source. =A0*/ >>+#define I386_LINUX_RECORD_FCNTL_F_GETLK =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 5 >>+#define I386_LINUX_RECORD_FCNTL_F_GETLK64 =A0 =A0 =A0 =A0 =A0 =A0 12 >>+#define I386_LINUX_RECORD_FCNTL_F_SETLK64 =A0 =A0 =A0 =A0 =A0 =A0 13 >>+#define I386_LINUX_RECORD_FCNTL_F_SETLKW64 =A0 =A0 =A0 =A0 =A0 =A014 >>+ >> static void >> i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) >> { >>@@ -781,6 +789,12 @@ i386_linux_init_abi (struct gdbarch_info >> =A0 =A0 I386_LINUX_RECORD_IOCTL_TIOCSHAYESESP; >> =A0 i386_linux_record_tdep.ioctl_FIOQSIZE =3D I386_LINUX_RECORD_IOCTL_FI= OQSIZE; >> >>+ =A0i386_linux_record_tdep.fcntl_F_GETLK =3D I386_LINUX_RECORD_FCNTL_F_G= ETLK; >>+ =A0i386_linux_record_tdep.fcntl_F_GETLK64 =3D I386_LINUX_RECORD_FCNTL_F= _GETLK64; >>+ =A0i386_linux_record_tdep.fcntl_F_SETLK64 =3D I386_LINUX_RECORD_FCNTL_F= _SETLK64; >>+ =A0i386_linux_record_tdep.fcntl_F_SETLKW64 =3D >>+ =A0 =A0I386_LINUX_RECORD_FCNTL_F_SETLKW64; >>+ >> =A0 i386_linux_record_tdep.arg1 =3D I386_EBX_REGNUM; >> =A0 i386_linux_record_tdep.arg2 =3D I386_ECX_REGNUM; >> =A0 i386_linux_record_tdep.arg3 =3D I386_EDX_REGNUM; >>--- a/linux-record.c >>+++ b/linux-record.c >>@@ -394,7 +394,7 @@ record_linux_system_call (int num, struc >> =A0 =A0 =A0 { >> =A0 =A0 =A0 =A0 printf_unfiltered (_("Process record and replay target d= oesn't " >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"support ioct= l request 0x%08x.\n"), >>- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tmpu32); >>+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (int)tmpu32); > > How did a 0x%08x make it into the source after the "2009/04/17 15:44:28" > change which changed all %p's to host_address_to_string? =A0Shouldn't > this just be a call to host_address_to_string? > I am not sure %p or host_address_to_string is right. It is not a address. Just a simple value. >> =A0 =A0 =A0 =A0 return 1; >> =A0 =A0 =A0 } >> =A0 =A0 =A0 break; >>@@ -404,7 +404,7 @@ record_linux_system_call (int num, struc >> =A0 =A0 =A0 /* XXX */ >> =A0 =A0 =A0 regcache_raw_read (regcache, tdep->arg2, (gdb_byte *) & tmpu= 32); >> =A0 =A0 sys_fcntl: >>- =A0 =A0 =A0if (tmpu32 =3D=3D F_GETLK) >>+ =A0 =A0 =A0if (tmpu32 =3D=3D tdep->fcntl_F_GETLK) >> =A0 =A0 =A0 { >> =A0 =A0 =A0 =A0 regcache_raw_read (regcache, tdep->arg3, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(gdb_byte *) & tm= pu32); >>@@ -626,7 +626,7 @@ record_linux_system_call (int num, struc >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "It will free the memory addr =3D 0x= %s len =3D %d. =A0" >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "It will make record target get erro= r. =A0" >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Do you want to stop the program?"), >>- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0paddr_nz (tmpu32), len); >>+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0paddr_nz (tmpu32), (int)len); > > If len is a uint32_t isn't casting it to an int the wrong thing to do? > Looking at the code, len is first defined as uint32_t, then a pointer to > it is cast as (gdb_byte *) (and it doesn't look like the space following > the '&' doesn't follow GNU coding standards). =A0So it is never actually > used as a uint32_t. =A0That doesn't seem right. > Use uint32_t because it's a 32 bits register's value. >> =A0 =A0 =A0 target_terminal_inferior (); >> =A0 =A0 =A0 if (q) >> =A0 =A0 =A0 =A0 return 1; >>@@ -935,7 +935,7 @@ record_linux_system_call (int num, struc >> =A0 =A0 =A0 default: >> =A0 =A0 =A0 =A0 printf_unfiltered (_("Process record and replay target " >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"doesn't supp= ort socketcall call 0x%08x\n"), >>- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tmpu32); >>+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (int)tmpu32); > > Same observation. =A0This cast seems wrong. > >> =A0 =A0 =A0 =A0 return -1; >> =A0 =A0 =A0 =A0 break; >> =A0 =A0 =A0 } >>@@ -1631,20 +1631,17 @@ record_linux_system_call (int num, struc >> =A0 =A0 =A0 /* sys_fcntl64 */ >> =A0 =A0 case 221: >> =A0 =A0 =A0 regcache_raw_read (regcache, tdep->arg2, (gdb_byte *) & tmpu= 32); >>- =A0 =A0 =A0switch (tmpu32) >>- =A0 =A0 =A0{ >>- =A0 =A0 =A0case F_GETLK64: >>+ =A0 =A0 =A0if (tmpu32 =3D=3D tdep->fcntl_F_GETLK64) >>+ =A0 =A0 =A0 =A0{ >> =A0 =A0 =A0 =A0 regcache_raw_read (regcache, tdep->arg3, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(gdb_byte *) & tm= pu32); >> =A0 =A0 =A0 =A0 if (record_arch_list_add_mem (tmpu32, tdep->size_flock64= )) >> =A0 =A0 =A0 =A0 =A0 return -1; >>- =A0 =A0 =A0 =A0break; >>- =A0 =A0 =A0case F_SETLK64: >>- =A0 =A0 =A0case F_SETLKW64: >>- =A0 =A0 =A0 =A0break; >>- =A0 =A0 =A0default: >>+ =A0 =A0 =A0} >>+ =A0 =A0 =A0else if (tmpu32 !=3D tdep->fcntl_F_SETLK64 >>+ =A0 =A0 =A0 =A0 =A0 =A0 && tmpu32 !=3D tdep->fcntl_F_SETLKW64) >>+ =A0 =A0 =A0 =A0{ >> =A0 =A0 =A0 =A0 goto sys_fcntl; >>- =A0 =A0 =A0 =A0break; >> =A0 =A0 =A0 } >> =A0 =A0 =A0 break; >> >>@@ -1786,7 +1783,8 @@ record_linux_system_call (int num, struc >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 fprintf_unfiltered (gdb_stdlog, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Pro= cess record: error reading memory " >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "at = addr =3D 0x%s len =3D %d.\n", >>- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0padd= r_nz (tmpu32), nr * tdep->size_int); >>+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0padd= r_nz (tmpu32), >>+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(int= )(nr * tdep->size_int)); > > ...and so on... >> =A0 =A0 =A0 =A0 =A0 =A0 return -1; >> =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 for (i =3D 0; i < nr; i++) >>@@ -2196,7 +2194,7 @@ record_linux_system_call (int num, struc >> =A0 =A0 default: >> =A0 =A0 =A0 printf_unfiltered (_("Process record and replay target doesn= 't " >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"support syscall numb= er 0x%08x\n"), >>- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tmpu32); >>+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (int)tmpu32); > > ...and so on... >