summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c
blob: c69d0ab1c3534d740e80a1db0c94003cf20b5a59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//===-- main.c --------------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include <os/log.h>
#include <stdio.h>

#include "../common/darwin_log_common.h"

int main(int argc, char** argv)
{
    os_log_t logger = os_log_create("org.llvm.lldb.test", "basic-test");
    if (!logger)
        return 1;

    // Note we cannot use the os_log() line as the breakpoint because, as of
    // the initial writing of this test, we get multiple breakpoints for that
    // line, which confuses the pexpect test logic.
    printf("About to log\n"); // break here
    os_log(logger, "Hello, world");

    // Sleep, as the darwin log reporting doesn't always happen until a bit
    // later.  We need the message to come out before the process terminates.
    sleep(FINAL_WAIT_SECONDS);

    return 0;
}