[lldb/Reproducers] Intercept the FindProcesses API
authorJonas Devlieghere <jonas@devlieghere.com>
Fri, 13 Mar 2020 15:49:15 +0000 (08:49 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Fri, 13 Mar 2020 16:31:35 +0000 (09:31 -0700)
commit2451cbf07bbc500718c30a9e9447385f7235707b
tree6fc1a956ba22fc9d22beb31b5582d22e67a44319
parenta7325298e1f311b383b8ce5ba8e2d3698fef472a
[lldb/Reproducers] Intercept the FindProcesses API

This patch extends the reproducers to intercept calls to FindProcesses.
During capture it serializes the ProcessInstanceInfoList returned by the
API. During replay, it returns the serialized data instead of querying
the host.

The motivation for this patch is supporting the process attach workflow
during replay. Without this change it would incorrectly look for the
inferior on the host during replay and failing if no matching process
was found.

Differential revision: https://reviews.llvm.org/D75877
12 files changed:
lldb/include/lldb/Host/Host.h
lldb/include/lldb/Utility/ProcessInfo.h
lldb/source/Commands/CommandObjectReproducer.cpp
lldb/source/Host/common/Host.cpp
lldb/source/Host/linux/Host.cpp
lldb/source/Host/macosx/objcxx/Host.mm
lldb/source/Host/netbsd/Host.cpp
lldb/source/Host/openbsd/Host.cpp
lldb/source/Utility/ProcessInfo.cpp
lldb/test/API/functionalities/reproducers/attach/Makefile [new file with mode: 0644]
lldb/test/API/functionalities/reproducers/attach/TestReproducerAttach.py [new file with mode: 0644]
lldb/test/API/functionalities/reproducers/attach/main.cpp [new file with mode: 0644]