aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-02-04 15:46:49 +0000
committerPedro Alves <palves@redhat.com>2011-02-04 15:46:49 +0000
commit041274d86dbad1e84b5c09c236b9d68952406aea (patch)
treef9db8374fbd3f5695e5835d9951b659d2dcad68f /gdb/regcache.c
parentfcc82f68c5ea9860724aed5e79f446af1191496d (diff)
downloadfsf-binutils-gdb-041274d86dbad1e84b5c09c236b9d68952406aea.zip
fsf-binutils-gdb-041274d86dbad1e84b5c09c236b9d68952406aea.tar.gz
fsf-binutils-gdb-041274d86dbad1e84b5c09c236b9d68952406aea.tar.bz2
* regcache.c (registers_changed_ptid): Don't explictly always
clear `current_regcache'. Only clear current_thread_ptid and current_thread_arch when PTID matches. Only reinit the frame cache if PTID matches the current inferior_ptid. Move alloca(0) call to ... (registers_changed): ... here.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 53e0c59..286f1d1 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -530,6 +530,7 @@ void
registers_changed_ptid (ptid_t ptid)
{
struct regcache_list *list, **list_link;
+ int wildcard = ptid_equal (ptid, minus_one_ptid);
list = current_regcache;
list_link = &current_regcache;
@@ -550,13 +551,24 @@ registers_changed_ptid (ptid_t ptid)
list = *list_link;
}
- current_regcache = NULL;
+ if (wildcard || ptid_equal (ptid, current_thread_ptid))
+ {
+ current_thread_ptid = null_ptid;
+ current_thread_arch = NULL;
+ }
- current_thread_ptid = null_ptid;
- current_thread_arch = NULL;
+ if (wildcard || ptid_equal (ptid, inferior_ptid))
+ {
+ /* We just deleted the regcache of the current thread. Need to
+ forget about any frames we have cached, too. */
+ reinit_frame_cache ();
+ }
+}
- /* Need to forget about any frames we have cached, too. */
- reinit_frame_cache ();
+void
+registers_changed (void)
+{
+ registers_changed_ptid (minus_one_ptid);
/* Force cleanup of any alloca areas if using C alloca instead of
a builtin alloca. This particular call is used to clean up
@@ -567,12 +579,6 @@ registers_changed_ptid (ptid_t ptid)
}
void
-registers_changed (void)
-{
- registers_changed_ptid (minus_one_ptid);
-}
-
-void
regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
{
gdb_assert (regcache != NULL && buf != NULL);