summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-05-17 16:17:30 +0000
committerAndrew Cagney <cagney@redhat.com>2002-05-17 16:17:30 +0000
commit2a877cacd585eb7ec929a470aaa39202b847c962 (patch)
treee3740dcd9355796e74ad0182e2d81f445bdf1b77
parentd15ac2350f0d0e14e9f45c273075f7b1098efb0e (diff)
downloadgdb-2a877cacd585eb7ec929a470aaa39202b847c962.tar.gz
regcache_move()
-rw-r--r--gdb/regcache.c28
-rw-r--r--gdb/regcache.h4
2 files changed, 22 insertions, 10 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 3c9617658e0..f1a658a5067 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -183,12 +183,13 @@ regcache_xmalloc_with_cleanup (struct gdbarch *gdbarch)
}
void
-regcache_move (struct regcache *dst, struct regcache *src)
+regcache_cpy (struct regcache *dst, struct regcache *src)
{
int i;
char *buf = alloca (MAX_REGISTER_RAW_SIZE);
gdb_assert (src != NULL && dst != NULL);
gdb_assert (src->descr->gdbarch == dst->descr->gdbarch);
+ gdb_assert (src != dst);
/* FIXME: cagney/2002-05-17: To say this bit is bad is being polite.
It keeps the existing code working where things rely on going
through the register cache. */
@@ -200,6 +201,17 @@ regcache_move (struct regcache *dst, struct regcache *src)
read_register_bytes (0, dst->registers, REGISTER_BYTES);
return;
}
+ /* FIXME: cagney/2002-05-17: To say this bit is bad is being polite.
+ It keeps the existing code working where things rely on going
+ through the register cache. */
+ if (dst == current_regcache
+ && !gdbarch_register_read_p (dst->descr->gdbarch))
+ {
+ /* ULGH!!!! Old way. Use REGISTER bytes and let code below
+ untangle fetch. */
+ write_register_bytes (0, src->registers, REGISTER_BYTES);
+ return;
+ }
for (i = 0; i < current_regcache->descr->nr_registers; i++)
{
/* Should we worry about the valid bit here? */
@@ -209,7 +221,7 @@ regcache_move (struct regcache *dst, struct regcache *src)
}
void
-regcache_move_no_passthrough (struct regcache *dst, struct regcache *src)
+regcache_cpy_no_passthrough (struct regcache *dst, struct regcache *src)
{
int i;
gdb_assert (src != NULL && dst != NULL);
@@ -230,7 +242,7 @@ regcache_dup (struct regcache *src)
struct regcache *newbuf;
gdb_assert (current_regcache != NULL);
newbuf = regcache_xmalloc (src->descr->gdbarch);
- regcache_move (newbuf, src);
+ regcache_cpy (newbuf, src);
return newbuf;
}
@@ -240,7 +252,7 @@ regcache_dup_no_passthrough (struct regcache *src)
struct regcache *newbuf;
gdb_assert (current_regcache != NULL);
newbuf = regcache_xmalloc (src->descr->gdbarch);
- regcache_move_no_passthrough (newbuf, src);
+ regcache_cpy_no_passthrough (newbuf, src);
return newbuf;
}
@@ -1035,7 +1047,7 @@ regcache_save (struct regcache *regcache)
char *buf = alloca (MAX_REGISTER_RAW_SIZE);
gdb_assert (current_regcache != NULL && regcache != NULL);
gdb_assert (current_regcache->descr->gdbarch == regcache->descr->gdbarch);
- regcache_move (regcache, current_regcache);
+ regcache_cpy (regcache, current_regcache);
}
void
@@ -1043,7 +1055,7 @@ regcache_save_no_passthrough (struct regcache *regcache)
{
gdb_assert (current_regcache != NULL && regcache != NULL);
gdb_assert (current_regcache->descr->gdbarch == regcache->descr->gdbarch);
- regcache_move_no_passthrough (regcache, current_regcache);
+ regcache_cpy_no_passthrough (regcache, current_regcache);
}
void
@@ -1053,7 +1065,7 @@ regcache_restore (struct regcache *regcache)
char *buf = alloca (MAX_REGISTER_RAW_SIZE);
gdb_assert (current_regcache != NULL && regcache != NULL);
gdb_assert (current_regcache->descr->gdbarch == regcache->descr->gdbarch);
- regcache_move (current_regcache, regcache);
+ regcache_cpy (current_regcache, regcache);
}
void
@@ -1062,7 +1074,7 @@ regcache_restore_no_passthrough (struct regcache *regcache)
char *regcache_registers;
gdb_assert (current_regcache != NULL && regcache != NULL);
gdb_assert (current_regcache->descr->gdbarch == regcache->descr->gdbarch);
- regcache_move_no_passthrough (current_regcache, regcache);
+ regcache_cpy_no_passthrough (current_regcache, regcache);
}
void
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 931393527fc..5fb0ac6b8a3 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -70,8 +70,8 @@ extern struct regcache *regcache_dup (struct regcache *regcache);
extern void regcache_save_no_passthrough (struct regcache *regcache);
extern void regcache_restore_no_passthrough (struct regcache *regcache);
extern struct regcache *regcache_dup_no_passthrough (struct regcache *regcache);
-extern void regcache_move (struct regcache *dest, struct regcache *src);
-extern void regcache_move_no_passthrough (struct regcache *dest, struct regcache *src);
+extern void regcache_cpy (struct regcache *dest, struct regcache *src);
+extern void regcache_cpy_no_passthrough (struct regcache *dest, struct regcache *src);
extern char *grub_around_regcache_for_registers (struct regcache *);
extern char *grub_around_regcache_for_register_valid (struct regcache *);