Sender: nate AT cartsys DOT com Message-ID: <36F558B8.6AE06FA3@cartsys.com> Date: Sun, 21 Mar 1999 12:38:16 -0800 From: Nate Eldredge 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> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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