This is the mail archive of the gdb-patches@sources.redhat.com 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] fix inferior_pid argument for arm-netbsd


> On Jan 9,  1:38pm, Richard Earnshaw wrote:
> 
> > 	* armnbsd-nat.c (fetch_inferior_registers): Change inferior_pid -> 
> > 	inferior_ptid.pid.
> 
> Please don't do it this way.  Use the accessor functions instead.  I've
> looked over your patch, and in each case, you can simply use
> 
>     ptid_get_pid (inferior_ptid)
> 

Ah!  I wasn't aware of the accessor functions.  In fact, most targets are 
using the macro GETPID (from defs.h).  I've fixed the code to use that.

R.


Index: armnbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/armnbsd-nat.c,v
retrieving revision 1.1
diff -p -r1.1 armnbsd-nat.c
*** armnbsd-nat.c	2001/12/17 21:14:10	1.1
--- armnbsd-nat.c	2002/01/09 15:51:15
*************** fetch_inferior_registers (regno)
*** 34,46 ****
    struct reg inferior_registers;
    struct fpreg inferior_fpregisters;
  
!   ptrace (PT_GETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0);
    memcpy (&registers[REGISTER_BYTE (0)], &inferior_registers,
  	  16 * sizeof (unsigned int));
    memcpy (&registers[REGISTER_BYTE (PS_REGNUM)], &inferior_registers.r_cpsr,
  	  sizeof (unsigned int));
!   ptrace (PT_GETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_fpregisters,
! 	  0);
    memcpy (&registers[REGISTER_BYTE (F0_REGNUM)], &inferior_fpregisters.fpr[0],
  	  8 * sizeof (fp_reg_t));
    memcpy (&registers[REGISTER_BYTE (FPS_REGNUM)],
--- 34,47 ----
    struct reg inferior_registers;
    struct fpreg inferior_fpregisters;
  
!   ptrace (PT_GETREGS, PIDGET (inferior_ptid),
! 	  (PTRACE_ARG3_TYPE) &inferior_registers, 0);
    memcpy (&registers[REGISTER_BYTE (0)], &inferior_registers,
  	  16 * sizeof (unsigned int));
    memcpy (&registers[REGISTER_BYTE (PS_REGNUM)], &inferior_registers.r_cpsr,
  	  sizeof (unsigned int));
!   ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
! 	  (PTRACE_ARG3_TYPE) &inferior_fpregisters, 0);
    memcpy (&registers[REGISTER_BYTE (F0_REGNUM)], &inferior_fpregisters.fpr[0],
  	  8 * sizeof (fp_reg_t));
    memcpy (&registers[REGISTER_BYTE (FPS_REGNUM)],
*************** store_inferior_registers (regno)
*** 58,64 ****
  	  16 * sizeof (unsigned int));
    memcpy (&inferior_registers.r_cpsr, &registers[REGISTER_BYTE (PS_REGNUM)],
  	  sizeof (unsigned int));
!   ptrace (PT_SETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0);
  
    /* XXX Set FP regs. */
  }
--- 59,66 ----
  	  16 * sizeof (unsigned int));
    memcpy (&inferior_registers.r_cpsr, &registers[REGISTER_BYTE (PS_REGNUM)],
  	  sizeof (unsigned int));
!   ptrace (PT_SETREGS, PIDGET (inferior_ptid),
! 	  (PTRACE_ARG3_TYPE) &inferior_registers, 0);
  
    /* XXX Set FP regs. */
  }

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