xref: /llvm-project/lldb/test/API/tools/lldb-dap/attach/main.c (revision af3ee626a396aa9ac9480131f48f6ebe2f6664c1)
1 #include <stdio.h>
2 #ifdef _WIN32
3 #include <process.h>
4 #include <windows.h>
5 #else
6 #include <unistd.h>
7 #endif
8 
9 int main(int argc, char const *argv[]) {
10   lldb_enable_attach();
11 
12   if (argc >= 2) {
13     // Create the synchronization token.
14     FILE *f = fopen(argv[1], "wx");
15     if (!f)
16       return 1;
17     fputs("\n", f);
18     fflush(f);
19     fclose(f);
20   }
21 
22   printf("pid = %i\n", getpid());
23 #ifdef _WIN32
24   Sleep(10 * 1000);
25 #else
26   sleep(10);
27 #endif
28   return 0; // breakpoint 1
29 }
30