Files
clang-p2996/lldb/test/API/functionalities/reproducers/attach/main.cpp
Jonas Devlieghere 2451cbf07b [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
2020-03-13 09:31:35 -07:00

25 lines
390 B
C++

#include <chrono>
#include <stdio.h>
#include <thread>
using std::chrono::seconds;
int main(int argc, char const *argv[]) {
lldb_enable_attach();
// Create the synchronization token.
FILE *f;
if (f = fopen(argv[1], "wx")) {
fputs("\n", f);
fflush(f);
fclose(f);
} else
return 1;
while (true) {
std::this_thread::sleep_for(seconds(1));
}
return 0;
}