From: Elena Zannoni <ezannoni@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH/RFC] gag some compiler warnings
Date: Thu, 03 Jul 2003 16:42:00 -0000 [thread overview]
Message-ID: <16132.24210.943200.572653@localhost.redhat.com> (raw)
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;
next reply other threads:[~2003-07-03 16:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-03 16:42 Elena Zannoni [this message]
2003-07-03 16:49 ` Richard Henderson
2003-07-03 20:49 ` Mark Kettenis
2003-07-07 18:35 ` Elena Zannoni
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=16132.24210.943200.572653@localhost.redhat.com \
--to=ezannoni@redhat.com \
--cc=gdb-patches@sources.redhat.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