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: ping: [patch 4/4]#3 Remove redundant lp->siginfo


Looks good.

On Wednesday 18 May 2011 20:22:48, Jan Kratochvil wrote:
>  struct siginfo *
>  linux_nat_get_siginfo (ptid_t ptid)

Minor nit.  I'd've preferred to have the interface changed
to something like

  int
  linux_nat_get_siginfo (ptid_t ptid, struct siginfo *siginfo)

(and make the callers pass in a pointer to a siginfo to fill,
mirroring the PTRACE_GETSIGINFO interface)

>  {
> -  struct lwp_info *lp = find_lwp_pid (ptid);
> +  static struct siginfo siginfo;

than having a hidden static, but it's fine with me to leave
as is if you prefer that way.

> +  int pid;
>  
> -  gdb_assert (lp != NULL);
> +  pid = GET_LWP (ptid);
> +  if (pid == 0)
> +    pid = GET_PID (ptid);
> +
> +  errno = 0;
> +  ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
> +  if (errno != 0)
> +    memset (&siginfo, 0, sizeof (siginfo));
>  

-- 
Pedro Alves


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