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] Workaround for 10970, 12702, avoid calling waitpid


On Wednesday 18 May 2011 19:53:02, Jan Kratochvil wrote:
> > The inferior exit code reported to the core/user will be the
> > exit code of the last LWP that exits, instead of the
> > leader's exit code.  We've stepped out of C realm when
> > the leader exited, so I'm not sure that matters (or how
> > to make it be != 0, even).
> 
> I do not understand this comment much.  That != 0 is here for PID from waitpid
> which is unrelated to the exit code (present in STATUS).

I was talking about the exit code of the last cloned 
lwp to exit ending up as exit code of the inferior
(TARGET_WAITKIND_EXITED's value.integer), not the
return of that waitpid call.

linux_nat_filter_event
...
      if (num_lwps (GET_PID (lp->ptid)) > 1)
       {
	 /* If there is at least one more LWP, then the exit signal
	    was not the end of the debugged application and should be
	    ignored.  */
	 exit_lwp (lp);
	 return NULL;
       }
...

linux_nat_wait_1
   store_waitstatus (ourstatus, status);

When the last lwp exits, we'll report it's exit code as the
inferior exit code to infrun, instead of the leader's exit
code.

> 
> 
> No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu.
> 
> I will check it in if no futher comments appear.

-- 
Pedro Alves


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