Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfa] fix invidious casting bug in infptrace.c with 64-bit CORE_ADDR
Date: Wed, 25 Jul 2001 19:24:00 -0000	[thread overview]
Message-ID: <20010725192444.A27834@nevyn.them.org> (raw)
In-Reply-To: <3B5F79D8.2070203@cygnus.com>

On Wed, Jul 25, 2001 at 10:00:56PM -0400, Andrew Cagney wrote:
> > 2001-07-25  Daniel Jacobowitz  <drow@mvista.com>
> > 
> > * infptrace.c (child_xfer_memory): Add cast to CORE_ADDR.
> > 
> > 
> 
> Yes, ok.  Nasty.  I'd do a grep around as I noticed what looks like the same bug in gdbserver.

Ack, it's everywhere!

I committed the attached as an obvious consequence.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2001-07-25  Daniel Jacobowitz  <drow@mvista.com>

        * infptrace.c (child_xfer_memory): Add cast to CORE_ADDR.
        * infttrace.c (child_xfer_memory): Likewise.
        * symm-nat.c (child_xfer_memory): Likewise.
        * gdbserver/low-hppabsd.c (read_inferior_memory): Likewise.
        (write_inferior_memory): Likewise.
        * gdbserver/low-linux.c (read_inferior_memory): Likewise.
        (write_inferior_memory): Likewise.
        * gdbserver/low-lynx.c (read_inferior_memory): Likewise.
        (write_inferior_memory): Likewise.
        * gdbserver/low-nbsd.c (read_inferior_memory): Likewise.
        (write_inferior_memory): Likewise.
        * gdbserver/low-sparc.c (read_inferior_memory): Likewise.
        (write_inferior_memory): Likewise.
        * gdbserver/low-sun3.c (read_inferior_memory): Likewise.
        (write_inferior_memory): Likewise.

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.1513
diff -u -p -r1.1513 ChangeLog
--- ChangeLog	2001/07/25 14:58:38	1.1513
+++ ChangeLog	2001/07/26 02:17:53
@@ -1,3 +1,7 @@
+2001-07-25  Daniel Jacobowitz  <drow@mvista.com>
+
+	* infptrace.c (child_xfer_memory): Add cast to CORE_ADDR.
+
 2001-07-25  Eli Zaretskii  <eliz@is.elta.co.il>
 
 	* README: Mention how to make gdb.pdf.
Index: infptrace.c
===================================================================
RCS file: /cvs/src/src/gdb/infptrace.c,v
retrieving revision 1.16
diff -u -p -r1.16 infptrace.c
--- infptrace.c	2001/06/15 23:50:46	1.16
+++ infptrace.c	2001/07/26 02:17:53
@@ -497,7 +497,7 @@ child_xfer_memory (CORE_ADDR memaddr, ch
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (PTRACE_XFER_TYPE);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1)
Index: infttrace.c
===================================================================
RCS file: /cvs/src/src/gdb/infttrace.c,v
retrieving revision 1.13
diff -u -p -r1.13 infttrace.c
--- infttrace.c	2001/07/19 04:58:17	1.13
+++ infttrace.c	2001/07/26 02:17:53
@@ -4925,7 +4925,7 @@ child_xfer_memory (CORE_ADDR memaddr, ch
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (TTRACE_XFER_TYPE);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (TTRACE_XFER_TYPE);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (TTRACE_XFER_TYPE) - 1)
Index: symm-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/symm-nat.c,v
retrieving revision 1.9
diff -u -p -r1.9 symm-nat.c
--- symm-nat.c	2001/05/04 04:15:27	1.9
+++ symm-nat.c	2001/07/26 02:17:53
@@ -758,7 +758,7 @@ child_xfer_memory (CORE_ADDR memaddr, ch
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (PTRACE_XFER_TYPE);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1)
Index: gdbserver/low-hppabsd.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/low-hppabsd.c,v
retrieving revision 1.8
diff -u -p -r1.8 low-hppabsd.c
--- low-hppabsd.c	2001/07/11 17:33:24	1.8
+++ low-hppabsd.c	2001/07/26 02:17:53
@@ -279,7 +279,7 @@ read_inferior_memory (CORE_ADDR memaddr,
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (int);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
@@ -306,7 +306,7 @@ write_inferior_memory (CORE_ADDR memaddr
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (int);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
Index: gdbserver/low-linux.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/low-linux.c,v
retrieving revision 1.10
diff -u -p -r1.10 low-linux.c
--- low-linux.c	2001/07/11 17:33:24	1.10
+++ low-linux.c	2001/07/26 02:17:53
@@ -675,7 +675,7 @@ read_inferior_memory (CORE_ADDR memaddr,
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (PTRACE_XFER_TYPE);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE);
   /* Round ending address up; get number of longwords that makes.  */
   register int count 
     = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1) 
@@ -704,7 +704,7 @@ write_inferior_memory (CORE_ADDR memaddr
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (PTRACE_XFER_TYPE);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1) / sizeof (PTRACE_XFER_TYPE);
Index: gdbserver/low-lynx.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/low-lynx.c,v
retrieving revision 1.3
diff -u -p -r1.3 low-lynx.c
--- low-lynx.c	2001/03/06 08:21:44	1.3
+++ low-lynx.c	2001/07/26 02:17:53
@@ -657,7 +657,7 @@ read_inferior_memory (CORE_ADDR memaddr,
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (int);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
@@ -684,7 +684,7 @@ write_inferior_memory (CORE_ADDR memaddr
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (int);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
Index: gdbserver/low-nbsd.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/low-nbsd.c,v
retrieving revision 1.10
diff -u -p -r1.10 low-nbsd.c
--- low-nbsd.c	2001/07/11 17:33:24	1.10
+++ low-nbsd.c	2001/07/26 02:17:53
@@ -522,7 +522,7 @@ read_inferior_memory (CORE_ADDR memaddr,
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (int);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
@@ -549,7 +549,7 @@ write_inferior_memory (CORE_ADDR memaddr
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (int);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
Index: gdbserver/low-sparc.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/low-sparc.c,v
retrieving revision 1.7
diff -u -p -r1.7 low-sparc.c
--- low-sparc.c	2001/07/11 17:33:24	1.7
+++ low-sparc.c	2001/07/26 02:17:53
@@ -238,7 +238,7 @@ read_inferior_memory (CORE_ADDR memaddr,
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (int);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
@@ -265,7 +265,7 @@ write_inferior_memory (CORE_ADDR memaddr
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (int);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
Index: gdbserver/low-sun3.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/low-sun3.c,v
retrieving revision 1.6
diff -u -p -r1.6 low-sun3.c
--- low-sun3.c	2001/04/06 22:25:09	1.6
+++ low-sun3.c	2001/07/26 02:17:53
@@ -215,7 +215,7 @@ read_inferior_memory (CORE_ADDR memaddr,
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (int);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
@@ -242,7 +242,7 @@ write_inferior_memory (CORE_ADDR memaddr
 {
   register int i;
   /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (int);
+  register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (int);
   /* Round ending address up; get number of longwords that makes.  */
   register int count
   = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);


      reply	other threads:[~2001-07-25 19:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-25 17:30 Daniel Jacobowitz
2001-07-25 19:01 ` Andrew Cagney
2001-07-25 19:24   ` Daniel Jacobowitz [this message]

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=20010725192444.A27834@nevyn.them.org \
    --to=dmj+@andrew.cmu.edu \
    --cc=ac131313@cygnus.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