1 //===-- main.c --------------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include <os/activity.h>
13 #include "../../../common/darwin_log_common.h"
15 int main(int argc, char** argv)
17 os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
18 os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
19 if (!logger_sub1 || !logger_sub2)
22 // Note we cannot use the os_log() line as the breakpoint because, as of
23 // the initial writing of this test, we get multiple breakpoints for that
24 // line, which confuses the pexpect test logic.
25 printf("About to log\n"); // break here
26 os_activity_t parent_activity = os_activity_create("parent-activity",
27 OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
28 os_activity_apply(parent_activity, ^{
29 os_log(logger_sub1, "source-log-sub1-cat1");
30 os_activity_t child_activity = os_activity_create("child-activity",
31 OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
32 os_activity_apply(child_activity, ^{
33 os_log(logger_sub2, "source-log-sub2-cat2");
37 // Sleep, as the darwin log reporting doesn't always happen until a bit
38 // later. We need the message to come out before the process terminates.
39 sleep(FINAL_WAIT_SECONDS);