Mercurial > hg > truffle
comparison src/share/vm/utilities/elfStringTable.hpp @ 4840:0a10d80352d5
Merge
author | brutisso |
---|---|
date | Fri, 27 Jan 2012 09:04:57 +0100 |
parents | d7e3846464d0 |
children | d2a62e0f25eb |
comparison
equal
deleted
inserted
replaced
4839:b4ebad3520bb | 4840:0a10d80352d5 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 #ifndef __ELF_STRING_TABLE_HPP | 25 #ifndef SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP |
26 #define __ELF_STRING_TABLE_HPP | 26 #define SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP |
27 | 27 |
28 #if !defined(_WINDOWS) && !defined(__APPLE__) | 28 #if !defined(_WINDOWS) && !defined(__APPLE__) |
29 | 29 |
30 #include "memory/allocation.hpp" | 30 #include "memory/allocation.hpp" |
31 #include "utilities/decoder.hpp" | 31 #include "utilities/decoder.hpp" |
33 | 33 |
34 | 34 |
35 // The string table represents a string table section in an elf file. | 35 // The string table represents a string table section in an elf file. |
36 // Whenever there is enough memory, it will load whole string table as | 36 // Whenever there is enough memory, it will load whole string table as |
37 // one blob. Otherwise, it will load string from file when requested. | 37 // one blob. Otherwise, it will load string from file when requested. |
38 | |
39 #define MAX_SYMBOL_LEN 256 | |
40 | |
41 class ElfStringTable: CHeapObj { | 38 class ElfStringTable: CHeapObj { |
42 friend class ElfFile; | 39 friend class ElfFile; |
43 public: | 40 public: |
44 ElfStringTable(FILE* file, Elf_Shdr shdr, int index); | 41 ElfStringTable(FILE* file, Elf_Shdr shdr, int index); |
45 ~ElfStringTable(); | 42 ~ElfStringTable(); |
46 | 43 |
47 // section index | 44 // section index |
48 int index() { return m_index; }; | 45 int index() { return m_index; }; |
49 | 46 |
50 // get string at specified offset | 47 // get string at specified offset |
51 const char* string_at(int offset); | 48 bool string_at(int offset, char* buf, int buflen); |
52 | 49 |
53 // get status code | 50 // get status code |
54 Decoder::decoder_status get_status() { return m_status; }; | 51 NullDecoder::decoder_status get_status() { return m_status; }; |
55 | 52 |
56 protected: | 53 protected: |
57 ElfStringTable* m_next; | 54 ElfStringTable* m_next; |
58 | 55 |
59 // section index | 56 // section index |
67 FILE* m_file; | 64 FILE* m_file; |
68 | 65 |
69 // section header | 66 // section header |
70 Elf_Shdr m_shdr; | 67 Elf_Shdr m_shdr; |
71 | 68 |
72 // buffer for reading individual string | |
73 char m_symbol[MAX_SYMBOL_LEN]; | |
74 | |
75 // error code | 69 // error code |
76 Decoder::decoder_status m_status; | 70 NullDecoder::decoder_status m_status; |
77 }; | 71 }; |
78 | 72 |
79 #endif // _WINDOWS | 73 #endif // _WINDOWS and _APPLE |
80 | 74 |
81 #endif // __ELF_STRING_TABLE_HPP | 75 #endif // SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP |