Path: blob/master/src/hotspot/share/utilities/elfStringTable.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_ELFSTRINGTABLE_HPP25#define SHARE_UTILITIES_ELFSTRINGTABLE_HPP2627#if !defined(_WINDOWS) && !defined(__APPLE__)2829#include "memory/allocation.hpp"30#include "utilities/decoder.hpp"31#include "utilities/elfFile.hpp"323334// The string table represents a string table section in an elf file.35// Whenever there is enough memory, it will load whole string table as36// one blob. Otherwise, it will load string from file when requested.37class ElfStringTable: CHeapObj<mtInternal> {38friend class ElfFile;39private:40ElfStringTable* _next;41int _index; // section index42ElfSection _section;43FILE* const _fd;44NullDecoder::decoder_status _status;4546public:47ElfStringTable(FILE* const file, Elf_Shdr& shdr, int index);48~ElfStringTable();4950// section index51int index() const { return _index; };5253// get string at specified offset54bool string_at(size_t offset, char* buf, int buflen);5556// get status code57NullDecoder::decoder_status get_status() const {58return _status;59}6061private:62void set_next(ElfStringTable* next) {63_next = next;64}6566ElfStringTable* next() const {67return _next;68}69};7071#endif // !_WINDOWS && !__APPLE__7273#endif // SHARE_UTILITIES_ELFSTRINGTABLE_HPP747576