Path: blob/master/src/hotspot/share/utilities/elfSymbolTable.hpp
40949 views
/*1* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_UTILITIES_ELFSYMBOLTABLE_HPP25#define SHARE_UTILITIES_ELFSYMBOLTABLE_HPP2627#if !defined(_WINDOWS) && !defined(__APPLE__)282930#include "memory/allocation.hpp"31#include "utilities/decoder.hpp"32#include "utilities/elfFile.hpp"3334/*35* symbol table object represents a symbol section in an elf file.36* Whenever possible, it will load all symbols from the corresponding section37* of the elf file into memory. Otherwise, it will walk the section in file38* to look up the symbol that nearest the given address.39*/40class ElfSymbolTable: public CHeapObj<mtInternal> {41friend class ElfFile;42private:43ElfSymbolTable* _next;4445// file contains string table46FILE* const _fd;4748// corresponding section49ElfSection _section;5051NullDecoder::decoder_status _status;52public:53ElfSymbolTable(FILE* const file, Elf_Shdr& shdr);54~ElfSymbolTable();5556// search the symbol that is nearest to the specified address.57bool lookup(address addr, int* stringtableIndex, int* posIndex, int* offset, ElfFuncDescTable* funcDescTable);5859NullDecoder::decoder_status get_status() const { return _status; };60private:61ElfSymbolTable* next() const { return _next; }62void set_next(ElfSymbolTable* next) { _next = next; }6364bool compare(const Elf_Sym* sym, address addr, int* stringtableIndex, int* posIndex, int* offset, ElfFuncDescTable* funcDescTable);65};6667#endif // !_WINDOWS and !__APPLE__6869#endif // SHARE_UTILITIES_ELFSYMBOLTABLE_HPP707172