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