zgu@2364: /* mikael@4153: * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. zgu@2364: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. zgu@2364: * zgu@2364: * This code is free software; you can redistribute it and/or modify it zgu@2364: * under the terms of the GNU General Public License version 2 only, as zgu@2364: * published by the Free Software Foundation. zgu@2364: * zgu@2364: * This code is distributed in the hope that it will be useful, but WITHOUT zgu@2364: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or zgu@2364: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License zgu@2364: * version 2 for more details (a copy is included in the LICENSE file that zgu@2364: * accompanied this code). zgu@2364: * zgu@2364: * You should have received a copy of the GNU General Public License version zgu@2364: * 2 along with this work; if not, write to the Free Software Foundation, zgu@2364: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. zgu@2364: * zgu@2364: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA zgu@2364: * or visit www.oracle.com if you need additional information or have any zgu@2364: * questions. zgu@2364: * zgu@2364: */ zgu@2364: zgu@3430: #ifndef SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP zgu@3430: #define SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP zgu@2364: never@3156: #if !defined(_WINDOWS) && !defined(__APPLE__) zgu@2364: zgu@2364: zgu@2364: #include "memory/allocation.hpp" zgu@2364: #include "utilities/decoder.hpp" zgu@2364: #include "utilities/elfFile.hpp" zgu@2364: zgu@2364: /* zgu@2364: * symbol table object represents a symbol section in an elf file. zgu@2364: * Whenever possible, it will load all symbols from the corresponding section zgu@2364: * of the elf file into memory. Otherwise, it will walk the section in file zgu@2364: * to look up the symbol that nearest the given address. zgu@2364: */ zgu@3900: class ElfSymbolTable: public CHeapObj { zgu@2364: friend class ElfFile; zgu@2364: public: zgu@2364: ElfSymbolTable(FILE* file, Elf_Shdr shdr); zgu@2364: ~ElfSymbolTable(); zgu@2364: zgu@2364: // search the symbol that is nearest to the specified address. zgu@3430: bool lookup(address addr, int* stringtableIndex, int* posIndex, int* offset); zgu@2364: zgu@3430: NullDecoder::decoder_status get_status() { return m_status; }; zgu@2364: zgu@2364: protected: zgu@2364: ElfSymbolTable* m_next; zgu@2364: zgu@2364: // holds a complete symbol table section if zgu@2364: // can allocate enough memory zgu@2364: Elf_Sym* m_symbols; zgu@2364: zgu@2364: // file contains string table zgu@2364: FILE* m_file; zgu@2364: zgu@2364: // section header zgu@2364: Elf_Shdr m_shdr; zgu@2364: zgu@3430: NullDecoder::decoder_status m_status; zgu@2364: }; zgu@2364: zgu@3430: #endif // _WINDOWS and _APPLE zgu@2364: zgu@3430: #endif // SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP