Don't update target_dcache if it is not initialized

After previous patch, 'target_dcache' is initialized lazily.  It is
possible that 'target_dcache' is still NULL when GDB writes to memory.
In this case, update to 'target_dcache' can be skipped.

gdb:

2013-11-20  Yao Qi  <yao@codesourcery.com>

	* target.c (memory_xfer_partial_1): Update 'target_dcache' if
	it is initialized.
This commit is contained in:
Yao Qi 2013-10-31 15:01:33 +08:00
parent 2a2f9fe400
commit f2de978509
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2013-11-20 Yao Qi <yao@codesourcery.com>
* target.c (memory_xfer_partial_1): Update 'target_dcache' if
it is initialized.
2013-11-20 Yao Qi <yao@codesourcery.com>
* dcache.c (last_cache): Remove.

View file

@ -1667,11 +1667,12 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
if (res > 0
&& inf != NULL
&& writebuf != NULL
&& target_dcache_init_p ()
&& !region->attrib.cache
&& stack_cache_enabled_p
&& object != TARGET_OBJECT_STACK_MEMORY)
{
DCACHE *dcache = target_dcache_get_or_init ();
DCACHE *dcache = target_dcache_get ();
dcache_update (dcache, memaddr, (void *) writebuf, res);
}