This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Remove MAX_REGISTER_SIZE from sol-thread.c


Alan Hayward <Alan.Hayward@arm.com> writes:

> Regcache calls in sol-thread.c are bogus and do nothing.
> The code in between will not change or update regcache.
> Removed.

If we remove code, we need to figure out why the code was there.
The code is about to remove was added by

commit 7cdd6cac82faad2083029b2ac014d44d869f76c0
Author: Frank Ch. Eigler <fche@redhat.com>
Date:   Thu Apr 2 18:54:04 1998 +0000

    * Fixes for PR 14571.
    
    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.

and there was a global buffer "registers".  However, the global buffer
no longer exists in current GDB, so the code is no longer needed, IMO.

Hi, Frank, do you remember how does your patch (above) fix the problem
you described in the ChangeLog?  I don't see how p_td_thr_getgregs and
p_td_thr_getfpregs clobber the global buffer 'registers'.

> diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
> index a09a3ab9a8bc56f367e3ba1537f5674f0a7f491f..06b146c314a10be0e360a7242bab229ced1c00b1 100644
> --- a/gdb/sol-thread.c
> +++ b/gdb/sol-thread.c
> @@ -534,12 +534,6 @@ sol_thread_store_registers (struct target_ops *ops,
>
>    if (regnum != -1)
>      {
> -      /* Not writing all the registers.  */
> -      char old_value[MAX_REGISTER_SIZE];
> -
> -      /* Save new register value.  */
> -      regcache_raw_collect (regcache, regnum, old_value);
> -
>        val = p_td_thr_getgregs (&thandle, gregset);
>        if (val != TD_OK)
>  	error (_("sol_thread_store_registers: td_thr_getgregs %s"),
> @@ -548,9 +542,6 @@ sol_thread_store_registers (struct target_ops *ops,
>        if (val != TD_OK)
>  	error (_("sol_thread_store_registers: td_thr_getfpregs %s"),
>  	       td_err_string (val));
> -
> -      /* Restore new register value.  */
> -      regcache_raw_supply (regcache, regnum, old_value);

-- 
Yao (齐尧)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]