Jason Molenda b3a3cd1f4e When we interrupt a process, it was possible or the thread names
to not be set by Process::WillPublicStop() so the driver won't get
access to them.  The fix is straightforward, moving the call to
WillPublicStop above the early return for the interrupt case.  (the
interrupt case does an early return because the rest of the function
is concerned with running stop hooks etc and those are not applicable
when we've interrupted the process).

Also added a test case for it.  The test case is a little complicated
because I needed to drive lldb asynchronously to give the program
a chance to get up and running before I interrupt it.  Running to
a breakpoint was not sufficient to catch this bug.

<rdar://problem/22693778> 

llvm-svn: 289026
2016-12-08 06:27:29 +00:00

37 lines
628 B
C

#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
int threads_up_and_running = 0;
void *
second_thread (void *in)
{
pthread_setname_np ("second thread");
while (1)
sleep (1);
return NULL;
}
void *
third_thread (void *in)
{
pthread_setname_np ("third thread");
while (1)
sleep (1);
return NULL;
}
int main ()
{
pthread_setname_np ("main thread");
pthread_t other_thread;
pthread_create (&other_thread, NULL, second_thread, NULL);
pthread_create (&other_thread, NULL, third_thread, NULL);
threads_up_and_running = 1;
while (1)
sleep (1);
}