Wed, 22 Jan 2014 17:42:23 -0800
Merge
zgu@2364 | 1 | /* |
simonis@6491 | 2 | * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
zgu@2364 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
zgu@2364 | 4 | * |
zgu@2364 | 5 | * This code is free software; you can redistribute it and/or modify it |
zgu@2364 | 6 | * under the terms of the GNU General Public License version 2 only, as |
zgu@2364 | 7 | * published by the Free Software Foundation. |
zgu@2364 | 8 | * |
zgu@2364 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
zgu@2364 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
zgu@2364 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
zgu@2364 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
zgu@2364 | 13 | * accompanied this code). |
zgu@2364 | 14 | * |
zgu@2364 | 15 | * You should have received a copy of the GNU General Public License version |
zgu@2364 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
zgu@2364 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
zgu@2364 | 18 | * |
zgu@2364 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
zgu@2364 | 20 | * or visit www.oracle.com if you need additional information or have any |
zgu@2364 | 21 | * questions. |
zgu@2364 | 22 | * |
zgu@2364 | 23 | */ |
zgu@2364 | 24 | |
zgu@3430 | 25 | #ifndef SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP |
zgu@3430 | 26 | #define SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP |
zgu@2364 | 27 | |
never@3156 | 28 | #if !defined(_WINDOWS) && !defined(__APPLE__) |
zgu@2364 | 29 | |
zgu@2364 | 30 | |
zgu@2364 | 31 | #include "memory/allocation.hpp" |
zgu@2364 | 32 | #include "utilities/decoder.hpp" |
zgu@2364 | 33 | #include "utilities/elfFile.hpp" |
zgu@2364 | 34 | |
zgu@2364 | 35 | /* |
zgu@2364 | 36 | * symbol table object represents a symbol section in an elf file. |
zgu@2364 | 37 | * Whenever possible, it will load all symbols from the corresponding section |
zgu@2364 | 38 | * of the elf file into memory. Otherwise, it will walk the section in file |
zgu@2364 | 39 | * to look up the symbol that nearest the given address. |
zgu@2364 | 40 | */ |
zgu@3900 | 41 | class ElfSymbolTable: public CHeapObj<mtInternal> { |
zgu@2364 | 42 | friend class ElfFile; |
zgu@2364 | 43 | public: |
zgu@2364 | 44 | ElfSymbolTable(FILE* file, Elf_Shdr shdr); |
zgu@2364 | 45 | ~ElfSymbolTable(); |
zgu@2364 | 46 | |
zgu@2364 | 47 | // search the symbol that is nearest to the specified address. |
simonis@6491 | 48 | bool lookup(address addr, int* stringtableIndex, int* posIndex, int* offset, ElfFuncDescTable* funcDescTable); |
zgu@2364 | 49 | |
zgu@3430 | 50 | NullDecoder::decoder_status get_status() { return m_status; }; |
zgu@2364 | 51 | |
zgu@2364 | 52 | protected: |
zgu@2364 | 53 | ElfSymbolTable* m_next; |
zgu@2364 | 54 | |
zgu@2364 | 55 | // holds a complete symbol table section if |
zgu@2364 | 56 | // can allocate enough memory |
zgu@2364 | 57 | Elf_Sym* m_symbols; |
zgu@2364 | 58 | |
zgu@2364 | 59 | // file contains string table |
zgu@2364 | 60 | FILE* m_file; |
zgu@2364 | 61 | |
zgu@2364 | 62 | // section header |
zgu@2364 | 63 | Elf_Shdr m_shdr; |
zgu@2364 | 64 | |
zgu@3430 | 65 | NullDecoder::decoder_status m_status; |
zgu@2364 | 66 | }; |
zgu@2364 | 67 | |
simonis@6491 | 68 | #endif // !_WINDOWS and !__APPLE__ |
zgu@2364 | 69 | |
zgu@3430 | 70 | #endif // SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP |