]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2001-11-19 Elena Zannoni <ezannoni@redhat.com>
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>
Mon, 19 Nov 2001 23:59:55 +0000 (23:59 +0000)
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>
Mon, 19 Nov 2001 23:59:55 +0000 (23:59 +0000)
* infptrace.c (fetch_register): Dynamically allocate buffer for
register.
(store_register): Use regcache_collect, instead of accessing the
register buffer directly.

gdb/ChangeLog
gdb/infptrace.c

index 7496a06bc4171ed4b2d4f1d3deb546bb40a69027..ea26632e3249f771e3f23f5f255190ba40f34934 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2001-11-19  Daniel Jacobowitz  <drow@mvista.com>
 
        * mips-tdep.c (find_proc_desc): Add cur_frame argument.  Pass
index d0df64291fae0a2c1edba56a654273b2671e59bb..9815e05ef0b89a04321d32d3b266a7ab996169c7 100644 (file)
@@ -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)
        {