From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2107 invoked by alias); 14 Feb 2002 01:42:44 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 2019 invoked from network); 14 Feb 2002 01:42:43 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 14 Feb 2002 01:42:43 -0000 Received: from redhat.com (notinuse.cygnus.com [205.180.231.12]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id RAA16417; Wed, 13 Feb 2002 17:42:34 -0800 (PST) Message-ID: <3C6B143A.47849E29@redhat.com> Date: Wed, 13 Feb 2002 17:42:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2smp i686) X-Accept-Language: en MIME-Version: 1.0 To: Greg McGary CC: gdb-patches@sources.redhat.com Subject: Re: PATCH: new "void" memory region attribute References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-02/txt/msg00382.txt.bz2 Greg McGary wrote: > > Add "void" attribute, which disallows both read & write access. This > useful for guarding holes in a target's address space that cause the > system to hang when read/written. > > OK to commit? I like it. Would you consider adding a test to the testsuite? > > gdb: > > 2002-02-13 Greg McGary > > * memattr.h (enum mem_access_mode): s/MEM_RO/MEM_READ/ > s/MEM_WO/MEM_WRITE/. New member MEM_VOID. > * memattr.c (mem_command, mem_info_command): Handle MEM_VOID. > * target.c (target_xfer_memory, target_xfer_memory_partial): > Check read/write validity with bit test. > * dcache.c (dcache_write_line, dcache_read_line): Likewise. > > doc: > > 2002-02-13 Greg McGary > > * gdb.texinfo (Memory Region Attributes): Describe `void' attribute. > > Index: dcache.c > =================================================================== > RCS file: /cvs/src/src/gdb/dcache.c,v > retrieving revision 1.15 > diff -u -p -r1.15 dcache.c > --- dcache.c 2001/04/06 22:43:55 1.15 > +++ dcache.c 2002/02/14 00:17:25 > @@ -1,5 +1,5 @@ > /* Caching code. > - Copyright 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001 > + Copyright 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001, 2002 > Free Software Foundation, Inc. > > This file is part of GDB. > @@ -267,7 +267,7 @@ dcache_write_line (DCACHE *dcache, regis > else > reg_len = region->hi - memaddr; > > - if (!region->attrib.cache || region->attrib.mode == MEM_RO) > + if (!region->attrib.cache || !(region->attrib.mode == MEM_WRITE)) > { > memaddr += reg_len; > myaddr += reg_len; > @@ -349,7 +349,7 @@ dcache_read_line (DCACHE *dcache, struct > else > reg_len = region->hi - memaddr; > > - if (!region->attrib.cache || region->attrib.mode == MEM_WO) > + if (!region->attrib.cache || !(region->attrib.mode & MEM_READ)) > { > memaddr += reg_len; > myaddr += reg_len; > Index: memattr.c > =================================================================== > RCS file: /cvs/src/src/gdb/memattr.c,v > retrieving revision 1.9 > diff -u -p -r1.9 memattr.c > --- memattr.c 2002/02/13 19:00:47 1.9 > +++ memattr.c 2002/02/14 00:17:25 > @@ -1,5 +1,5 @@ > /* Memory attributes support, for GDB. > - Copyright 2001 Free Software Foundation, Inc. > + Copyright 2001, 2002 Free Software Foundation, Inc. > > This file is part of GDB. > > @@ -156,9 +156,11 @@ mem_command (char *args, int from_tty) > if (strcmp (tok, "rw") == 0) > attrib.mode = MEM_RW; > else if (strcmp (tok, "ro") == 0) > - attrib.mode = MEM_RO; > + attrib.mode = MEM_READ; > else if (strcmp (tok, "wo") == 0) > - attrib.mode = MEM_WO; > + attrib.mode = MEM_WRITE; > + else if (strcmp (tok, "void") == 0) > + attrib.mode = MEM_VOID; > > else if (strcmp (tok, "8") == 0) > attrib.width = MEM_WIDTH_8; > @@ -266,13 +268,16 @@ mem_info_command (char *args, int from_t > attrib = &m->attrib; > switch (attrib->mode) > { > + case MEM_VOID: > + printf_filtered ("void "); > + break; > case MEM_RW: > printf_filtered ("rw "); > break; > - case MEM_RO: > + case MEM_READ: > printf_filtered ("ro "); > break; > - case MEM_WO: > + case MEM_WRITE: > printf_filtered ("wo "); > break; > } > Index: memattr.h > =================================================================== > RCS file: /cvs/src/src/gdb/memattr.h,v > retrieving revision 1.4 > diff -u -p -r1.4 memattr.h > --- memattr.h 2001/08/02 11:58:29 1.4 > +++ memattr.h 2002/02/14 00:17:25 > @@ -1,5 +1,5 @@ > /* Memory attributes support, for GDB. > - Copyright 2001 Free Software Foundation, Inc. > + Copyright 2001, 2002 Free Software Foundation, Inc. > > This file is part of GDB. > > @@ -23,9 +23,10 @@ > > enum mem_access_mode > { > - MEM_RW, /* read/write */ > - MEM_RO, /* read only */ > - MEM_WO /* write only */ > + MEM_VOID = 0, > + MEM_READ = 1, > + MEM_WRITE = 2, > + MEM_RW = MEM_READ | MEM_WRITE, > }; > > enum mem_access_width > Index: target.c > =================================================================== > RCS file: /cvs/src/src/gdb/target.c,v > retrieving revision 1.33 > diff -u -p -r1.33 target.c > --- target.c 2002/02/01 01:01:21 1.33 > +++ target.c 2002/02/14 00:17:25 > @@ -933,18 +933,10 @@ target_xfer_memory (CORE_ADDR memaddr, c > else > reg_len = region->hi - memaddr; > > - switch (region->attrib.mode) > - { > - case MEM_RO: > - if (write) > - return EIO; > - break; > - > - case MEM_WO: > - if (!write) > - return EIO; > - break; > - } > + if (write > + ? !(region->attrib.mode & MEM_WRITE) > + : !(region->attrib.mode & MEM_READ)) > + return EIO; > > while (reg_len > 0) > { > @@ -1004,23 +996,12 @@ target_xfer_memory_partial (CORE_ADDR me > else > reg_len = region->hi - memaddr; > > - switch (region->attrib.mode) > + if (write_p > + ? !(region->attrib.mode & MEM_WRITE) > + : !(region->attrib.mode & MEM_READ)) > { > - case MEM_RO: > - if (write_p) > - { > - *err = EIO; > - return -1; > - } > - break; > - > - case MEM_WO: > - if (write_p) > - { > - *err = EIO; > - return -1; > - } > - break; > + *err = EIO; > + return -1; > } > > if (region->attrib.cache) > Index: doc/gdb.texinfo > =================================================================== > RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v > retrieving revision 1.89 > diff -u -p -r1.89 gdb.texinfo > --- gdb.texinfo 2002/02/08 00:39:45 1.89 > +++ gdb.texinfo 2002/02/14 00:17:32 > @@ -5642,6 +5642,8 @@ Memory is read only. > Memory is write only. > @item rw > Memory is read/write. This is the default. > +@item void > +Memory is inaccessible. > @end table > > @subsubsection Memory Access Size >