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