This is the mail archive of the 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 for internal-error: linux_nat_post_attach_wait: Assertion `pid == new_pid && WIFSTOPPED (status)' failed.

On Tue, Oct 13, 2009 at 1:53 PM, Pedro Alves <> wrote:

>> 2009-10-13  Paul Pluzhnikov  <>
>>       * linux-nat.c (linux_nat_post_attach_wait): Adjust assert.

> Sorry, but this isn't correct.

Thanks for review and explanations.

> I think what we should do is just get rid of the new
> LWP that we found exiting right after attaching.

I believe the new patch below achieves that.

It's very hard to test, since it only happens once in about 50
attaches, but I did catch this several times, and GDB appears to
have done the right thing.

> I would believe that we can also see the main LWP exit right
> after attach (in linux_nat_attach).  I'm not sure what exactly
> is the best to do UI wise in that case.  If we want to store
> the event pending to report later, we'll have to use
> the lwp->waitstatus field, not lwp->status, due to the
> fact that lwp->status == 0 is ambiguous with
> "no-stored-pending-event" (see status_callback).

I believe I did this now. Not sure whether lp->resumed should also
be set here.

> The simple
> alternative is to again just pretend that the process had
> exited before we managed to attach to it, get rid of it,
> and error out like we would if the process didn't exist
> at all when we tried to attach.

This appears harder to do, since to_attach doesn't return anything.

Paul Pluzhnikov

2009-10-14  Paul Pluzhnikov  <>

	* linux-nat.c (linux_nat_post_attach_wait): Return
	success/failure indicator.
	(lin_lwp_attach_lwp, linux_nat_attach): Adjust.

Attachment: gdb-assert-10757-20091014.txt
Description: Text document

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