Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA record/replay] cast to avoid compiler warning
@ 2008-10-04 18:45 Michael Snyder
  2008-10-04 21:53 ` Mark Kettenis
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Snyder @ 2008-10-04 18:45 UTC (permalink / raw)
  To: gdb-patches, teawater

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

Sizeof returns size_t, which is not always the same as int.
This cast will prevent compiler warnings on some architectures
(eg. x86_64)


[-- Attachment #2: sizeof.txt --]
[-- Type: text/plain, Size: 4728 bytes --]

2008-10-03  Michael Snyder  <msnyder@promb-2s-dhcp59.eng.vmware.com>

	* linux-record.c (record_linux_system_call): Cast sizeof to int
	in printf calls, avoid compiler warnings on 64 bit hosts.

Index: linux-record.c
===================================================================
RCS file: /cvs/src/src/gdb/Attic/linux-record.c,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 linux-record.c
--- linux-record.c	7 Sep 2008 01:40:43 -0000	1.1.2.4
+++ linux-record.c	3 Oct 2008 23:04:20 -0000
@@ -597,7 +597,7 @@ record_linux_system_call (int num, linux
 	      {
 		fprintf_unfiltered (gdb_stdlog,
 				    "Record: read memory addr = 0x%s len = %d error.\n",
-				    paddr_nz (tmpu32), sizeof (sel));
+				    paddr_nz (tmpu32), (int) sizeof (sel));
 		return (-1);
 	      }
 	    if (record_arch_list_add_mem (sel.inp, tdep->size_fd_set))
@@ -749,7 +749,7 @@ record_linux_system_call (int num, linux
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					paddr_nz (tmpu32), (int) sizeof (a));
 		    return (-1);
 		  }
 		if (record_arch_list_add_mem (a[1], tdep->size_sockaddr))
@@ -775,7 +775,7 @@ record_linux_system_call (int num, linux
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					paddr_nz (tmpu32), (int) sizeof (a));
 		    return (-1);
 		  }
 		if (record_arch_list_add_mem (a[3], tdep->size_int))
@@ -799,7 +799,7 @@ record_linux_system_call (int num, linux
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					paddr_nz (tmpu32), (int) sizeof (a));
 		    return (-1);
 		  }
 		if (a[2])
@@ -809,7 +809,7 @@ record_linux_system_call (int num, linux
 		      {
 			fprintf_unfiltered (gdb_stdlog,
 					    "Record: read memory addr = 0x%s len = %d error.\n",
-					    paddr_nz (a[2]), sizeof (a[2]));
+					    paddr_nz (a[2]), (int) sizeof (a[2]));
 			return (-1);
 		      }
 		    if (record_arch_list_add_mem (a[1], a[2]))
@@ -831,7 +831,7 @@ record_linux_system_call (int num, linux
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					paddr_nz (tmpu32), (int) sizeof (a));
 		    return (-1);
 		  }
 		if (a[2])
@@ -841,7 +841,7 @@ record_linux_system_call (int num, linux
 		      {
 			fprintf_unfiltered (gdb_stdlog,
 					    "Record: read memory addr = 0x%s len = %d error.\n",
-					    paddr_nz (a[2]), sizeof (a[2]));
+					    paddr_nz (a[2]), (int) sizeof (a[2]));
 			return (-1);
 		      }
 		    if (record_arch_list_add_mem (a[1], a[2]))
@@ -876,7 +876,7 @@ record_linux_system_call (int num, linux
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					paddr_nz (tmpu32), (int) sizeof (a));
 		    return (-1);
 		  }
 		if (a[4])
@@ -886,7 +886,7 @@ record_linux_system_call (int num, linux
 		      {
 			fprintf_unfiltered (gdb_stdlog,
 					    "Record: read memory addr = 0x%s len = %d error.\n",
-					    paddr_nz (a[4]), sizeof (av));
+					    paddr_nz (a[4]), (int) sizeof (av));
 			return (-1);
 		      }
 		    if (record_arch_list_add_mem (a[3], av))
@@ -930,7 +930,7 @@ record_linux_system_call (int num, linux
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					paddr_nz (tmpu32), (int) sizeof (a));
 		    return (-1);
 		  }
 		if (record_arch_list_add_mem (a[1], tdep->size_msghdr))
@@ -944,7 +944,7 @@ record_linux_system_call (int num, linux
 		      {
 			fprintf_unfiltered (gdb_stdlog,
 					    "Record: read memory addr = 0x%s len = %d error.\n",
-					    paddr_nz (a[1]), sizeof (rec));
+					    paddr_nz (a[1]), (int) sizeof (rec));
 			return (-1);
 		      }
 		    if (record_arch_list_add_mem
@@ -968,7 +968,7 @@ record_linux_system_call (int num, linux
 				fprintf_unfiltered (gdb_stdlog,
 						    "Record: read memory addr = 0x%s len = %d error.\n",
 						    paddr_nz (rec.msg_iov),
-						    sizeof (iov));
+						    (int) sizeof (iov));
 				return (-1);
 			      }
 			    if (record_arch_list_add_mem
@@ -1336,7 +1336,7 @@ record_linux_system_call (int num, linux
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
 					paddr_nz (vec),
-					sizeof (struct record_iovec));
+					(int) sizeof (struct record_iovec));
 		    return (-1);
 		  }
 		if (record_arch_list_add_mem (iov.iov_base, iov.iov_len))

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA record/replay] cast to avoid compiler warning
  2008-10-04 18:45 [RFA record/replay] cast to avoid compiler warning Michael Snyder
@ 2008-10-04 21:53 ` Mark Kettenis
  2008-10-05  7:12   ` Andreas Schwab
  2008-10-05 12:17   ` Mark Wielaard
  0 siblings, 2 replies; 14+ messages in thread
From: Mark Kettenis @ 2008-10-04 21:53 UTC (permalink / raw)
  To: msnyder; +Cc: gdb-patches, teawater

> Date: Sat, 04 Oct 2008 11:42:47 -0700
> From: Michael Snyder <msnyder@vmware.com>
> 
> Sizeof returns size_t, which is not always the same as int.
> This cast will prevent compiler warnings on some architectures
> (eg. x86_64)

This is wrong!  Better cast to unsigned long and print as %lu.

There is a C99 way to do this, but not all systems implement it properly.

> 2008-10-03  Michael Snyder  <msnyder@promb-2s-dhcp59.eng.vmware.com>
> 
> 	* linux-record.c (record_linux_system_call): Cast sizeof to int
> 	in printf calls, avoid compiler warnings on 64 bit hosts.
> 
> Index: linux-record.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/Attic/linux-record.c,v
> retrieving revision 1.1.2.4
> diff -u -p -r1.1.2.4 linux-record.c
> --- linux-record.c	7 Sep 2008 01:40:43 -0000	1.1.2.4
> +++ linux-record.c	3 Oct 2008 23:04:20 -0000
> @@ -597,7 +597,7 @@ record_linux_system_call (int num, linux
>  	      {
>  		fprintf_unfiltered (gdb_stdlog,
>  				    "Record: read memory addr = 0x%s len = %d error.\n",
> -				    paddr_nz (tmpu32), sizeof (sel));
> +				    paddr_nz (tmpu32), (int) sizeof (sel));
>  		return (-1);
>  	      }
>  	    if (record_arch_list_add_mem (sel.inp, tdep->size_fd_set))
> @@ -749,7 +749,7 @@ record_linux_system_call (int num, linux
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
>  					"Record: read memory addr = 0x%s len = %d error.\n",
> -					paddr_nz (tmpu32), sizeof (a));
> +					paddr_nz (tmpu32), (int) sizeof (a));
>  		    return (-1);
>  		  }
>  		if (record_arch_list_add_mem (a[1], tdep->size_sockaddr))
> @@ -775,7 +775,7 @@ record_linux_system_call (int num, linux
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
>  					"Record: read memory addr = 0x%s len = %d error.\n",
> -					paddr_nz (tmpu32), sizeof (a));
> +					paddr_nz (tmpu32), (int) sizeof (a));
>  		    return (-1);
>  		  }
>  		if (record_arch_list_add_mem (a[3], tdep->size_int))
> @@ -799,7 +799,7 @@ record_linux_system_call (int num, linux
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
>  					"Record: read memory addr = 0x%s len = %d error.\n",
> -					paddr_nz (tmpu32), sizeof (a));
> +					paddr_nz (tmpu32), (int) sizeof (a));
>  		    return (-1);
>  		  }
>  		if (a[2])
> @@ -809,7 +809,7 @@ record_linux_system_call (int num, linux
>  		      {
>  			fprintf_unfiltered (gdb_stdlog,
>  					    "Record: read memory addr = 0x%s len = %d error.\n",
> -					    paddr_nz (a[2]), sizeof (a[2]));
> +					    paddr_nz (a[2]), (int) sizeof (a[2]));
>  			return (-1);
>  		      }
>  		    if (record_arch_list_add_mem (a[1], a[2]))
> @@ -831,7 +831,7 @@ record_linux_system_call (int num, linux
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
>  					"Record: read memory addr = 0x%s len = %d error.\n",
> -					paddr_nz (tmpu32), sizeof (a));
> +					paddr_nz (tmpu32), (int) sizeof (a));
>  		    return (-1);
>  		  }
>  		if (a[2])
> @@ -841,7 +841,7 @@ record_linux_system_call (int num, linux
>  		      {
>  			fprintf_unfiltered (gdb_stdlog,
>  					    "Record: read memory addr = 0x%s len = %d error.\n",
> -					    paddr_nz (a[2]), sizeof (a[2]));
> +					    paddr_nz (a[2]), (int) sizeof (a[2]));
>  			return (-1);
>  		      }
>  		    if (record_arch_list_add_mem (a[1], a[2]))
> @@ -876,7 +876,7 @@ record_linux_system_call (int num, linux
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
>  					"Record: read memory addr = 0x%s len = %d error.\n",
> -					paddr_nz (tmpu32), sizeof (a));
> +					paddr_nz (tmpu32), (int) sizeof (a));
>  		    return (-1);
>  		  }
>  		if (a[4])
> @@ -886,7 +886,7 @@ record_linux_system_call (int num, linux
>  		      {
>  			fprintf_unfiltered (gdb_stdlog,
>  					    "Record: read memory addr = 0x%s len = %d error.\n",
> -					    paddr_nz (a[4]), sizeof (av));
> +					    paddr_nz (a[4]), (int) sizeof (av));
>  			return (-1);
>  		      }
>  		    if (record_arch_list_add_mem (a[3], av))
> @@ -930,7 +930,7 @@ record_linux_system_call (int num, linux
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
>  					"Record: read memory addr = 0x%s len = %d error.\n",
> -					paddr_nz (tmpu32), sizeof (a));
> +					paddr_nz (tmpu32), (int) sizeof (a));
>  		    return (-1);
>  		  }
>  		if (record_arch_list_add_mem (a[1], tdep->size_msghdr))
> @@ -944,7 +944,7 @@ record_linux_system_call (int num, linux
>  		      {
>  			fprintf_unfiltered (gdb_stdlog,
>  					    "Record: read memory addr = 0x%s len = %d error.\n",
> -					    paddr_nz (a[1]), sizeof (rec));
> +					    paddr_nz (a[1]), (int) sizeof (rec));
>  			return (-1);
>  		      }
>  		    if (record_arch_list_add_mem
> @@ -968,7 +968,7 @@ record_linux_system_call (int num, linux
>  				fprintf_unfiltered (gdb_stdlog,
>  						    "Record: read memory addr = 0x%s len = %d error.\n",
>  						    paddr_nz (rec.msg_iov),
> -						    sizeof (iov));
> +						    (int) sizeof (iov));
>  				return (-1);
>  			      }
>  			    if (record_arch_list_add_mem
> @@ -1336,7 +1336,7 @@ record_linux_system_call (int num, linux
>  		    fprintf_unfiltered (gdb_stdlog,
>  					"Record: read memory addr = 0x%s len = %d error.\n",
>  					paddr_nz (vec),
> -					sizeof (struct record_iovec));
> +					(int) sizeof (struct record_iovec));
>  		    return (-1);
>  		  }
>  		if (record_arch_list_add_mem (iov.iov_base, iov.iov_len))


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA record/replay] cast to avoid compiler warning
  2008-10-04 21:53 ` Mark Kettenis
@ 2008-10-05  7:12   ` Andreas Schwab
  2008-10-05  9:54     ` Mark Kettenis
  2008-10-05 12:17   ` Mark Wielaard
  1 sibling, 1 reply; 14+ messages in thread
From: Andreas Schwab @ 2008-10-05  7:12 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: msnyder, gdb-patches, teawater

Mark Kettenis <mark.kettenis@xs4all.nl> writes:

>> Date: Sat, 04 Oct 2008 11:42:47 -0700
>> From: Michael Snyder <msnyder@vmware.com>
>> 
>> Sizeof returns size_t, which is not always the same as int.
>> This cast will prevent compiler warnings on some architectures
>> (eg. x86_64)
>
> This is wrong!  Better cast to unsigned long and print as %lu.

The value will always be a small number.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA record/replay] cast to avoid compiler warning
  2008-10-05  7:12   ` Andreas Schwab
@ 2008-10-05  9:54     ` Mark Kettenis
  2008-10-05 11:02       ` Andreas Schwab
  0 siblings, 1 reply; 14+ messages in thread
From: Mark Kettenis @ 2008-10-05  9:54 UTC (permalink / raw)
  To: schwab; +Cc: msnyder, gdb-patches, teawater

> From: Andreas Schwab <schwab@suse.de>
> Date: Sun, 05 Oct 2008 09:11:27 +0200
> 
> Mark Kettenis <mark.kettenis@xs4all.nl> writes:
> 
> >> Date: Sat, 04 Oct 2008 11:42:47 -0700
> >> From: Michael Snyder <msnyder@vmware.com>
> >> 
> >> Sizeof returns size_t, which is not always the same as int.
> >> This cast will prevent compiler warnings on some architectures
> >> (eg. x86_64)
> >
> > This is wrong!  Better cast to unsigned long and print as %lu.
> 
> The value will always be a small number.

It is still a bad example.  People may copy the idiom and uses it on
cases where the value is not a small number.  Why rely on the fact
that it always will be a small number if you can fix it properly?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA record/replay] cast to avoid compiler warning
  2008-10-05  9:54     ` Mark Kettenis
@ 2008-10-05 11:02       ` Andreas Schwab
  0 siblings, 0 replies; 14+ messages in thread
From: Andreas Schwab @ 2008-10-05 11:02 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: msnyder, gdb-patches, teawater

Mark Kettenis <mark.kettenis@xs4all.nl> writes:

>> From: Andreas Schwab <schwab@suse.de>
>> Date: Sun, 05 Oct 2008 09:11:27 +0200
>> 
>> Mark Kettenis <mark.kettenis@xs4all.nl> writes:
>> 
>> >> Date: Sat, 04 Oct 2008 11:42:47 -0700
>> >> From: Michael Snyder <msnyder@vmware.com>
>> >> 
>> >> Sizeof returns size_t, which is not always the same as int.
>> >> This cast will prevent compiler warnings on some architectures
>> >> (eg. x86_64)
>> >
>> > This is wrong!  Better cast to unsigned long and print as %lu.
>> 
>> The value will always be a small number.
>
> It is still a bad example.  People may copy the idiom and uses it on
> cases where the value is not a small number.

If sizeof returns a too big number you should probably rethink your data
types.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA record/replay] cast to avoid compiler warning
  2008-10-04 21:53 ` Mark Kettenis
  2008-10-05  7:12   ` Andreas Schwab
@ 2008-10-05 12:17   ` Mark Wielaard
  2008-10-05 15:47     ` Michael Snyder
  1 sibling, 1 reply; 14+ messages in thread
From: Mark Wielaard @ 2008-10-05 12:17 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: msnyder, gdb-patches, teawater

On Sat, 2008-10-04 at 23:52 +0200, Mark Kettenis wrote:
> > Date: Sat, 04 Oct 2008 11:42:47 -0700
> > From: Michael Snyder <msnyder@vmware.com>
> > 
> > Sizeof returns size_t, which is not always the same as int.
> > This cast will prevent compiler warnings on some architectures
> > (eg. x86_64)
> 
> This is wrong!  Better cast to unsigned long and print as %lu.
> 
> There is a C99 way to do this, but not all systems implement it properly.

gnulib provides a posix compatible printf that understands %z for
size_t:
http://www.gnu.org/software/gnulib/manual/html_node/printf.html

Cheers,

Mark


^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [RFA record/replay] cast to avoid compiler warning
  2008-10-05 12:17   ` Mark Wielaard
@ 2008-10-05 15:47     ` Michael Snyder
  2008-10-05 16:05       ` Daniel Jacobowitz
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Snyder @ 2008-10-05 15:47 UTC (permalink / raw)
  To: Mark Wielaard, Mark Kettenis; +Cc: gdb-patches, teawater

Yes, but we don't know that gdb will always be built using gnulib.

Mark, I recognize your objection, and I'll change it with some reluctance,
but I really think you're making too big a deal out of it...

________________________________________
From: gdb-patches-owner@sourceware.org [gdb-patches-owner@sourceware.org] On Behalf Of Mark Wielaard [mark@klomp.org]
Sent: Sunday, October 05, 2008 5:16 AM
To: Mark Kettenis
Cc: Michael Snyder; gdb-patches@sourceware.org; teawater@gmail.com
Subject: Re: [RFA record/replay] cast to avoid compiler warning

On Sat, 2008-10-04 at 23:52 +0200, Mark Kettenis wrote:
> > Date: Sat, 04 Oct 2008 11:42:47 -0700
> > From: Michael Snyder <msnyder@vmware.com>
> >
> > Sizeof returns size_t, which is not always the same as int.
> > This cast will prevent compiler warnings on some architectures
> > (eg. x86_64)
>
> This is wrong!  Better cast to unsigned long and print as %lu.
>
> There is a C99 way to do this, but not all systems implement it properly.

gnulib provides a posix compatible printf that understands %z for
size_t:
http://www.gnu.org/software/gnulib/manual/html_node/printf.html

Cheers,

Mark


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA record/replay] cast to avoid compiler warning
  2008-10-05 15:47     ` Michael Snyder
@ 2008-10-05 16:05       ` Daniel Jacobowitz
  2008-10-05 18:28         ` Michael Snyder
  0 siblings, 1 reply; 14+ messages in thread
From: Daniel Jacobowitz @ 2008-10-05 16:05 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Mark Wielaard, Mark Kettenis, gdb-patches, teawater

On Sun, Oct 05, 2008 at 08:44:38AM -0700, Michael Snyder wrote:
> Yes, but we don't know that gdb will always be built using gnulib.

Gnulib is a library of portability replacement routines that GDB can
import.  We already use it for stdint.h and memchr / memmem.  We could
easily add it for further routines.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA record/replay] cast to avoid compiler warning
  2008-10-05 16:05       ` Daniel Jacobowitz
@ 2008-10-05 18:28         ` Michael Snyder
  2008-10-05 18:40           ` Mark Kettenis
  2008-10-05 19:41           ` Eli Zaretskii
  0 siblings, 2 replies; 14+ messages in thread
From: Michael Snyder @ 2008-10-05 18:28 UTC (permalink / raw)
  To: Michael Snyder, Mark Wielaard, Mark Kettenis, gdb-patches, teawater

Daniel Jacobowitz wrote:
> On Sun, Oct 05, 2008 at 08:44:38AM -0700, Michael Snyder wrote:
>> Yes, but we don't know that gdb will always be built using gnulib.
> 
> Gnulib is a library of portability replacement routines that GDB can
> import.  We already use it for stdint.h and memchr / memmem.  We could
> easily add it for further routines.

OK.  So, would you favor using the "%zd" modifier instead of a cast?

I mainly didn't do that because there were no existing instances
of it in gdb now, but I was just being conservative...


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA record/replay] cast to avoid compiler warning
  2008-10-05 18:28         ` Michael Snyder
@ 2008-10-05 18:40           ` Mark Kettenis
  2008-10-05 19:41           ` Eli Zaretskii
  1 sibling, 0 replies; 14+ messages in thread
From: Mark Kettenis @ 2008-10-05 18:40 UTC (permalink / raw)
  To: msnyder; +Cc: msnyder, mark, gdb-patches, teawater

> Date: Sun, 05 Oct 2008 11:25:57 -0700
> From: Michael Snyder <msnyder@vmware.com>
> 
> Daniel Jacobowitz wrote:
> > On Sun, Oct 05, 2008 at 08:44:38AM -0700, Michael Snyder wrote:
> >> Yes, but we don't know that gdb will always be built using gnulib.
> > 
> > Gnulib is a library of portability replacement routines that GDB can
> > import.  We already use it for stdint.h and memchr / memmem.  We could
> > easily add it for further routines.
> 
> OK.  So, would you favor using the "%zd" modifier instead of a cast?
> 
> I mainly didn't do that because there were no existing instances
> of it in gdb now, but I was just being conservative...

We still only require ISO C90 to build GDB, so we shouldn't use %zd.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA record/replay] cast to avoid compiler warning
  2008-10-05 18:28         ` Michael Snyder
  2008-10-05 18:40           ` Mark Kettenis
@ 2008-10-05 19:41           ` Eli Zaretskii
  2008-10-05 20:35             ` Michael Snyder
  1 sibling, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2008-10-05 19:41 UTC (permalink / raw)
  To: Michael Snyder; +Cc: mark, mark.kettenis, gdb-patches, teawater

> Date: Sun, 05 Oct 2008 11:25:57 -0700
> From: Michael Snyder <msnyder@vmware.com>
> 
> OK.  So, would you favor using the "%zd" modifier instead of a cast?

What's wrong with casting to "unsigned long" and using %lu?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA record/replay] cast to avoid compiler warning
  2008-10-05 19:41           ` Eli Zaretskii
@ 2008-10-05 20:35             ` Michael Snyder
  2008-10-05 21:03               ` Mark Kettenis
  2008-10-06  7:29               ` teawater
  0 siblings, 2 replies; 14+ messages in thread
From: Michael Snyder @ 2008-10-05 20:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: mark, mark.kettenis, gdb-patches, teawater

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

Eli Zaretskii wrote:
>> Date: Sun, 05 Oct 2008 11:25:57 -0700
>> From: Michael Snyder <msnyder@vmware.com>
>>
>> OK.  So, would you favor using the "%zd" modifier instead of a cast?
> 
> What's wrong with casting to "unsigned long" and using %lu?

I know when to give up!   ;-)

Like this, then:



[-- Attachment #2: sizeof.txt --]
[-- Type: text/plain, Size: 6387 bytes --]

2008-10-03  Michael Snyder  <msnyder@vmware.com>

	* linux-record.c (record_linux_system_call): Cast sizeof 
	in printf calls, avoid compiler warnings on 64 bit hosts.

Index: linux-record.c
===================================================================
RCS file: /cvs/src/src/gdb/Attic/linux-record.c,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 linux-record.c
--- linux-record.c	7 Sep 2008 01:40:43 -0000	1.1.2.4
+++ linux-record.c	5 Oct 2008 20:33:21 -0000
@@ -596,8 +596,8 @@ record_linux_system_call (int num, linux
 	    if (target_read_memory (tmpu32, (gdb_byte *) & sel, sizeof (sel)))
 	      {
 		fprintf_unfiltered (gdb_stdlog,
-				    "Record: read memory addr = 0x%s len = %d error.\n",
-				    paddr_nz (tmpu32), sizeof (sel));
+				    "Record: read memory addr = 0x%s len = %lu error.\n",
+				    paddr_nz (tmpu32), (unsigned long) sizeof (sel));
 		return (-1);
 	      }
 	    if (record_arch_list_add_mem (sel.inp, tdep->size_fd_set))
@@ -748,8 +748,8 @@ record_linux_system_call (int num, linux
 		if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
-					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					"Record: read memory addr = 0x%s len = %lu error.\n",
+					paddr_nz (tmpu32), (unsigned long) sizeof (a));
 		    return (-1);
 		  }
 		if (record_arch_list_add_mem (a[1], tdep->size_sockaddr))
@@ -774,8 +774,8 @@ record_linux_system_call (int num, linux
 		if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
-					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					"Record: read memory addr = 0x%s len = %lu error.\n",
+					paddr_nz (tmpu32), (unsigned long) sizeof (a));
 		    return (-1);
 		  }
 		if (record_arch_list_add_mem (a[3], tdep->size_int))
@@ -798,8 +798,8 @@ record_linux_system_call (int num, linux
 		if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
-					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					"Record: read memory addr = 0x%s len = %lu error.\n",
+					paddr_nz (tmpu32), (unsigned long) sizeof (a));
 		    return (-1);
 		  }
 		if (a[2])
@@ -808,8 +808,8 @@ record_linux_system_call (int num, linux
 			(a[2], (gdb_byte *) & (a[2]), sizeof (a[2])))
 		      {
 			fprintf_unfiltered (gdb_stdlog,
-					    "Record: read memory addr = 0x%s len = %d error.\n",
-					    paddr_nz (a[2]), sizeof (a[2]));
+					    "Record: read memory addr = 0x%s len = %lu error.\n",
+					    paddr_nz (a[2]), (unsigned long) sizeof (a[2]));
 			return (-1);
 		      }
 		    if (record_arch_list_add_mem (a[1], a[2]))
@@ -830,8 +830,8 @@ record_linux_system_call (int num, linux
 		if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
-					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					"Record: read memory addr = 0x%s len = %lu error.\n",
+					paddr_nz (tmpu32), (unsigned long) sizeof (a));
 		    return (-1);
 		  }
 		if (a[2])
@@ -840,8 +840,8 @@ record_linux_system_call (int num, linux
 			(a[2], (gdb_byte *) & (a[2]), sizeof (a[2])))
 		      {
 			fprintf_unfiltered (gdb_stdlog,
-					    "Record: read memory addr = 0x%s len = %d error.\n",
-					    paddr_nz (a[2]), sizeof (a[2]));
+					    "Record: read memory addr = 0x%s len = %lu error.\n",
+					    paddr_nz (a[2]), (unsigned long) sizeof (a[2]));
 			return (-1);
 		      }
 		    if (record_arch_list_add_mem (a[1], a[2]))
@@ -875,8 +875,8 @@ record_linux_system_call (int num, linux
 		if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
-					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					"Record: read memory addr = 0x%s len = %lu error.\n",
+					paddr_nz (tmpu32), (unsigned long) sizeof (a));
 		    return (-1);
 		  }
 		if (a[4])
@@ -885,8 +885,8 @@ record_linux_system_call (int num, linux
 			(a[4], (gdb_byte *) & av, sizeof (av)))
 		      {
 			fprintf_unfiltered (gdb_stdlog,
-					    "Record: read memory addr = 0x%s len = %d error.\n",
-					    paddr_nz (a[4]), sizeof (av));
+					    "Record: read memory addr = 0x%s len = %lu error.\n",
+					    paddr_nz (a[4]), (unsigned long) sizeof (av));
 			return (-1);
 		      }
 		    if (record_arch_list_add_mem (a[3], av))
@@ -929,8 +929,8 @@ record_linux_system_call (int num, linux
 		if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
-					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					"Record: read memory addr = 0x%s len = %lu error.\n",
+					paddr_nz (tmpu32), (unsigned long) sizeof (a));
 		    return (-1);
 		  }
 		if (record_arch_list_add_mem (a[1], tdep->size_msghdr))
@@ -943,8 +943,8 @@ record_linux_system_call (int num, linux
 			(a[1], (gdb_byte *) & rec, sizeof (rec)))
 		      {
 			fprintf_unfiltered (gdb_stdlog,
-					    "Record: read memory addr = 0x%s len = %d error.\n",
-					    paddr_nz (a[1]), sizeof (rec));
+					    "Record: read memory addr = 0x%s len = %lu error.\n",
+					    paddr_nz (a[1]), (unsigned long) sizeof (rec));
 			return (-1);
 		      }
 		    if (record_arch_list_add_mem
@@ -966,9 +966,9 @@ record_linux_system_call (int num, linux
 				 sizeof (iov)))
 			      {
 				fprintf_unfiltered (gdb_stdlog,
-						    "Record: read memory addr = 0x%s len = %d error.\n",
+						    "Record: read memory addr = 0x%s len = %lu error.\n",
 						    paddr_nz (rec.msg_iov),
-						    sizeof (iov));
+						    (unsigned long) sizeof (iov));
 				return (-1);
 			      }
 			    if (record_arch_list_add_mem
@@ -1334,9 +1334,9 @@ record_linux_system_call (int num, linux
 		    (vec, (gdb_byte *) & iov, sizeof (struct record_iovec)))
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
-					"Record: read memory addr = 0x%s len = %d error.\n",
+					"Record: read memory addr = 0x%s len = %lu error.\n",
 					paddr_nz (vec),
-					sizeof (struct record_iovec));
+					(unsigned long) sizeof (struct record_iovec));
 		    return (-1);
 		  }
 		if (record_arch_list_add_mem (iov.iov_base, iov.iov_len))

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA record/replay] cast to avoid compiler warning
  2008-10-05 20:35             ` Michael Snyder
@ 2008-10-05 21:03               ` Mark Kettenis
  2008-10-06  7:29               ` teawater
  1 sibling, 0 replies; 14+ messages in thread
From: Mark Kettenis @ 2008-10-05 21:03 UTC (permalink / raw)
  To: msnyder; +Cc: eliz, mark, gdb-patches, teawater

> Date: Sun, 05 Oct 2008 13:33:11 -0700
> From: Michael Snyder <msnyder@vmware.com>
> 
> Eli Zaretskii wrote:
> >> Date: Sun, 05 Oct 2008 11:25:57 -0700
> >> From: Michael Snyder <msnyder@vmware.com>
> >>
> >> OK.  So, would you favor using the "%zd" modifier instead of a cast?
> > 
> > What's wrong with casting to "unsigned long" and using %lu?
> 
> I know when to give up!   ;-)

Yeah, this discussion went a bit overboard, but this diff is fine with me ;).

> Like this, then:
> 
> 2008-10-03  Michael Snyder  <msnyder@vmware.com>
> 
> 	* linux-record.c (record_linux_system_call): Cast sizeof 
> 	in printf calls, avoid compiler warnings on 64 bit hosts.
> 
> Index: linux-record.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/Attic/linux-record.c,v
> retrieving revision 1.1.2.4
> diff -u -p -r1.1.2.4 linux-record.c
> --- linux-record.c	7 Sep 2008 01:40:43 -0000	1.1.2.4
> +++ linux-record.c	5 Oct 2008 20:33:21 -0000
> @@ -596,8 +596,8 @@ record_linux_system_call (int num, linux
>  	    if (target_read_memory (tmpu32, (gdb_byte *) & sel, sizeof (sel)))
>  	      {
>  		fprintf_unfiltered (gdb_stdlog,
> -				    "Record: read memory addr = 0x%s len = %d error.\n",
> -				    paddr_nz (tmpu32), sizeof (sel));
> +				    "Record: read memory addr = 0x%s len = %lu error.\n",
> +				    paddr_nz (tmpu32), (unsigned long) sizeof (sel));
>  		return (-1);
>  	      }
>  	    if (record_arch_list_add_mem (sel.inp, tdep->size_fd_set))
> @@ -748,8 +748,8 @@ record_linux_system_call (int num, linux
>  		if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
> -					"Record: read memory addr = 0x%s len = %d error.\n",
> -					paddr_nz (tmpu32), sizeof (a));
> +					"Record: read memory addr = 0x%s len = %lu error.\n",
> +					paddr_nz (tmpu32), (unsigned long) sizeof (a));
>  		    return (-1);
>  		  }
>  		if (record_arch_list_add_mem (a[1], tdep->size_sockaddr))
> @@ -774,8 +774,8 @@ record_linux_system_call (int num, linux
>  		if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
> -					"Record: read memory addr = 0x%s len = %d error.\n",
> -					paddr_nz (tmpu32), sizeof (a));
> +					"Record: read memory addr = 0x%s len = %lu error.\n",
> +					paddr_nz (tmpu32), (unsigned long) sizeof (a));
>  		    return (-1);
>  		  }
>  		if (record_arch_list_add_mem (a[3], tdep->size_int))
> @@ -798,8 +798,8 @@ record_linux_system_call (int num, linux
>  		if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
> -					"Record: read memory addr = 0x%s len = %d error.\n",
> -					paddr_nz (tmpu32), sizeof (a));
> +					"Record: read memory addr = 0x%s len = %lu error.\n",
> +					paddr_nz (tmpu32), (unsigned long) sizeof (a));
>  		    return (-1);
>  		  }
>  		if (a[2])
> @@ -808,8 +808,8 @@ record_linux_system_call (int num, linux
>  			(a[2], (gdb_byte *) & (a[2]), sizeof (a[2])))
>  		      {
>  			fprintf_unfiltered (gdb_stdlog,
> -					    "Record: read memory addr = 0x%s len = %d error.\n",
> -					    paddr_nz (a[2]), sizeof (a[2]));
> +					    "Record: read memory addr = 0x%s len = %lu error.\n",
> +					    paddr_nz (a[2]), (unsigned long) sizeof (a[2]));
>  			return (-1);
>  		      }
>  		    if (record_arch_list_add_mem (a[1], a[2]))
> @@ -830,8 +830,8 @@ record_linux_system_call (int num, linux
>  		if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
> -					"Record: read memory addr = 0x%s len = %d error.\n",
> -					paddr_nz (tmpu32), sizeof (a));
> +					"Record: read memory addr = 0x%s len = %lu error.\n",
> +					paddr_nz (tmpu32), (unsigned long) sizeof (a));
>  		    return (-1);
>  		  }
>  		if (a[2])
> @@ -840,8 +840,8 @@ record_linux_system_call (int num, linux
>  			(a[2], (gdb_byte *) & (a[2]), sizeof (a[2])))
>  		      {
>  			fprintf_unfiltered (gdb_stdlog,
> -					    "Record: read memory addr = 0x%s len = %d error.\n",
> -					    paddr_nz (a[2]), sizeof (a[2]));
> +					    "Record: read memory addr = 0x%s len = %lu error.\n",
> +					    paddr_nz (a[2]), (unsigned long) sizeof (a[2]));
>  			return (-1);
>  		      }
>  		    if (record_arch_list_add_mem (a[1], a[2]))
> @@ -875,8 +875,8 @@ record_linux_system_call (int num, linux
>  		if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
> -					"Record: read memory addr = 0x%s len = %d error.\n",
> -					paddr_nz (tmpu32), sizeof (a));
> +					"Record: read memory addr = 0x%s len = %lu error.\n",
> +					paddr_nz (tmpu32), (unsigned long) sizeof (a));
>  		    return (-1);
>  		  }
>  		if (a[4])
> @@ -885,8 +885,8 @@ record_linux_system_call (int num, linux
>  			(a[4], (gdb_byte *) & av, sizeof (av)))
>  		      {
>  			fprintf_unfiltered (gdb_stdlog,
> -					    "Record: read memory addr = 0x%s len = %d error.\n",
> -					    paddr_nz (a[4]), sizeof (av));
> +					    "Record: read memory addr = 0x%s len = %lu error.\n",
> +					    paddr_nz (a[4]), (unsigned long) sizeof (av));
>  			return (-1);
>  		      }
>  		    if (record_arch_list_add_mem (a[3], av))
> @@ -929,8 +929,8 @@ record_linux_system_call (int num, linux
>  		if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
> -					"Record: read memory addr = 0x%s len = %d error.\n",
> -					paddr_nz (tmpu32), sizeof (a));
> +					"Record: read memory addr = 0x%s len = %lu error.\n",
> +					paddr_nz (tmpu32), (unsigned long) sizeof (a));
>  		    return (-1);
>  		  }
>  		if (record_arch_list_add_mem (a[1], tdep->size_msghdr))
> @@ -943,8 +943,8 @@ record_linux_system_call (int num, linux
>  			(a[1], (gdb_byte *) & rec, sizeof (rec)))
>  		      {
>  			fprintf_unfiltered (gdb_stdlog,
> -					    "Record: read memory addr = 0x%s len = %d error.\n",
> -					    paddr_nz (a[1]), sizeof (rec));
> +					    "Record: read memory addr = 0x%s len = %lu error.\n",
> +					    paddr_nz (a[1]), (unsigned long) sizeof (rec));
>  			return (-1);
>  		      }
>  		    if (record_arch_list_add_mem
> @@ -966,9 +966,9 @@ record_linux_system_call (int num, linux
>  				 sizeof (iov)))
>  			      {
>  				fprintf_unfiltered (gdb_stdlog,
> -						    "Record: read memory addr = 0x%s len = %d error.\n",
> +						    "Record: read memory addr = 0x%s len = %lu error.\n",
>  						    paddr_nz (rec.msg_iov),
> -						    sizeof (iov));
> +						    (unsigned long) sizeof (iov));
>  				return (-1);
>  			      }
>  			    if (record_arch_list_add_mem
> @@ -1334,9 +1334,9 @@ record_linux_system_call (int num, linux
>  		    (vec, (gdb_byte *) & iov, sizeof (struct record_iovec)))
>  		  {
>  		    fprintf_unfiltered (gdb_stdlog,
> -					"Record: read memory addr = 0x%s len = %d error.\n",
> +					"Record: read memory addr = 0x%s len = %lu error.\n",
>  					paddr_nz (vec),
> -					sizeof (struct record_iovec));
> +					(unsigned long) sizeof (struct record_iovec));
>  		    return (-1);
>  		  }
>  		if (record_arch_list_add_mem (iov.iov_base, iov.iov_len))


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA record/replay] cast to avoid compiler warning
  2008-10-05 20:35             ` Michael Snyder
  2008-10-05 21:03               ` Mark Kettenis
@ 2008-10-06  7:29               ` teawater
  1 sibling, 0 replies; 14+ messages in thread
From: teawater @ 2008-10-06  7:29 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Eli Zaretskii, mark, mark.kettenis, gdb-patches

It's OK for me.

BTW thanks everybody. :)

On Mon, Oct 6, 2008 at 04:33, Michael Snyder <msnyder@vmware.com> wrote:
> Eli Zaretskii wrote:
>>>
>>> Date: Sun, 05 Oct 2008 11:25:57 -0700
>>> From: Michael Snyder <msnyder@vmware.com>
>>>
>>> OK.  So, would you favor using the "%zd" modifier instead of a cast?
>>
>> What's wrong with casting to "unsigned long" and using %lu?
>
> I know when to give up!   ;-)
>
> Like this, then:
>
>
>
> 2008-10-03  Michael Snyder  <msnyder@vmware.com>
>
>        * linux-record.c (record_linux_system_call): Cast sizeof
>        in printf calls, avoid compiler warnings on 64 bit hosts.
>
> Index: linux-record.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/Attic/linux-record.c,v
> retrieving revision 1.1.2.4
> diff -u -p -r1.1.2.4 linux-record.c
> --- linux-record.c      7 Sep 2008 01:40:43 -0000       1.1.2.4
> +++ linux-record.c      5 Oct 2008 20:33:21 -0000
> @@ -596,8 +596,8 @@ record_linux_system_call (int num, linux
>            if (target_read_memory (tmpu32, (gdb_byte *) & sel, sizeof
> (sel)))
>              {
>                fprintf_unfiltered (gdb_stdlog,
> -                                   "Record: read memory addr = 0x%s len =
> %d error.\n",
> -                                   paddr_nz (tmpu32), sizeof (sel));
> +                                   "Record: read memory addr = 0x%s len =
> %lu error.\n",
> +                                   paddr_nz (tmpu32), (unsigned long)
> sizeof (sel));
>                return (-1);
>              }
>            if (record_arch_list_add_mem (sel.inp, tdep->size_fd_set))
> @@ -748,8 +748,8 @@ record_linux_system_call (int num, linux
>                if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
>                  {
>                    fprintf_unfiltered (gdb_stdlog,
> -                                       "Record: read memory addr = 0x%s len
> = %d error.\n",
> -                                       paddr_nz (tmpu32), sizeof (a));
> +                                       "Record: read memory addr = 0x%s len
> = %lu error.\n",
> +                                       paddr_nz (tmpu32), (unsigned long)
> sizeof (a));
>                    return (-1);
>                  }
>                if (record_arch_list_add_mem (a[1], tdep->size_sockaddr))
> @@ -774,8 +774,8 @@ record_linux_system_call (int num, linux
>                if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
>                  {
>                    fprintf_unfiltered (gdb_stdlog,
> -                                       "Record: read memory addr = 0x%s len
> = %d error.\n",
> -                                       paddr_nz (tmpu32), sizeof (a));
> +                                       "Record: read memory addr = 0x%s len
> = %lu error.\n",
> +                                       paddr_nz (tmpu32), (unsigned long)
> sizeof (a));
>                    return (-1);
>                  }
>                if (record_arch_list_add_mem (a[3], tdep->size_int))
> @@ -798,8 +798,8 @@ record_linux_system_call (int num, linux
>                if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
>                  {
>                    fprintf_unfiltered (gdb_stdlog,
> -                                       "Record: read memory addr = 0x%s len
> = %d error.\n",
> -                                       paddr_nz (tmpu32), sizeof (a));
> +                                       "Record: read memory addr = 0x%s len
> = %lu error.\n",
> +                                       paddr_nz (tmpu32), (unsigned long)
> sizeof (a));
>                    return (-1);
>                  }
>                if (a[2])
> @@ -808,8 +808,8 @@ record_linux_system_call (int num, linux
>                        (a[2], (gdb_byte *) & (a[2]), sizeof (a[2])))
>                      {
>                        fprintf_unfiltered (gdb_stdlog,
> -                                           "Record: read memory addr = 0x%s
> len = %d error.\n",
> -                                           paddr_nz (a[2]), sizeof (a[2]));
> +                                           "Record: read memory addr = 0x%s
> len = %lu error.\n",
> +                                           paddr_nz (a[2]), (unsigned long)
> sizeof (a[2]));
>                        return (-1);
>                      }
>                    if (record_arch_list_add_mem (a[1], a[2]))
> @@ -830,8 +830,8 @@ record_linux_system_call (int num, linux
>                if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
>                  {
>                    fprintf_unfiltered (gdb_stdlog,
> -                                       "Record: read memory addr = 0x%s len
> = %d error.\n",
> -                                       paddr_nz (tmpu32), sizeof (a));
> +                                       "Record: read memory addr = 0x%s len
> = %lu error.\n",
> +                                       paddr_nz (tmpu32), (unsigned long)
> sizeof (a));
>                    return (-1);
>                  }
>                if (a[2])
> @@ -840,8 +840,8 @@ record_linux_system_call (int num, linux
>                        (a[2], (gdb_byte *) & (a[2]), sizeof (a[2])))
>                      {
>                        fprintf_unfiltered (gdb_stdlog,
> -                                           "Record: read memory addr = 0x%s
> len = %d error.\n",
> -                                           paddr_nz (a[2]), sizeof (a[2]));
> +                                           "Record: read memory addr = 0x%s
> len = %lu error.\n",
> +                                           paddr_nz (a[2]), (unsigned long)
> sizeof (a[2]));
>                        return (-1);
>                      }
>                    if (record_arch_list_add_mem (a[1], a[2]))
> @@ -875,8 +875,8 @@ record_linux_system_call (int num, linux
>                if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
>                  {
>                    fprintf_unfiltered (gdb_stdlog,
> -                                       "Record: read memory addr = 0x%s len
> = %d error.\n",
> -                                       paddr_nz (tmpu32), sizeof (a));
> +                                       "Record: read memory addr = 0x%s len
> = %lu error.\n",
> +                                       paddr_nz (tmpu32), (unsigned long)
> sizeof (a));
>                    return (-1);
>                  }
>                if (a[4])
> @@ -885,8 +885,8 @@ record_linux_system_call (int num, linux
>                        (a[4], (gdb_byte *) & av, sizeof (av)))
>                      {
>                        fprintf_unfiltered (gdb_stdlog,
> -                                           "Record: read memory addr = 0x%s
> len = %d error.\n",
> -                                           paddr_nz (a[4]), sizeof (av));
> +                                           "Record: read memory addr = 0x%s
> len = %lu error.\n",
> +                                           paddr_nz (a[4]), (unsigned long)
> sizeof (av));
>                        return (-1);
>                      }
>                    if (record_arch_list_add_mem (a[3], av))
> @@ -929,8 +929,8 @@ record_linux_system_call (int num, linux
>                if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
>                  {
>                    fprintf_unfiltered (gdb_stdlog,
> -                                       "Record: read memory addr = 0x%s len
> = %d error.\n",
> -                                       paddr_nz (tmpu32), sizeof (a));
> +                                       "Record: read memory addr = 0x%s len
> = %lu error.\n",
> +                                       paddr_nz (tmpu32), (unsigned long)
> sizeof (a));
>                    return (-1);
>                  }
>                if (record_arch_list_add_mem (a[1], tdep->size_msghdr))
> @@ -943,8 +943,8 @@ record_linux_system_call (int num, linux
>                        (a[1], (gdb_byte *) & rec, sizeof (rec)))
>                      {
>                        fprintf_unfiltered (gdb_stdlog,
> -                                           "Record: read memory addr = 0x%s
> len = %d error.\n",
> -                                           paddr_nz (a[1]), sizeof (rec));
> +                                           "Record: read memory addr = 0x%s
> len = %lu error.\n",
> +                                           paddr_nz (a[1]), (unsigned long)
> sizeof (rec));
>                        return (-1);
>                      }
>                    if (record_arch_list_add_mem
> @@ -966,9 +966,9 @@ record_linux_system_call (int num, linux
>                                 sizeof (iov)))
>                              {
>                                fprintf_unfiltered (gdb_stdlog,
> -                                                   "Record: read memory
> addr = 0x%s len = %d error.\n",
> +                                                   "Record: read memory
> addr = 0x%s len = %lu error.\n",
>                                                    paddr_nz (rec.msg_iov),
> -                                                   sizeof (iov));
> +                                                   (unsigned long) sizeof
> (iov));
>                                return (-1);
>                              }
>                            if (record_arch_list_add_mem
> @@ -1334,9 +1334,9 @@ record_linux_system_call (int num, linux
>                    (vec, (gdb_byte *) & iov, sizeof (struct record_iovec)))
>                  {
>                    fprintf_unfiltered (gdb_stdlog,
> -                                       "Record: read memory addr = 0x%s len
> = %d error.\n",
> +                                       "Record: read memory addr = 0x%s len
> = %lu error.\n",
>                                        paddr_nz (vec),
> -                                       sizeof (struct record_iovec));
> +                                       (unsigned long) sizeof (struct
> record_iovec));
>                    return (-1);
>                  }
>                if (record_arch_list_add_mem (iov.iov_base, iov.iov_len))
>
>


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-10-06  7:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-04 18:45 [RFA record/replay] cast to avoid compiler warning Michael Snyder
2008-10-04 21:53 ` Mark Kettenis
2008-10-05  7:12   ` Andreas Schwab
2008-10-05  9:54     ` Mark Kettenis
2008-10-05 11:02       ` Andreas Schwab
2008-10-05 12:17   ` Mark Wielaard
2008-10-05 15:47     ` Michael Snyder
2008-10-05 16:05       ` Daniel Jacobowitz
2008-10-05 18:28         ` Michael Snyder
2008-10-05 18:40           ` Mark Kettenis
2008-10-05 19:41           ` Eli Zaretskii
2008-10-05 20:35             ` Michael Snyder
2008-10-05 21:03               ` Mark Kettenis
2008-10-06  7:29               ` teawater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox