Add synchronization for asynchronous events. This fixes an un expected packet during replay when an asynchronous event triggers a GDB packet. Consider the following example:
$ ./bin/lldb --capture (lldb) gdb-remote 13000 Process 770 stopped * thread #1, stop reason = signal SIGSTOP frame #0: 0x0000000105071000 dyld`_dyld_start (lldb) cont Process 770 resuming Process 770 exited with status = 0 (0x00000000) (lldb) reproducer generate $ ./bin/lldb --replay /path/to/reproducer (lldb) gdb-remote 13000 (lldb) cont Reproducer expected packet: '$jThreadExtendedInfo:{"thread":14341}#01' Reproducer received packet: 'c' LLVM ERROR: Encountered unexpected packet during replay
The way the thread state is displayed at the prompt is asynchronous. It reacts to an event, in this case a process state change on connection.
I haven't bothered too much with naming. The same logic should be applicable to other situations that require synchronization.