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