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

source code of lldb/test/API/tools/lldb-dap/attach/main.c