xref: /llvm-project/lldb/test/API/macosx/find-dsym/deep-bundle/main.c (revision 37ec83fcfc6c7915c51268f578b8e0dadb54c1cf)
199451b44SJordan Rupprecht #include <MyFramework/MyFramework.h>
299451b44SJordan Rupprecht #include <unistd.h>
399451b44SJordan Rupprecht #include <stdio.h>
499451b44SJordan Rupprecht #include <stdlib.h>
599451b44SJordan Rupprecht 
699451b44SJordan Rupprecht int setup_is_complete = 0;
799451b44SJordan Rupprecht 
main(int argc,const char ** argv)899451b44SJordan Rupprecht int main(int argc, const char **argv)
999451b44SJordan Rupprecht {
1099451b44SJordan Rupprecht     char command[8192];
1199451b44SJordan Rupprecht     sprintf (command,
1299451b44SJordan Rupprecht              "/bin/rm -rf %s/MyFramework %s/MyFramework.framework %s/MyFramework.framework.dSYM",
1399451b44SJordan Rupprecht              argv[1], argv[1], argv[1]);
1499451b44SJordan Rupprecht     system (command);
1599451b44SJordan Rupprecht 
16*37ec83fcSJonas Devlieghere     FILE *fp = fopen (argv[2], "w");
17*37ec83fcSJonas Devlieghere     fclose (fp);
1899451b44SJordan Rupprecht     setup_is_complete = 1;
1999451b44SJordan Rupprecht 
2099451b44SJordan Rupprecht     // At this point we want lldb to attach to the process.  If lldb attaches
2199451b44SJordan Rupprecht     // before we've removed the framework we're running against, it will be
2299451b44SJordan Rupprecht     // easy for lldb to find the binary & dSYM without using target.exec-search-paths,
2399451b44SJordan Rupprecht     // which is the point of this test.
2499451b44SJordan Rupprecht 
2599451b44SJordan Rupprecht     for (int loop_limiter = 0; loop_limiter < 100; loop_limiter++)
2699451b44SJordan Rupprecht         sleep (1);
2799451b44SJordan Rupprecht 
2899451b44SJordan Rupprecht      return foo();
2999451b44SJordan Rupprecht }
30