* Fixes for PR 14571.
authorFrank Ch. Eigler <fche@redhat.com>
Thu, 2 Apr 1998 18:54:04 +0000 (18:54 +0000)
committerFrank Ch. Eigler <fche@redhat.com>
Thu, 2 Apr 1998 18:54:04 +0000 (18:54 +0000)
Thu Apr  2 12:47:41 1998  Frank Ch. Eigler  <fche@cygnus.com>

* sol-thread.c (sol_thread_store_registers): Save & restore new
  value of single updated register to prevent accidental clobbering.

gdb/sol-thread.c

index edd54f13d6a0e9904dce462c03ca1e41adf40984..fbbbbcb02b2c0cf96d0adfc672e2faf309c159fe 100644 (file)
@@ -704,6 +704,10 @@ sol_thread_store_registers (regno)
 
   if (regno != -1)
     {                          /* Not writing all the regs */
+      /* save new register value */
+      char old_value[REGISTER_SIZE];
+      memcpy(old_value, & registers[REGISTER_BYTE(regno)], REGISTER_SIZE);
+
       val = p_td_thr_getgregs (&thandle, regset);
       if (val != TD_OK)
        error ("sol_thread_store_registers: td_thr_getgregs %s",
@@ -713,6 +717,9 @@ sol_thread_store_registers (regno)
        error ("sol_thread_store_registers: td_thr_getfpregs %s",
               td_err_string (val));
 
+      /* restore register value */
+      memcpy(& registers[REGISTER_BYTE(regno)], old_value, REGISTER_SIZE);
+
 #if 0
 /* thread_db doesn't seem to handle this right */
       val = td_thr_getxregsize (&thandle, &xregsize);