[all-commits] [llvm/llvm-project] e687aa: [lldb/Reproducers] Fix passive replay for (char*, ...

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Mon Apr 20 13:26:36 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e687aa82826385454a3d3a192a46b7a9d4eddae1
      https://github.com/llvm/llvm-project/commit/e687aa82826385454a3d3a192a46b7a9d4eddae1
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2020-04-20 (Mon, 20 Apr 2020)

  Changed paths:
    M lldb/include/lldb/Utility/ReproducerInstrumentation.h
    M lldb/source/API/SBDebugger.cpp
    M lldb/source/API/SBFileSpec.cpp
    M lldb/source/API/SBProcess.cpp
    M lldb/source/API/SBStructuredData.cpp
    M lldb/source/API/SBThread.cpp
    M lldb/unittests/Utility/ReproducerInstrumentationTest.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list