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 | 61d4097 | 2017-06-12 19:14:20 -0700 | [diff] [blame] | 51 | "DwarfDebugFrame.cpp", |
| 52 | "DwarfEhFrame.cpp", |
Christopher Ferris | 72a6fa6 | 2017-03-21 12:41:17 -0700 | [diff] [blame] | 53 | "DwarfMemory.cpp", |
Christopher Ferris | 55d22ef | 2017-04-04 10:41:31 -0700 | [diff] [blame] | 54 | "DwarfOp.cpp", |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 55 | "DwarfSection.cpp", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 56 | "Elf.cpp", |
| 57 | "ElfInterface.cpp", |
| 58 | "ElfInterfaceArm.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 59 | "Log.cpp", |
Christopher Ferris | 0d7cf3e | 2017-04-19 15:42:19 -0700 | [diff] [blame] | 60 | "MapInfo.cpp", |
Christopher Ferris | 09385e7 | 2017-04-05 13:25:04 -0700 | [diff] [blame] | 61 | "Maps.cpp", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 62 | "Memory.cpp", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 63 | "Regs.cpp", |
Christopher Ferris | b9de87f | 2017-09-20 13:37:24 -0700 | [diff] [blame^] | 64 | "Unwinder.cpp", |
Christopher Ferris | e7ba4cc | 2017-04-04 14:06:58 -0700 | [diff] [blame] | 65 | "Symbols.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 66 | ], |
| 67 | |
Christopher Ferris | 5f11851 | 2017-09-01 11:17:16 -0700 | [diff] [blame] | 68 | target: { |
| 69 | // Always disable optimizations for host to make it easier to debug. |
| 70 | linux: { |
| 71 | cflags: ["-O0", "-g"], |
| 72 | }, |
| 73 | }, |
| 74 | |
Christopher Ferris | 2a25c4a | 2017-07-07 16:35:48 -0700 | [diff] [blame] | 75 | arch: { |
| 76 | x86: { |
| 77 | srcs: ["AsmGetRegsX86.S"], |
| 78 | }, |
| 79 | x86_64: { |
| 80 | srcs: ["AsmGetRegsX86_64.S"], |
| 81 | }, |
| 82 | }, |
| 83 | |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 84 | shared_libs: [ |
| 85 | "libbase", |
| 86 | "liblog", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 87 | "liblzma", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 88 | ], |
| 89 | } |
| 90 | |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 91 | //------------------------------------------------------------------------- |
| 92 | // Unit Tests |
| 93 | //------------------------------------------------------------------------- |
Christopher Ferris | f6d5431 | 2017-07-11 15:29:32 -0700 | [diff] [blame] | 94 | cc_test { |
| 95 | name: "libunwindstack_test", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 96 | defaults: ["libunwindstack_flags"], |
| 97 | |
| 98 | srcs: [ |
| 99 | "tests/ArmExidxDecodeTest.cpp", |
| 100 | "tests/ArmExidxExtractTest.cpp", |
Christopher Ferris | 8642fcb | 2017-04-24 11:14:39 -0700 | [diff] [blame] | 101 | "tests/DwarfCfaLogTest.cpp", |
| 102 | "tests/DwarfCfaTest.cpp", |
Christopher Ferris | 61d4097 | 2017-06-12 19:14:20 -0700 | [diff] [blame] | 103 | "tests/DwarfDebugFrameTest.cpp", |
| 104 | "tests/DwarfEhFrameTest.cpp", |
Christopher Ferris | 72a6fa6 | 2017-03-21 12:41:17 -0700 | [diff] [blame] | 105 | "tests/DwarfMemoryTest.cpp", |
Christopher Ferris | 55d22ef | 2017-04-04 10:41:31 -0700 | [diff] [blame] | 106 | "tests/DwarfOpLogTest.cpp", |
| 107 | "tests/DwarfOpTest.cpp", |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 108 | "tests/DwarfSectionTest.cpp", |
| 109 | "tests/DwarfSectionImplTest.cpp", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 110 | "tests/ElfInterfaceArmTest.cpp", |
| 111 | "tests/ElfInterfaceTest.cpp", |
| 112 | "tests/ElfTest.cpp", |
Christopher Ferris | 570b76f | 2017-06-30 17:18:16 -0700 | [diff] [blame] | 113 | "tests/ElfTestUtils.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 114 | "tests/LogFake.cpp", |
Christopher Ferris | 570b76f | 2017-06-30 17:18:16 -0700 | [diff] [blame] | 115 | "tests/MapInfoGetElfTest.cpp", |
Christopher Ferris | 09385e7 | 2017-04-05 13:25:04 -0700 | [diff] [blame] | 116 | "tests/MapsTest.cpp", |
Christopher Ferris | f6d5431 | 2017-07-11 15:29:32 -0700 | [diff] [blame] | 117 | "tests/MemoryBufferTest.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 118 | "tests/MemoryFake.cpp", |
| 119 | "tests/MemoryFileTest.cpp", |
| 120 | "tests/MemoryLocalTest.cpp", |
| 121 | "tests/MemoryRangeTest.cpp", |
| 122 | "tests/MemoryRemoteTest.cpp", |
Christopher Ferris | 9744fb2 | 2017-07-07 12:18:16 -0700 | [diff] [blame] | 123 | "tests/MemoryTest.cpp", |
Christopher Ferris | eb4a6db | 2017-07-19 12:37:45 -0700 | [diff] [blame] | 124 | "tests/RegsStepIfSignalHandlerTest.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 125 | "tests/RegsTest.cpp", |
Christopher Ferris | e7ba4cc | 2017-04-04 14:06:58 -0700 | [diff] [blame] | 126 | "tests/SymbolsTest.cpp", |
Christopher Ferris | 2a25c4a | 2017-07-07 16:35:48 -0700 | [diff] [blame] | 127 | "tests/UnwindTest.cpp", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 128 | ], |
| 129 | |
| 130 | cflags: [ |
| 131 | "-O0", |
| 132 | "-g", |
| 133 | ], |
| 134 | |
| 135 | shared_libs: [ |
| 136 | "libbase", |
| 137 | "liblog", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 138 | "liblzma", |
Christopher Ferris | f6d5431 | 2017-07-11 15:29:32 -0700 | [diff] [blame] | 139 | "libunwindstack", |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 140 | ], |
| 141 | |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 142 | static_libs: [ |
| 143 | "libgmock", |
| 144 | ], |
| 145 | |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 146 | target: { |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 147 | linux: { |
| 148 | host_ldlibs: [ |
| 149 | "-lrt", |
| 150 | ], |
| 151 | }, |
| 152 | }, |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 153 | |
| 154 | data: [ |
Christopher Ferris | 570b76f | 2017-06-30 17:18:16 -0700 | [diff] [blame] | 155 | "tests/files/elf32.xz", |
| 156 | "tests/files/elf64.xz", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 157 | ], |
Christopher Ferris | 723cf9b | 2017-01-19 20:08:48 -0800 | [diff] [blame] | 158 | } |
| 159 | |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 160 | //------------------------------------------------------------------------- |
Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 161 | // Tools |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 162 | //------------------------------------------------------------------------- |
| 163 | cc_defaults { |
Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 164 | name: "libunwindstack_tools", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 165 | defaults: ["libunwindstack_flags"], |
| 166 | |
| 167 | shared_libs: [ |
| 168 | "libunwindstack", |
| 169 | "libbase", |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 170 | "liblzma", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 171 | ], |
Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 172 | } |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 173 | |
Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 174 | cc_binary { |
| 175 | name: "unwind", |
| 176 | defaults: ["libunwindstack_tools"], |
| 177 | |
| 178 | srcs: [ |
| 179 | "tools/unwind.cpp", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 180 | ], |
Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 181 | |
| 182 | target: { |
| 183 | linux: { |
| 184 | host_ldlibs: [ |
| 185 | "-lrt", |
| 186 | ], |
| 187 | }, |
| 188 | }, |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | cc_binary { |
| 192 | name: "unwind_info", |
Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 193 | defaults: ["libunwindstack_tools"], |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 194 | |
| 195 | srcs: [ |
Christopher Ferris | b5d7a87 | 2017-07-12 15:40:52 -0700 | [diff] [blame] | 196 | "tools/unwind_info.cpp", |
| 197 | ], |
| 198 | } |
| 199 | |
| 200 | cc_binary { |
| 201 | name: "unwind_symbols", |
| 202 | defaults: ["libunwindstack_tools"], |
| 203 | |
| 204 | srcs: [ |
| 205 | "tools/unwind_symbols.cpp", |
Christopher Ferris | 3958f80 | 2017-02-01 15:44:40 -0800 | [diff] [blame] | 206 | ], |
| 207 | } |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 208 | |
| 209 | // Generates the elf data for use in the tests for .gnu_debugdata frames. |
| 210 | // Once these files are generated, use the xz command to compress the data. |
| 211 | cc_binary_host { |
| 212 | name: "gen_gnudebugdata", |
Christopher Ferris | f6d5431 | 2017-07-11 15:29:32 -0700 | [diff] [blame] | 213 | defaults: ["libunwindstack_flags"], |
Christopher Ferris | bae69f1 | 2017-06-28 14:51:54 -0700 | [diff] [blame] | 214 | |
| 215 | srcs: [ |
| 216 | "tests/GenGnuDebugdata.cpp", |
| 217 | ], |
| 218 | } |