aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2006-11-21 16:50:16 +0000
committerVladimir Prus <vladimir@codesourcery.com>2006-11-21 16:50:16 +0000
commit4b5752d02f5e21329ae17790fd766b5f2df0d362 (patch)
tree196c10beb13b46ae12ccffd79affbbba5dbbca2c /gdb/target.c
parentbce613b9bfac3b56f4f9742776db11aeec875300 (diff)
downloadgdb-4b5752d02f5e21329ae17790fd766b5f2df0d362.zip
gdb-4b5752d02f5e21329ae17790fd766b5f2df0d362.tar.gz
gdb-4b5752d02f5e21329ae17790fd766b5f2df0d362.tar.bz2
gdb/
* memattr.h (enum mem_access_mode): New value MEM_NONE. * memattr.c (unknown_mem_attrib): New. (inaccessible_by_default): New. (show_inaccessible_by_default): New. (lookup_mem_region): Check inaccessible_by_default. (dummy_cmd): New. (mem_set_cmdlist, mem_show_cmdlist): New. (_initialize_mem): Register new "set" and "show" commands. * target.c (memory_xfer_partial): If memory type is MEM_NONE, return an error. Clip to region size when calling to_xfer_partial. If upper limit of memory range is 0, don't clip anything. gdb/doc/ * gdb.texinfo (Memory Access Checking): New.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 2ff882c..2062733 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1015,7 +1015,8 @@ memory_xfer_partial (struct target_ops *ops, void *readbuf, const void *writebuf
/* Try GDB's internal data cache. */
region = lookup_mem_region (memaddr);
- if (memaddr + len < region->hi)
+ /* region->hi == 0 means there's no upper bound. */
+ if (memaddr + len < region->hi || region->hi == 0)
reg_len = len;
else
reg_len = region->hi - memaddr;
@@ -1037,6 +1038,9 @@ memory_xfer_partial (struct target_ops *ops, void *readbuf, const void *writebuf
if (writebuf != NULL)
error (_("Writing to flash memory forbidden in this context"));
break;
+
+ case MEM_NONE:
+ return -1;
}
if (region->attrib.cache)
@@ -1072,7 +1076,7 @@ memory_xfer_partial (struct target_ops *ops, void *readbuf, const void *writebuf
do
{
res = ops->to_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL,
- readbuf, writebuf, memaddr, len);
+ readbuf, writebuf, memaddr, reg_len);
if (res > 0)
return res;