Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH/RFC] gag some compiler warnings
@ 2003-07-03 16:42 Elena Zannoni
  2003-07-03 16:49 ` Richard Henderson
  2003-07-03 20:49 ` Mark Kettenis
  0 siblings, 2 replies; 4+ messages in thread
From: Elena Zannoni @ 2003-07-03 16:42 UTC (permalink / raw)
  To: gdb-patches


I am seeing these on a 64 bit system, when building gdb in 32-bit mode:

/home/cygnus/ezannoni/gdb-6/src/gdb/infptrace.c: In function `child_xfer_memory':
/home/cygnus/ezannoni/gdb-6/src/gdb/infptrace.c:570: warning: cast to pointer from integer of different size
/home/cygnus/ezannoni/gdb-6/src/gdb/infptrace.c:578: warning: cast to pointer from integer of different size
/home/cygnus/ezannoni/gdb-6/src/gdb/infptrace.c:590: warning: cast to pointer from integer of different size
/home/cygnus/ezannoni/gdb-6/src/gdb/infptrace.c:597: warning: cast to pointer from integer of different size
/home/cygnus/ezannoni/gdb-6/src/gdb/infptrace.c:613: warning: cast to pointer from integer of different size

The problem is that we pass a CORE_ADDR (which is 8 bytes long) to
ptrace and we cast it to PTRACE_ARG3_TYPE (which is 4 bytes long).

Is this ok? Not too pretty, I know.


elena

   * infptrace.c (child_xfer_memory): Cast ptrace argument to long,
     for cases in which CORE_ADDR size and pointer size don't agree.

Index: infptrace.c
===================================================================
RCS file: /cvs/src/src/gdb/infptrace.c,v
retrieving revision 1.26
diff -u -p -r1.26 infptrace.c
--- infptrace.c	22 May 2003 15:46:20 -0000	1.26
+++ infptrace.c	3 Jul 2003 15:45:34 -0000
@@ -564,14 +564,14 @@ child_xfer_memory (CORE_ADDR memaddr, ch
 	{
 	  /* Need part of initial word -- fetch it.  */
 	  buffer[0] = ptrace (PT_READ_I, PIDGET (inferior_ptid), 
-			      (PTRACE_ARG3_TYPE) addr, 0);
+			      (PTRACE_ARG3_TYPE) (long) addr, 0);
 	}
 
       if (count > 1)		/* FIXME, avoid if even boundary.  */
 	{
 	  buffer[count - 1] =
 	    ptrace (PT_READ_I, PIDGET (inferior_ptid),
-		    ((PTRACE_ARG3_TYPE)
+		    ((PTRACE_ARG3_TYPE) (long)
 		     (addr + (count - 1) * sizeof (PTRACE_XFER_TYPE))), 0);
 	}
 
@@ -584,14 +584,14 @@ child_xfer_memory (CORE_ADDR memaddr, ch
 	{
 	  errno = 0;
 	  ptrace (PT_WRITE_D, PIDGET (inferior_ptid), 
-		  (PTRACE_ARG3_TYPE) addr, buffer[i]);
+		  (PTRACE_ARG3_TYPE) (long) addr, buffer[i]);
 	  if (errno)
 	    {
 	      /* Using the appropriate one (I or D) is necessary for
 	         Gould NP1, at least.  */
 	      errno = 0;
 	      ptrace (PT_WRITE_I, PIDGET (inferior_ptid), 
-		      (PTRACE_ARG3_TYPE) addr, buffer[i]);
+		      (PTRACE_ARG3_TYPE) (long) addr, buffer[i]);
 	    }
 	  if (errno)
 	    return 0;
@@ -607,7 +607,7 @@ child_xfer_memory (CORE_ADDR memaddr, ch
 	{
 	  errno = 0;
 	  buffer[i] = ptrace (PT_READ_I, PIDGET (inferior_ptid),
-			      (PTRACE_ARG3_TYPE) addr, 0);
+			      (PTRACE_ARG3_TYPE) (long) addr, 0);
 	  if (errno)
 	    return 0;
 	  QUIT;


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

end of thread, other threads:[~2003-07-07 18:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-03 16:42 [PATCH/RFC] gag some compiler warnings Elena Zannoni
2003-07-03 16:49 ` Richard Henderson
2003-07-03 20:49 ` Mark Kettenis
2003-07-07 18:35   ` Elena Zannoni

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