1 | #include <stdio.h> |
2 | #ifdef _MSC_VER |
3 | #include <windows.h> |
4 | #define sleep(x) Sleep((x) * 1000) |
5 | #else |
6 | #include <unistd.h> |
7 | #endif |
8 | |
9 | int main(int argc, char const *argv[]) |
10 | { |
11 | lldb_enable_attach(); |
12 | |
13 | printf(format: "Hello world.\n" ); // Set break point at this line. |
14 | if (argc == 1) |
15 | return 1; |
16 | |
17 | // Create the synchronization token. |
18 | FILE *f; |
19 | if (f = fopen(filename: argv[1], modes: "wx" )) { |
20 | fputs(s: "\n" , stream: f); |
21 | fflush(stream: f); |
22 | fclose(stream: f); |
23 | } else |
24 | return 1; |
25 | |
26 | // Waiting to be attached by the debugger, otherwise. |
27 | while (1) |
28 | sleep(seconds: 1); // Waiting to be attached... |
29 | } |
30 | |