Prevent lldb from crashing when multiple threads are concurrently accessing the SB API with reproducer capture enabled. The API instrumentation records both the input arguments and the return value, but it cannot block for the duration of the API call. Therefore we guarantee that the function id and its arguments are emitted as a single unit and that the return value is emitted as a single unit. Every API call is given a monotonically increasing index, which correlates the function with its return value.
Using the index, we can detect situations where the return value does not succeed the function call, in which case we print an error saying that concurrency is not (currently) supported. In the future we might attempt to be smarter and read ahead until we've found the return value matching the current call.