aboutsummaryrefslogtreecommitdiff
path: root/gdb/infptrace.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2001-11-19 23:59:55 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2001-11-19 23:59:55 +0000
commit8b6f1f3a31e4a5ba0151f3ec9d0b31688c28de35 (patch)
tree750317a48b3ed3dc5111c82d537e1ed1af72f8a0 /gdb/infptrace.c
parent479412cd97ece8382f79067ffc6cc3df96446c19 (diff)
downloadgdb-8b6f1f3a31e4a5ba0151f3ec9d0b31688c28de35.zip
gdb-8b6f1f3a31e4a5ba0151f3ec9d0b31688c28de35.tar.gz
gdb-8b6f1f3a31e4a5ba0151f3ec9d0b31688c28de35.tar.bz2
2001-11-19 Elena Zannoni <ezannoni@redhat.com>
* infptrace.c (fetch_register): Dynamically allocate buffer for register. (store_register): Use regcache_collect, instead of accessing the register buffer directly.
Diffstat (limited to 'gdb/infptrace.c')
-rw-r--r--gdb/infptrace.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/infptrace.c b/gdb/infptrace.c
index d0df642..9815e05 100644
--- a/gdb/infptrace.c
+++ b/gdb/infptrace.c
@@ -359,7 +359,7 @@ fetch_register (int regno)
char mess[128]; /* For messages */
register int i;
unsigned int offset; /* Offset of registers within the u area. */
- char buf[MAX_REGISTER_RAW_SIZE];
+ char *buf = alloca (MAX_REGISTER_RAW_SIZE);
int tid;
if (CANNOT_FETCH_REGISTER (regno))
@@ -424,6 +424,7 @@ store_register (int regno)
register int i;
unsigned int offset; /* Offset of registers within the u area. */
int tid;
+ char *buf = alloca (MAX_REGISTER_RAW_SIZE);
if (CANNOT_STORE_REGISTER (regno))
{
@@ -437,11 +438,16 @@ store_register (int regno)
offset = U_REGS_OFFSET;
regaddr = register_addr (regno, offset);
+
+ /* Put the contents of regno into a local buffer */
+ regcache_collect (regno, buf);
+
+ /* Store the local buffer into the inferior a chunk at the time. */
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE))
{
errno = 0;
ptrace (PT_WRITE_U, tid, (PTRACE_ARG3_TYPE) regaddr,
- *(PTRACE_XFER_TYPE *) & registers[REGISTER_BYTE (regno) + i]);
+ *(PTRACE_XFER_TYPE *) (buf + i));
regaddr += sizeof (PTRACE_XFER_TYPE);
if (errno != 0)
{