File indexing completed on 2024-05-12 05:43:31
0001 /* 0002 Copyright (C) 2015 Volker Krause <vkrause@kde.org> 0003 0004 This program is free software; you can redistribute it and/or modify it 0005 under the terms of the GNU Library General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or (at your 0007 option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, but WITHOUT 0010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 0012 License for more details. 0013 0014 You should have received a copy of the GNU General Public License 0015 along with this program. If not, see <https://www.gnu.org/licenses/>. 0016 */ 0017 0018 #include "symbolprinter.h" 0019 #include "printerutils_p.h" 0020 0021 #include <elf.h> 0022 0023 static const LookupTableEntry<uint8_t> bind_type_table[] { 0024 { STB_LOCAL, "local" }, 0025 { STB_GLOBAL, "global" }, 0026 { STB_WEAK, "weak" }, 0027 { STB_GNU_UNIQUE, "GNU unique" } 0028 }; 0029 0030 static const LookupTableEntry<uint8_t> symbol_type_table[] { 0031 { STT_NOTYPE, "unspecified" }, 0032 { STT_OBJECT, "data object" }, 0033 { STT_FUNC, "code object" }, 0034 { STT_SECTION, "section" }, 0035 { STT_FILE, "file name" }, 0036 { STT_COMMON, "common data object" }, 0037 { STT_TLS, "thread-local data object" }, 0038 { STT_GNU_IFUNC, "GNU indirect code object" } 0039 }; 0040 0041 static const LookupTableEntry<uint8_t> visibility_type_table[] { 0042 { STV_DEFAULT, "default" }, 0043 { STV_INTERNAL, "internal" }, 0044 { STV_HIDDEN, "hidden" }, 0045 { STV_PROTECTED, "protected" } 0046 }; 0047 0048 0049 QByteArray SymbolPrinter::bindType(uint8_t type) 0050 { 0051 return lookupLabel(type, bind_type_table); 0052 } 0053 0054 QByteArray SymbolPrinter::symbolType(uint8_t type) 0055 { 0056 return lookupLabel(type, symbol_type_table); 0057 } 0058 0059 QByteArray SymbolPrinter::visibility(uint8_t type) 0060 { 0061 return lookupLabel(type, visibility_type_table); 0062 }