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 main(int argc,char const * argv[])9int main(int argc, char const *argv[]) 10 { 11 lldb_enable_attach(); 12 13 printf("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(argv[1], "wx")) { 20 fputs("\n", f); 21 fflush(f); 22 fclose(f); 23 } else 24 return 1; 25 26 // Waiting to be attached by the debugger, otherwise. 27 while (1) 28 sleep(1); // Waiting to be attached... 29 } 30