aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2009-09-14 20:49:11 +0000
committerDoug Evans <dje@google.com>2009-09-14 20:49:11 +0000
commit41dcd03ff79cb197e121d17028baefbdf49e306f (patch)
tree3577ecbd62c751e1472fc0864154d9cc0490911d /gdb
parent00878c6e41a8a85fde9d0011809027db3cddee61 (diff)
downloadgdb-41dcd03ff79cb197e121d17028baefbdf49e306f.zip
gdb-41dcd03ff79cb197e121d17028baefbdf49e306f.tar.gz
gdb-41dcd03ff79cb197e121d17028baefbdf49e306f.tar.bz2
* target.c (memory_xfer_partial): Only update dcache after we know
the write succeeded.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/target.c27
2 files changed, 19 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0d6b947..ce226cc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-14 Doug Evans <dje@google.com>
+
+ * target.c (memory_xfer_partial): Only update dcache after we know
+ the write succeeded.
+
2009-09-14 Paul Pluzhnikov <ppluzhnikov@google.com>
*minsyms.c (lookup_minimal_symbol_by_pc_section_1): Assert non-NULL
diff --git a/gdb/target.c b/gdb/target.c
index a662eca..cb955bd 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1289,19 +1289,6 @@ memory_xfer_partial (struct target_ops *ops, enum target_object object,
}
}
- /* Make sure the cache gets updated no matter what - if we are writing
- to the stack, even if this write is not tagged as such, we still need
- to update the cache. */
-
- if (inf != NULL
- && readbuf == NULL
- && !region->attrib.cache
- && stack_cache_enabled_p
- && object != TARGET_OBJECT_STACK_MEMORY)
- {
- dcache_update (target_dcache, memaddr, (void *) writebuf, reg_len);
- }
-
/* If none of those methods found the memory we wanted, fall back
to a target partial transfer. Normally a single call to
to_xfer_partial is enough; if it doesn't recognize an object
@@ -1331,6 +1318,20 @@ memory_xfer_partial (struct target_ops *ops, enum target_object object,
if (readbuf && !show_memory_breakpoints)
breakpoint_restore_shadows (readbuf, memaddr, reg_len);
+ /* Make sure the cache gets updated no matter what - if we are writing
+ to the stack. Even if this write is not tagged as such, we still need
+ to update the cache. */
+
+ if (res > 0
+ && inf != NULL
+ && writebuf != NULL
+ && !region->attrib.cache
+ && stack_cache_enabled_p
+ && object != TARGET_OBJECT_STACK_MEMORY)
+ {
+ dcache_update (target_dcache, memaddr, (void *) writebuf, reg_len);
+ }
+
/* If we still haven't got anything, return the last error. We
give up. */
return res;