[lldb/Reproducers] Fix passive replay for (char*, size_t) functions.
Several SB API functions return strings using (char*, size_t) output arguments. During capture, we serialize an empty string for the char* because the memory can be uninitialized. During active replay, we have custom replay redirects that ensure that we don't override the buffer from which we're reading, but rather write to a buffer on the heap with the given length. This is sufficient for the active reproducer use case, where we only care about the side effects of the API calls, not the values actually returned. This approach does not not work for passive replay because here we ignore all the incoming arguments, and re-execute the current function with the arguments deserialized from the reproducer. This means that these function will update the deserialized copy of the arguments, rather than whatever was passed in by the SWIG wrapper. To solve this problem, this patch extends the reproducer instrumentation to handle this special case for passive replay. We nog ignore the replayer in the registry and the incoming char pointer, and instead reinvoke the current method on the deserialized class, and populate the output argument. Differential revision: https://reviews.llvm.org/D77759
Loading
Please sign in to comment