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 2/8] [PowerPC] Consolidate wordsize getter between native and gdbserver


Pedro Franco de Carvalho wrote:

> gdb/ChangeLog:
> yyyy-mm-dd  Pedro Franco de Carvalho  <pedromfc@linux.vnet.ibm.com>
> 
> 	* configure.nat <linux powerpc>: Add ppc-linux.o to NATDEPFILES.
> 	* ppc-linux-nat.c (ppc_linux_target_wordsize): Move to
> 	nat/ppc-linux.c.
> 	(ppc_linux_nat_target::auxv_parse): Get thread id tid. Call
> 	ppc_linux_target wordsize with tid.
> 	(ppc_linux_nat_target::read_description): Call ppc_linux_target
> 	wordsize with tid.
> 	* nat/ppc-linux.c: Include nat/gdb_ptrace.h.
> 	(ppc_linux_target_wordsize): Move here from ppc-linux-nat.c. Add
> 	tid parameter. Remove static specifier.
> 	* nat/ppc-linux.h (ppc_linux_target_wordsize): New declaration.
> 
> gdb/gdbserver/ChangeLog:
> yyyy-mm-dd  Pedro Franco de Carvalho  <pedromfc@linux.vnet.ibm.com>
> 
> 	* linux-ppc-low.c (ppc_arch_setup): Remove code for getting the
> 	wordsize of the inferior. Call ppc_linux_target_wordsize.


> +int
> +ppc_linux_target_wordsize (int tid)
> +{
> +  int wordsize = 4;
> +
> +  /* Check for 64-bit inferior process.  This is the case when the host is
> +     64-bit, and in addition the top bit of the MSR register is set.  */
> +#ifdef __powerpc64__
> +  long msr;
> +
> +  errno = 0;
> +  msr = (long) ptrace (PTRACE_PEEKUSER, tid, PT_MSR * 8, 0);
> +  if (errno == 0 && ppc64_64bit_inferior_p (msr))
> +    wordsize = 8;
> +#endif
> +
> +  return wordsize;
> +}

Is this now the only remaining user of ppc64_64bit_inferior_p?  If so,
the function should be made static or even inlined here.

Otherwise, this is OK.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


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