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: [rfc/rft] [3/5] Untangle register_addr: CANNOT_FETCH/STORE_REGISTER


> Date: Sat, 14 Apr 2007 23:10:28 +0200 (CEST)
> From: "Ulrich Weigand" <uweigand@de.ibm.com>
> 
> Hello,
> 
> this patch removes the calls to CANNOT_FETCH_REGISTER / CANNOT_STORE_REGISTER
> from within the inf_ptrace_trad_target routines.  This is enabled by two 
> changes to the register_u_offset callback:
>  - the routine is allowed to return (CORE_ADDR)-1 to indicate the 
>    requested register cannot be accessed
>  - the routine gains a new argument STORE_P that indicates whether
>    the register is to be fetched or stored

So effectively, this turns CANNOT_FETCH_REGISTER/CANNOT_STORE_REGISTER
from being overloaded as both a native and target property into a
target-architecture-only property instead.  That's probably a good
idea.

However, I think you removing the calls from the calls from the
inf_ptrace_trad_target routines is wrong.  We should never fetch/store
the registers for which the target architecture says that they cannot
be fetched/stored.

If you leave them in, do any targets remain that have any registers
that can be fetched but cannot be stored by ptrace(2), that are not
defined as such by the target architecture.  I'd be surprised if there
were any such registers.

In that cas you wouldn't need the extra store_p argument for the
register_u_addr() callback.


> ChangeLog:
> 
> 	* inf-ptrace.c (inf_ptrace_register_u_offset): Add STORE_P argument.
> 	(inf_ptrace_fetch_register): Update call.  Check for (CORE_ADDR)-1
> 	return value; replaces CANNOT_FETCH_REGISTER call.
> 	(inf_ptrace_store_register): Update call.  Check for (CORE_ADDR)-1
> 	return value; replaces CANNOT_STORE_REGISTER call.
> 	(inf_ptrace_trad_target): Update signature.
> 	* inf-ptrace.h (inf_ptrace_trad_target): Likewise.
> 	* linux-nat.c (linux_trad_target): Likewise.
> 	* linux-nat.h (linux_trad_target): Likewise.
> 
> 	* alpha-linux-nat.c (alpha_linux_register_u_offset): Add STORE_P
> 	argument.  Call CANNOT_STORE_REGISTER / CANNOT_FETCH_REGISTER.
> 	* mips-linux-nat.c (mips_linux_register_u_offset): Likewise.
> 	* vax-nat.c (vax_register_u_addr): Add STORE_P argument.


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