1 /* 2 * Copyright 2011, 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 #include "ELFSymbol.h" 18 #include "ELF.h" 19 20 char const * 21 ELFSymbolHelperMixin::getTypeStr(uint8_t type) { 22 switch (type) { 23 default: return "(UNKNOWN)"; 24 25 #define CASE(TYPE) \ 26 case STT_##TYPE: return #TYPE; 27 28 CASE(NOTYPE) 29 CASE(OBJECT) 30 CASE(FUNC) 31 CASE(SECTION) 32 CASE(FILE) 33 CASE(COMMON) 34 CASE(TLS) 35 CASE(LOOS) 36 CASE(HIOS) 37 CASE(LOPROC) 38 CASE(HIPROC) 39 40 #undef CASE 41 } 42 } 43 44 char const * 45 ELFSymbolHelperMixin::getBindingAttributeStr(uint8_t type) { 46 switch (type) { 47 default: return "(UNKNOWN)"; 48 49 #define CASE(TYPE) \ 50 case STB_##TYPE: return #TYPE; 51 52 CASE(LOCAL) 53 CASE(GLOBAL) 54 CASE(WEAK) 55 CASE(LOOS) 56 CASE(HIOS) 57 CASE(LOPROC) 58 CASE(HIPROC) 59 60 #undef CASE 61 } 62 } 63 char const * 64 ELFSymbolHelperMixin::getVisibilityStr(uint8_t type) { 65 switch (type) { 66 default: return "(UNKNOWN)"; 67 68 #define CASE(TYPE) \ 69 case STV_##TYPE: return #TYPE; 70 71 CASE(DEFAULT) 72 CASE(INTERNAL) 73 CASE(HIDDEN) 74 CASE(PROTECTED) 75 76 #undef CASE 77 } 78 } 79