Re: [patch] Fix a crash on NULL event_thread

Pedro Alves
2008-09-12T22:45:34Z

Hi Jan,

Sorry for the breakage.

On Friday 12 September 2008 23:12:27, Jan Kratochvil wrote:
> Hi Pedro,
>
> various testcases - such as gdb.threads/bp_in_thread.exp - crash HEAD.
> Tested only on Fedora kernel-2.6.27-0.317.rc5.git10.fc10.x86_64 but I
> expect it can happen anywhere.
>
> LINUX_HANDLE_EXTENDED_WAIT calls ADD_LWP but not ADD_THREAD.
>
> Found while investigating a bugreport from Shawn Starr.

Hmm, it may be due to something having changed in the scheduling, as I'm
on ubuntu's 2.6.24-19-generic x86_64 SMP (dual core), and I never saw
that happen.

I'd like to get rid of that ecs->new_thread_event, as you'll notice
in handle_inferior_event just a bit below what you're changing, GDB will
just resume that thread afterwards, meaning, the real event is
just ignored. In this case, you'll get the breakpoint hit again,
but we might lose something else... Plus, this new_thread_event is
sometimes masking targets misbehaving --- we've tripped on that a few
months ago. What I'd like to do, if possible, is to make sure that
we never reach handle_inferior_event with a thread related event, for
a thread that is not in the thread list.

Would it be possible to add the thread to the thread list, in
addition to the lwp?

--
Pedro Alves