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_STRING_TABLE_HPP
3084N/A#define SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP
1929N/A
2796N/A#if !defined(_WINDOWS) && !defined(__APPLE__)
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// The string table represents a string table section in an elf file.
1929N/A// Whenever there is enough memory, it will load whole string table as
1929N/A// one blob. Otherwise, it will load string from file when requested.
3863N/Aclass ElfStringTable: CHeapObj<mtInternal> {
1929N/A friend class ElfFile;
1929N/A public:
1929N/A ElfStringTable(FILE* file, Elf_Shdr shdr, int index);
1929N/A ~ElfStringTable();
1929N/A
1929N/A // section index
1929N/A int index() { return m_index; };
1929N/A
1929N/A // get string at specified offset
3084N/A bool string_at(int offset, char* buf, int buflen);
1929N/A
1929N/A // get status code
3084N/A NullDecoder::decoder_status get_status() { return m_status; };
1929N/A
1929N/A protected:
1929N/A ElfStringTable* m_next;
1929N/A
1929N/A // section index
1929N/A int m_index;
1929N/A
1929N/A // holds complete string table if can
1929N/A // allocate enough memory
1929N/A const char* m_table;
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
1929N/A // error code
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_STRING_TABLE_HPP