Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: Pierre Muller <muller@ics.u-strasbg.fr>
Cc: gdb-patches@sourceware.org, Michael Snyder <msnyder@vmware.com>,
	 	Pedro Alves <pedro@codesourcery.com>
Subject: Re: Process record and replay checked in to main trunk
Date: Fri, 08 May 2009 05:12:00 -0000	[thread overview]
Message-ID: <daef60380905072211p3fbd2591j8e12041ed96c452@mail.gmail.com> (raw)
In-Reply-To: <200905080006.19166.pedro@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]

Hi Pierre,

I make a patch to fix this bug, but I don't have cygwin.

Could you please help me test this patch in cygwin?

Thanks,
Hui

On Fri, May 8, 2009 at 07:06, Pedro Alves <pedro@codesourcery.com> wrote:
> On Thursday 07 May 2009 23:43:13, Michael Snyder wrote:
>> Guessing it isn't implemented for 64 bit.
>
> I don't think that's the problem here.  Cygwin is 32-bit, and has 32-bit
> ints.
>
>> ../../purecvs/gdb/linux-record.c:397: warning: unsigned int format, uint32_t
>> arg
>
>> ../../purecvs/gdb/linux-record.c:629: warning: int format, uint32_t arg (arg
>
> Better use casts, or use plongest/pulongest/hex_string where appropriate?
>
>> Perhaps we should have a --disable-process-record config option?
>> If only for a back-up plan?
>
> I think that would be more work than fixing this properly.  :-)
>
>> ../../purecvs/gdb/linux-record.c:1636: error: `F_GETLK64' undeclared (first
>> use
>> in this function)
>
> There are a bunch of RECORD_* macros defined on top of linux-record.c
> to replace contants like these.  E.g., RECORD_Q_GETFMT.  Looks like
> this case was just missed.
>
> --
> Pedro Alves
>

[-- Attachment #2: fix-prec-cygwin-build-error.txt --]
[-- Type: text/plain, Size: 4434 bytes --]

---
 i386-linux-tdep.c |   14 ++++++++++++++
 linux-record.c    |   28 +++++++++++++---------------
 linux-record.h    |    7 +++++++
 3 files changed, 34 insertions(+), 15 deletions(-)

--- a/i386-linux-tdep.c
+++ b/i386-linux-tdep.c
@@ -586,6 +586,14 @@ static int i386_linux_sc_reg_offset[] =
 #define I386_LINUX_RECORD_IOCTL_TIOCSHAYESESP		0x545F
 #define I386_LINUX_RECORD_IOCTL_FIOQSIZE		0x5460
 
+/* The values of the second argument of system call "sys_fcntl"
+   and "sys_fcntl64".  The values of these macros were obtained from
+   Linux Kernel source.  */
+#define I386_LINUX_RECORD_FCNTL_F_GETLK			5
+#define I386_LINUX_RECORD_FCNTL_F_GETLK64		12
+#define I386_LINUX_RECORD_FCNTL_F_SETLK64		13
+#define I386_LINUX_RECORD_FCNTL_F_SETLKW64		14
+
 static void
 i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -781,6 +789,12 @@ i386_linux_init_abi (struct gdbarch_info
     I386_LINUX_RECORD_IOCTL_TIOCSHAYESESP;
   i386_linux_record_tdep.ioctl_FIOQSIZE = I386_LINUX_RECORD_IOCTL_FIOQSIZE;
 
+  i386_linux_record_tdep.fcntl_F_GETLK = I386_LINUX_RECORD_FCNTL_F_GETLK;
+  i386_linux_record_tdep.fcntl_F_GETLK64 = I386_LINUX_RECORD_FCNTL_F_GETLK64;
+  i386_linux_record_tdep.fcntl_F_SETLK64 = I386_LINUX_RECORD_FCNTL_F_SETLK64;
+  i386_linux_record_tdep.fcntl_F_SETLKW64 =
+    I386_LINUX_RECORD_FCNTL_F_SETLKW64;
+
   i386_linux_record_tdep.arg1 = I386_EBX_REGNUM;
   i386_linux_record_tdep.arg2 = I386_ECX_REGNUM;
   i386_linux_record_tdep.arg3 = I386_EDX_REGNUM;
--- a/linux-record.c
+++ b/linux-record.c
@@ -394,7 +394,7 @@ record_linux_system_call (int num, struc
 	{
 	  printf_unfiltered (_("Process record and replay target doesn't "
 			       "support ioctl request 0x%08x.\n"),
-			     tmpu32);
+			     (int)tmpu32);
 	  return 1;
 	}
       break;
@@ -404,7 +404,7 @@ record_linux_system_call (int num, struc
       /* XXX */
       regcache_raw_read (regcache, tdep->arg2, (gdb_byte *) & tmpu32);
     sys_fcntl:
-      if (tmpu32 == F_GETLK)
+      if (tmpu32 == tdep->fcntl_F_GETLK)
 	{
 	  regcache_raw_read (regcache, tdep->arg3,
 			     (gdb_byte *) & tmpu32);
@@ -626,7 +626,7 @@ record_linux_system_call (int num, struc
 		    "It will free the memory addr = 0x%s len = %d.  "
 		    "It will make record target get error.  "
 		    "Do you want to stop the program?"),
-		  paddr_nz (tmpu32), len);
+		  paddr_nz (tmpu32), (int)len);
 	target_terminal_inferior ();
 	if (q)
 	  return 1;
@@ -935,7 +935,7 @@ record_linux_system_call (int num, struc
 	default:
 	  printf_unfiltered (_("Process record and replay target "
 			       "doesn't support socketcall call 0x%08x\n"),
-			     tmpu32);
+			     (int)tmpu32);
 	  return -1;
 	  break;
 	}
@@ -1631,20 +1631,17 @@ record_linux_system_call (int num, struc
       /* sys_fcntl64 */
     case 221:
       regcache_raw_read (regcache, tdep->arg2, (gdb_byte *) & tmpu32);
-      switch (tmpu32)
-	{
-	case F_GETLK64:
+      if (tmpu32 == tdep->fcntl_F_GETLK64)
+        {
 	  regcache_raw_read (regcache, tdep->arg3,
 			     (gdb_byte *) & tmpu32);
 	  if (record_arch_list_add_mem (tmpu32, tdep->size_flock64))
 	    return -1;
-	  break;
-	case F_SETLK64:
-	case F_SETLKW64:
-	  break;
-	default:
+	}
+      else if (tmpu32 != tdep->fcntl_F_SETLK64
+	       && tmpu32 != tdep->fcntl_F_SETLKW64)
+        {
 	  goto sys_fcntl;
-	  break;
 	}
       break;
 
@@ -1786,7 +1783,8 @@ record_linux_system_call (int num, struc
 		fprintf_unfiltered (gdb_stdlog,
 				    "Process record: error reading memory "
 				    "at addr = 0x%s len = %d.\n",
-				    paddr_nz (tmpu32), nr * tdep->size_int);
+				    paddr_nz (tmpu32),
+				    (int)(nr * tdep->size_int));
 	      return -1;
 	    }
 	  for (i = 0; i < nr; i++)
@@ -2196,7 +2194,7 @@ record_linux_system_call (int num, struc
     default:
       printf_unfiltered (_("Process record and replay target doesn't "
 			   "support syscall number 0x%08x\n"),
-			 tmpu32);
+			 (int)tmpu32);
       return -1;
       break;
     }
--- a/linux-record.h
+++ b/linux-record.h
@@ -158,6 +158,13 @@ struct linux_record_tdep
   int ioctl_TIOCSHAYESESP;
   int ioctl_FIOQSIZE;
 
+  /* The values of the second argument of system call "sys_fcntl"
+     and "sys_fcntl64".  */
+  int fcntl_F_GETLK;
+  int fcntl_F_GETLK64;
+  int fcntl_F_SETLK64;
+  int fcntl_F_SETLKW64;
+
   /* The number of the registers that are used as the arguments of
      a system call.  */
   int arg1;

  reply	other threads:[~2009-05-08  5:12 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30  7:59 Hui Zhu
2009-04-30 14:43 ` Marc Khouzam
2009-04-30 20:00   ` Michael Snyder
2009-05-01  9:16 ` Eli Zaretskii
2009-05-01 17:02   ` Hui Zhu
2009-05-01 17:55     ` Eli Zaretskii
2009-05-03 14:15       ` Hui Zhu
2009-05-04 11:17         ` Eli Zaretskii
2009-05-04 16:46           ` Michael Snyder
2009-05-05 13:48           ` Hui Zhu
2009-05-04 14:32         ` Marc Khouzam
2009-05-04 16:46           ` Eli Zaretskii
2009-05-05 14:11           ` Hui Zhu
2009-05-01  9:26 ` Eli Zaretskii
2009-05-01 17:08   ` Hui Zhu
2009-05-01 17:58     ` Eli Zaretskii
2009-05-01 13:28 ` Eli Zaretskii
2009-05-03 13:54   ` Hui Zhu
2009-05-04 11:15     ` Eli Zaretskii
2009-05-05 13:40       ` Hui Zhu
2009-05-05 19:01         ` Eli Zaretskii
2009-05-05 19:32           ` Mark Kettenis
2009-05-05 19:52             ` Eli Zaretskii
2009-05-06 13:34               ` Hui Zhu
     [not found] ` <daef60380904300102o4470ac45he41f6b72176b1947@mail.gmail.com>
2009-05-07 22:24   ` Pierre Muller
2009-05-07 22:52     ` Michael Snyder
2009-05-07 23:05       ` Pedro Alves
2009-05-08  5:12         ` Hui Zhu [this message]
2009-05-08 12:11           ` Pierre Muller
2009-05-10 17:28             ` Hui Zhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=daef60380905072211p3fbd2591j8e12041ed96c452@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.com \
    --cc=muller@ics.u-strasbg.fr \
    --cc=pedro@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox