Thu, 22 May 2014 15:52:41 -0400
8037816: Fix for 8036122 breaks build with Xcode5/clang
8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas
8043164: Format warning in traceStream.hpp
Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings
Reviewed-by: kvn, coleenp, iveresov, twisti
zgu@2364 | 1 | /* |
mikael@4153 | 2 | * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
zgu@2364 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
zgu@2364 | 4 | * |
zgu@2364 | 5 | * This code is free software; you can redistribute it and/or modify it |
zgu@2364 | 6 | * under the terms of the GNU General Public License version 2 only, as |
zgu@2364 | 7 | * published by the Free Software Foundation. |
zgu@2364 | 8 | * |
zgu@2364 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
zgu@2364 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
zgu@2364 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
zgu@2364 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
zgu@2364 | 13 | * accompanied this code). |
zgu@2364 | 14 | * |
zgu@2364 | 15 | * You should have received a copy of the GNU General Public License version |
zgu@2364 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
zgu@2364 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
zgu@2364 | 18 | * |
zgu@2364 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
zgu@2364 | 20 | * or visit www.oracle.com if you need additional information or have any |
zgu@2364 | 21 | * questions. |
zgu@2364 | 22 | * |
zgu@2364 | 23 | */ |
zgu@2364 | 24 | |
zgu@3430 | 25 | #ifndef SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP |
zgu@3430 | 26 | #define SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP |
zgu@2364 | 27 | |
never@3156 | 28 | #if !defined(_WINDOWS) && !defined(__APPLE__) |
zgu@2364 | 29 | |
zgu@2364 | 30 | #include "memory/allocation.hpp" |
zgu@2364 | 31 | #include "utilities/decoder.hpp" |
zgu@2364 | 32 | #include "utilities/elfFile.hpp" |
zgu@2364 | 33 | |
zgu@2364 | 34 | |
zgu@2364 | 35 | // The string table represents a string table section in an elf file. |
zgu@2364 | 36 | // Whenever there is enough memory, it will load whole string table as |
zgu@2364 | 37 | // one blob. Otherwise, it will load string from file when requested. |
zgu@3900 | 38 | class ElfStringTable: CHeapObj<mtInternal> { |
zgu@2364 | 39 | friend class ElfFile; |
zgu@2364 | 40 | public: |
zgu@2364 | 41 | ElfStringTable(FILE* file, Elf_Shdr shdr, int index); |
zgu@2364 | 42 | ~ElfStringTable(); |
zgu@2364 | 43 | |
zgu@2364 | 44 | // section index |
zgu@2364 | 45 | int index() { return m_index; }; |
zgu@2364 | 46 | |
zgu@2364 | 47 | // get string at specified offset |
zgu@3430 | 48 | bool string_at(int offset, char* buf, int buflen); |
zgu@2364 | 49 | |
zgu@2364 | 50 | // get status code |
zgu@3430 | 51 | NullDecoder::decoder_status get_status() { return m_status; }; |
zgu@2364 | 52 | |
zgu@2364 | 53 | protected: |
zgu@2364 | 54 | ElfStringTable* m_next; |
zgu@2364 | 55 | |
zgu@2364 | 56 | // section index |
zgu@2364 | 57 | int m_index; |
zgu@2364 | 58 | |
zgu@2364 | 59 | // holds complete string table if can |
zgu@2364 | 60 | // allocate enough memory |
zgu@2364 | 61 | const char* m_table; |
zgu@2364 | 62 | |
zgu@2364 | 63 | // file contains string table |
zgu@2364 | 64 | FILE* m_file; |
zgu@2364 | 65 | |
zgu@2364 | 66 | // section header |
zgu@2364 | 67 | Elf_Shdr m_shdr; |
zgu@2364 | 68 | |
zgu@2364 | 69 | // error code |
zgu@3430 | 70 | NullDecoder::decoder_status m_status; |
zgu@2364 | 71 | }; |
zgu@2364 | 72 | |
simonis@6491 | 73 | #endif // !_WINDOWS && !__APPLE__ |
zgu@2364 | 74 | |
zgu@3430 | 75 | #endif // SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP |