| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 1 | // | 
|  | 2 | // Copyright (C) 2017 The Android Open Source Project | 
|  | 3 | // | 
|  | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | // you may not use this file except in compliance with the License. | 
|  | 6 | // You may obtain a copy of the License at | 
|  | 7 | // | 
|  | 8 | //      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | // | 
|  | 10 | // Unless required by applicable law or agreed to in writing, software | 
|  | 11 | // distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | // See the License for the specific language governing permissions and | 
|  | 14 | // limitations under the License. | 
|  | 15 | // | 
|  | 16 |  | 
|  | 17 | cc_defaults { | 
|  | 18 | name: "libunwindstack_flags", | 
|  | 19 |  | 
|  | 20 | host_supported: true, | 
|  | 21 |  | 
|  | 22 | cflags: [ | 
|  | 23 | "-Wall", | 
|  | 24 | "-Werror", | 
|  | 25 | "-Wextra", | 
|  | 26 | ], | 
| Christopher Ferris | 01d5037 | 2017-01-30 13:45:16 -0800 | [diff] [blame] | 27 |  | 
|  | 28 | target: { | 
|  | 29 | darwin: { | 
|  | 30 | enabled: false, | 
|  | 31 | }, | 
| Dan Willemsen | 0f04867 | 2017-09-19 17:53:12 -0700 | [diff] [blame] | 32 | linux_bionic: { | 
|  | 33 | enabled: true, | 
|  | 34 | }, | 
| Christopher Ferris | 01d5037 | 2017-01-30 13:45:16 -0800 | [diff] [blame] | 35 | }, | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 36 | } | 
|  | 37 |  | 
| Christopher Ferris | f6d5431 | 2017-07-11 15:29:32 -0700 | [diff] [blame] | 38 | cc_library { | 
|  | 39 | name: "libunwindstack", | 
| Christopher Ferris | 6f3981c | 2017-07-27 09:29:18 -0700 | [diff] [blame] | 40 | vendor_available: true, | 
| Justin Yun | 73bd4f0 | 2017-08-04 17:33:54 +0900 | [diff] [blame] | 41 | vndk: { | 
|  | 42 | enabled: true, | 
|  | 43 | support_system_process: true, | 
|  | 44 | }, | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 45 | defaults: ["libunwindstack_flags"], | 
| Christopher Ferris | d226a51 | 2017-07-14 10:37:19 -0700 | [diff] [blame] | 46 | export_include_dirs: ["include"], | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 47 |  | 
|  | 48 | srcs: [ | 
|  | 49 | "ArmExidx.cpp", | 
| Christopher Ferris | 8642fcb | 2017-04-24 11:14:39 -0700 | [diff] [blame] | 50 | "DwarfCfa.cpp", | 
| Christopher Ferris | c9dee84 | 2017-11-03 14:50:27 -0700 | [diff] [blame] | 51 | "DwarfEhFrameWithHdr.cpp", | 
| Christopher Ferris | 72a6fa6 | 2017-03-21 12:41:17 -0700 | [diff] [blame] | 52 | "DwarfMemory.cpp", | 
| Christopher Ferris | 55d22ef | 2017-04-04 10:41:31 -0700 | [diff] [blame] | 53 | "DwarfOp.cpp", | 
| Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 54 | "DwarfSection.cpp", | 
| Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 55 | "Elf.cpp", | 
|  | 56 | "ElfInterface.cpp", | 
|  | 57 | "ElfInterfaceArm.cpp", | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 58 | "Log.cpp", | 
| Christopher Ferris | 0d7cf3e | 2017-04-19 15:42:19 -0700 | [diff] [blame] | 59 | "MapInfo.cpp", | 
| Christopher Ferris | 09385e7 | 2017-04-05 13:25:04 -0700 | [diff] [blame] | 60 | "Maps.cpp", | 
| Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 61 | "Memory.cpp", | 
| Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 62 | "Regs.cpp", | 
| Christopher Ferris | d06001d | 2017-11-30 18:56:01 -0800 | [diff] [blame] | 63 | "RegsArm.cpp", | 
|  | 64 | "RegsArm64.cpp", | 
|  | 65 | "RegsX86.cpp", | 
|  | 66 | "RegsX86_64.cpp", | 
| Douglas Leung | 61b1a1a | 2017-11-08 10:53:53 +0100 | [diff] [blame] | 67 | "RegsMips.cpp", | 
|  | 68 | "RegsMips64.cpp", | 
| Christopher Ferris | b9de87f | 2017-09-20 13:37:24 -0700 | [diff] [blame] | 69 | "Unwinder.cpp", | 
| Christopher Ferris | e7ba4cc | 2017-04-04 14:06:58 -0700 | [diff] [blame] | 70 | "Symbols.cpp", | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 71 | ], | 
|  | 72 |  | 
| Josh Gao | e22701e | 2017-10-23 14:25:08 -0700 | [diff] [blame] | 73 | cflags: [ | 
|  | 74 | "-Wexit-time-destructors", | 
|  | 75 | ], | 
|  | 76 |  | 
| Christopher Ferris | 5f11851 | 2017-09-01 11:17:16 -0700 | [diff] [blame] | 77 | target: { | 
|  | 78 | // Always disable optimizations for host to make it easier to debug. | 
| Dan Willemsen | cd58088 | 2017-10-02 10:29:02 -0700 | [diff] [blame] | 79 | host: { | 
| Christopher Ferris | 5f11851 | 2017-09-01 11:17:16 -0700 | [diff] [blame] | 80 | cflags: ["-O0", "-g"], | 
|  | 81 | }, | 
|  | 82 | }, | 
|  | 83 |  | 
| Christopher Ferris | 2a25c4a | 2017-07-07 16:35:48 -0700 | [diff] [blame] | 84 | arch: { | 
|  | 85 | x86: { | 
|  | 86 | srcs: ["AsmGetRegsX86.S"], | 
|  | 87 | }, | 
|  | 88 | x86_64: { | 
|  | 89 | srcs: ["AsmGetRegsX86_64.S"], | 
|  | 90 | }, | 
| Douglas Leung | 61b1a1a | 2017-11-08 10:53:53 +0100 | [diff] [blame] | 91 | mips: { | 
|  | 92 | srcs: ["AsmGetRegsMips.S"], | 
|  | 93 | }, | 
|  | 94 | mips64: { | 
|  | 95 | srcs: ["AsmGetRegsMips64.S"], | 
|  | 96 | }, | 
| Christopher Ferris | 2a25c4a | 2017-07-07 16:35:48 -0700 | [diff] [blame] | 97 | }, | 
|  | 98 |  | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 99 | shared_libs: [ | 
|  | 100 | "libbase", | 
|  | 101 | "liblog", | 
| Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 102 | "liblzma", | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 103 | ], | 
|  | 104 | } | 
|  | 105 |  | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 106 | //------------------------------------------------------------------------- | 
|  | 107 | // Unit Tests | 
|  | 108 | //------------------------------------------------------------------------- | 
| Christopher Ferris | f6d5431 | 2017-07-11 15:29:32 -0700 | [diff] [blame] | 109 | cc_test { | 
|  | 110 | name: "libunwindstack_test", | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 111 | defaults: ["libunwindstack_flags"], | 
|  | 112 |  | 
|  | 113 | srcs: [ | 
|  | 114 | "tests/ArmExidxDecodeTest.cpp", | 
|  | 115 | "tests/ArmExidxExtractTest.cpp", | 
| Christopher Ferris | 8642fcb | 2017-04-24 11:14:39 -0700 | [diff] [blame] | 116 | "tests/DwarfCfaLogTest.cpp", | 
|  | 117 | "tests/DwarfCfaTest.cpp", | 
| Christopher Ferris | 61d4097 | 2017-06-12 19:14:20 -0700 | [diff] [blame] | 118 | "tests/DwarfDebugFrameTest.cpp", | 
|  | 119 | "tests/DwarfEhFrameTest.cpp", | 
| Christopher Ferris | c9dee84 | 2017-11-03 14:50:27 -0700 | [diff] [blame] | 120 | "tests/DwarfEhFrameWithHdrTest.cpp", | 
| Christopher Ferris | 72a6fa6 | 2017-03-21 12:41:17 -0700 | [diff] [blame] | 121 | "tests/DwarfMemoryTest.cpp", | 
| Christopher Ferris | 55d22ef | 2017-04-04 10:41:31 -0700 | [diff] [blame] | 122 | "tests/DwarfOpLogTest.cpp", | 
|  | 123 | "tests/DwarfOpTest.cpp", | 
| Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 124 | "tests/DwarfSectionTest.cpp", | 
|  | 125 | "tests/DwarfSectionImplTest.cpp", | 
| Christopher Ferris | f6f691b | 2017-09-25 19:23:07 -0700 | [diff] [blame] | 126 | "tests/ElfFake.cpp", | 
| Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 127 | "tests/ElfInterfaceArmTest.cpp", | 
|  | 128 | "tests/ElfInterfaceTest.cpp", | 
|  | 129 | "tests/ElfTest.cpp", | 
| Christopher Ferris | 570b76f | 2017-06-30 17:18:16 -0700 | [diff] [blame] | 130 | "tests/ElfTestUtils.cpp", | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 131 | "tests/LogFake.cpp", | 
| Christopher Ferris | 570b76f | 2017-06-30 17:18:16 -0700 | [diff] [blame] | 132 | "tests/MapInfoGetElfTest.cpp", | 
| Christopher Ferris | b7de5f5 | 2017-12-01 21:37:37 -0800 | [diff] [blame] | 133 | "tests/MapInfoGetLoadBiasTest.cpp", | 
| Christopher Ferris | 09385e7 | 2017-04-05 13:25:04 -0700 | [diff] [blame] | 134 | "tests/MapsTest.cpp", | 
| Christopher Ferris | f6d5431 | 2017-07-11 15:29:32 -0700 | [diff] [blame] | 135 | "tests/MemoryBufferTest.cpp", | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 136 | "tests/MemoryFake.cpp", | 
|  | 137 | "tests/MemoryFileTest.cpp", | 
|  | 138 | "tests/MemoryLocalTest.cpp", | 
| Josh Gao | f4a94c4 | 2017-11-13 16:16:27 -0800 | [diff] [blame] | 139 | "tests/MemoryOfflineTest.cpp", | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 140 | "tests/MemoryRangeTest.cpp", | 
|  | 141 | "tests/MemoryRemoteTest.cpp", | 
| Christopher Ferris | 9744fb2 | 2017-07-07 12:18:16 -0700 | [diff] [blame] | 142 | "tests/MemoryTest.cpp", | 
| Josh Gao | 6f580d8 | 2017-09-22 12:57:15 -0700 | [diff] [blame] | 143 | "tests/RegsIterateTest.cpp", | 
| Christopher Ferris | eb4a6db | 2017-07-19 12:37:45 -0700 | [diff] [blame] | 144 | "tests/RegsStepIfSignalHandlerTest.cpp", | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 145 | "tests/RegsTest.cpp", | 
| Christopher Ferris | e7ba4cc | 2017-04-04 14:06:58 -0700 | [diff] [blame] | 146 | "tests/SymbolsTest.cpp", | 
| Christopher Ferris | c3d79f7 | 2017-11-28 19:14:54 -0800 | [diff] [blame] | 147 | "tests/UnwindOfflineTest.cpp", | 
| Christopher Ferris | 2a25c4a | 2017-07-07 16:35:48 -0700 | [diff] [blame] | 148 | "tests/UnwindTest.cpp", | 
| Christopher Ferris | f6f691b | 2017-09-25 19:23:07 -0700 | [diff] [blame] | 149 | "tests/UnwinderTest.cpp", | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 150 | ], | 
|  | 151 |  | 
|  | 152 | cflags: [ | 
|  | 153 | "-O0", | 
|  | 154 | "-g", | 
|  | 155 | ], | 
|  | 156 |  | 
|  | 157 | shared_libs: [ | 
|  | 158 | "libbase", | 
|  | 159 | "liblog", | 
| Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 160 | "liblzma", | 
| Christopher Ferris | f6d5431 | 2017-07-11 15:29:32 -0700 | [diff] [blame] | 161 | "libunwindstack", | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 162 | ], | 
|  | 163 |  | 
| Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 164 | static_libs: [ | 
|  | 165 | "libgmock", | 
|  | 166 | ], | 
|  | 167 |  | 
| Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 168 | data: [ | 
| Christopher Ferris | 570b76f | 2017-06-30 17:18:16 -0700 | [diff] [blame] | 169 | "tests/files/elf32.xz", | 
|  | 170 | "tests/files/elf64.xz", | 
| Christopher Ferris | e7b6624 | 2017-12-15 11:17:45 -0800 | [diff] [blame] | 171 | "tests/files/offline/gnu_debugdata_arm32/*", | 
| Christopher Ferris | c3d79f7 | 2017-11-28 19:14:54 -0800 | [diff] [blame] | 172 | "tests/files/offline/straddle_arm32/*", | 
|  | 173 | "tests/files/offline/straddle_arm64/*", | 
| Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 174 | ], | 
| Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 175 | } | 
|  | 176 |  | 
| Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 177 | //------------------------------------------------------------------------- | 
| Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 178 | // Tools | 
| Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 179 | //------------------------------------------------------------------------- | 
|  | 180 | cc_defaults { | 
| Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 181 | name: "libunwindstack_tools", | 
| Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 182 | defaults: ["libunwindstack_flags"], | 
|  | 183 |  | 
|  | 184 | shared_libs: [ | 
|  | 185 | "libunwindstack", | 
|  | 186 | "libbase", | 
| Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 187 | "liblzma", | 
| Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 188 | ], | 
| Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 189 | } | 
| Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 190 |  | 
| Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 191 | cc_binary { | 
|  | 192 | name: "unwind", | 
|  | 193 | defaults: ["libunwindstack_tools"], | 
|  | 194 |  | 
|  | 195 | srcs: [ | 
|  | 196 | "tools/unwind.cpp", | 
| Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 197 | ], | 
| Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 198 | } | 
|  | 199 |  | 
|  | 200 | cc_binary { | 
|  | 201 | name: "unwind_info", | 
| Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 202 | defaults: ["libunwindstack_tools"], | 
| Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 203 |  | 
|  | 204 | srcs: [ | 
| Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 205 | "tools/unwind_info.cpp", | 
|  | 206 | ], | 
|  | 207 | } | 
|  | 208 |  | 
|  | 209 | cc_binary { | 
|  | 210 | name: "unwind_symbols", | 
|  | 211 | defaults: ["libunwindstack_tools"], | 
|  | 212 |  | 
|  | 213 | srcs: [ | 
|  | 214 | "tools/unwind_symbols.cpp", | 
| Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 215 | ], | 
|  | 216 | } | 
| Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 217 |  | 
| Christopher Ferris | 3dfd2ae | 2017-12-15 20:00:59 -0800 | [diff] [blame] | 218 | cc_binary { | 
|  | 219 | name: "unwind_for_offline", | 
|  | 220 | defaults: ["libunwindstack_tools"], | 
|  | 221 |  | 
|  | 222 | srcs: [ | 
|  | 223 | "tools/unwind_for_offline.cpp", | 
|  | 224 | ], | 
|  | 225 | } | 
|  | 226 |  | 
| Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 227 | // Generates the elf data for use in the tests for .gnu_debugdata frames. | 
|  | 228 | // Once these files are generated, use the xz command to compress the data. | 
|  | 229 | cc_binary_host { | 
|  | 230 | name: "gen_gnudebugdata", | 
| Christopher Ferris | f6d5431 | 2017-07-11 15:29:32 -0700 | [diff] [blame] | 231 | defaults: ["libunwindstack_flags"], | 
| Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 232 |  | 
|  | 233 | srcs: [ | 
|  | 234 | "tests/GenGnuDebugdata.cpp", | 
|  | 235 | ], | 
|  | 236 | } |