summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2010-04-12 13:25:51 +0000
committerPedro Alves <pedro@codesourcery.com>2010-04-12 13:25:51 +0000
commit66e4d3883383c9d42113c7e8c614dff8646deb35 (patch)
treef206fdb3fbd57ffa0a7563bfff31261e51cc3cd0 /gdb
parent63222cac28a232f0e4610a6c17ea72ab4d3d6372 (diff)
downloadgdb-66e4d3883383c9d42113c7e8c614dff8646deb35.tar.gz
* regcache.c (set_register_cache): Invalidate regcaches before
changing the register cache layout. (regcache_invalidate_one): Allow a NULL regcache. * linux-x86-low.c (x86_linux_update_xmltarget): Invalidate regcaches before changing the register cache layout or the target regsets.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/gdbserver/ChangeLog9
-rw-r--r--gdb/gdbserver/linux-x86-low.c5
-rw-r--r--gdb/gdbserver/regcache.c7
3 files changed, 21 insertions, 0 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 87bf6956e1a..a860f5217bc 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,12 @@
+2010-04-12 Pedro Alves <pedro@codesourcery.com>
+
+ * regcache.c (set_register_cache): Invalidate regcaches before
+ changing the register cache layout.
+ (regcache_invalidate_one): Allow a NULL regcache.
+ * linux-x86-low.c (x86_linux_update_xmltarget): Invalidate
+ regcaches before changing the register cache layout or the target
+ regsets.
+
2010-04-12 H.J. Lu <hongjiu.lu@intel.com>
* linux-x86-low.c (x86_linux_update_xmltarget): Avoid unused
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 1c282791ba3..ec01f37e6de 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -841,6 +841,11 @@ x86_linux_update_xmltarget (void)
if (!current_inferior)
return;
+ /* Before changing the register cache internal layout or the target
+ regsets, flush the contents of the current valid caches back to
+ the threads. */
+ regcache_invalidate ();
+
pid = pid_of (get_thread_lwp (current_inferior));
#ifdef __x86_64__
if (num_xmm_registers == 8)
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index 29fa2ff30a7..9077a7198c8 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -61,6 +61,9 @@ regcache_invalidate_one (struct inferior_list_entry *entry)
regcache = (struct regcache *) inferior_regcache_data (thread);
+ if (regcache == NULL)
+ return;
+
if (regcache->registers_valid)
{
struct thread_info *saved_inferior = current_inferior;
@@ -149,6 +152,10 @@ set_register_cache (struct reg *regs, int n)
{
int offset, i;
+ /* Before changing the register cache internal layout, flush the
+ contents of valid caches back to the threads. */
+ regcache_invalidate ();
+
reg_defs = regs;
num_registers = n;