delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/03/21/16:24:13

Sender: nate AT cartsys DOT com
Message-ID: <36F558B8.6AE06FA3@cartsys.com>
Date: Sun, 21 Mar 1999 12:38:16 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.3 i586)
MIME-Version: 1.0
To: robert DOT hoehne AT gmx DOT net, djgpp-workers AT delorie DOT com
Subject: Re: Patch for GDB touching bad addresses
References: <36F557E6 DOT ED6D9E4E AT cartsys DOT com>
Reply-To: djgpp-workers AT delorie DOT com

Nate Eldredge wrote:
> 
> This patch will fix GDB's behavior when asked to access bad addresses in
> the debuggee.  Now it will act like on Unix, where it says "Cannot
> access memory at 0xdeadbeef".  Previously it would print garbage or
> crash.

Whoops, hit "Send" too soon and forgot to include the patch itself.  Here it is:

--- gdb/go32targ.bak	Sun Sep  8 23:46:46 1996
+++ gdb/go32targ.c	Sat Mar 20 23:14:34 1999
@@ -269,11 +269,18 @@
 #if 0
   printf_unfiltered("go32_xfer_memory %x %x %d %d\n", memaddr, myaddr, len, write);
 #endif
+  int v;
   if (write)
-    write_child(memaddr, myaddr, len);
+    v = write_child(memaddr, myaddr, len);
   else
-    read_child(memaddr, myaddr, len);
-  return len;
+    v = read_child(memaddr, myaddr, len);
+  if (v != 0) /* Address was bad */
+    {
+      errno = EIO;
+      return -1;
+    }
+  else
+    return len;
 }
 
 /* ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ */

Not sure if that last line, with its non-ascii characters, will survive
the mailing.  Wish it luck...
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019