• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <os/activity.h>
2 #include <os/log.h>
3 #include <stdio.h>
4 
5 #include "../common/darwin_log_common.h"
6 
main(int argc,char ** argv)7 int main(int argc, char** argv)
8 {
9     os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
10     if (!logger_sub1)
11         return 1;
12 
13     // Note we cannot use the os_log() line as the breakpoint because, as of
14     // the initial writing of this test, we get multiple breakpoints for that
15     // line, which confuses the pexpect test logic.
16     printf("About to log\n"); // break here
17     os_activity_t parent_activity = os_activity_create("parent-activity",
18                                                        OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
19     os_activity_apply(parent_activity, ^{
20         os_activity_t child_activity = os_activity_create("child-activity",
21                                                           OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
22         os_activity_apply(child_activity, ^{
23             os_log(logger_sub1, "This is the log message.");
24         });
25     });
26 
27     // Sleep, as the darwin log reporting doesn't always happen until a bit
28     // later.  We need the message to come out before the process terminates.
29     sleep(FINAL_WAIT_SECONDS);
30 
31     return 0;
32 }
33