summaryrefslogtreecommitdiffstats
blob: 8b76a6513368eb73e9f896ab217269507e122033 (plain) (blame)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
cc_defaults {
    name: "libmemunreachable_defaults",

    cflags: [
        "-Wall",
        "-Wextra",
        "-Werror",
    ],
    shared_libs: [
        "libbase",
    ],

    target: {
        android: {
            static_libs: ["libasync_safe"],
        },
        host: {
            shared_libs: ["liblog"],
        }
    },
}

cc_library_shared {
    name: "libmemunreachable",
    defaults: ["libmemunreachable_defaults"],
    srcs: [
        "Allocator.cpp",
        "Binder.cpp",
        "HeapWalker.cpp",
        "LeakFolding.cpp",
        "LeakPipe.cpp",
        "LineBuffer.cpp",
        "MemUnreachable.cpp",
        "ProcessMappings.cpp",
        "PtracerThread.cpp",
        "ThreadCapture.cpp",
    ],

    static_libs: [
        "libc_malloc_debug_backtrace",
    ],
    // Only need this for arm since libc++ uses its own unwind code that
    // doesn't mix with the other default unwind code.
    arch: {
        arm: {
            static_libs: ["libunwind_llvm"],
        },
    },
    export_include_dirs: ["include"],
    local_include_dirs: ["include"],
}

cc_test {
    name: "memunreachable_test",
    defaults: ["libmemunreachable_defaults"],
    host_supported: true,
    srcs: [
        "tests/Allocator_test.cpp",
        "tests/HeapWalker_test.cpp",
        "tests/LeakFolding_test.cpp",
    ],

    target: {
        android: {
            srcs: [
                "tests/DisableMalloc_test.cpp",
                "tests/MemUnreachable_test.cpp",
                "tests/ThreadCapture_test.cpp",
            ],
            shared_libs: [
                "libmemunreachable",
            ],
        },
        host: {
            srcs: [
                "Allocator.cpp",
                "HeapWalker.cpp",
                "LeakFolding.cpp",
                "tests/HostMallocStub.cpp",
            ],
        },
        darwin: {
            enabled: false,
        },
    },
}

cc_test {
    name: "memunreachable_binder_test",
    defaults: ["libmemunreachable_defaults"],
    srcs: [
        "tests/Binder_test.cpp",
        "tests/MemUnreachable_test.cpp",
    ],
    shared_libs: [
        "libbinder",
        "libhwbinder",
        "libmemunreachable",
        "libutils",
    ],
}