Jonas Devlieghere c89d721165
[lldb-dap] Remove timings from TestDAP_attach (#163452)
This PR split TestDAP_attach into two tests and removes any reliance on
timing from the simple attach tests. Instead, it uses stdin and stdout
to synchronize between the test and the inferior, and to check that
we're attached to the correct inferior.

Fixes #163295
2025-10-15 09:14:01 -07:00

28 lines
446 B
C

#include "attach.h"
#include <stdio.h>
#ifdef _WIN32
#include <process.h>
#else
#include <unistd.h>
#endif
int main(int argc, char const *argv[]) {
lldb_enable_attach();
if (argc >= 2) {
// Create the synchronization token.
FILE *f = fopen(argv[1], "wx");
if (!f)
return 1;
fputs("\n", f);
fflush(f);
fclose(f);
}
// Wait on input from stdin.
getchar();
printf("pid = %i\n", getpid());
return 0;
}