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