src/share/vm/utilities/elfStringTable.hpp

Sat, 11 Dec 2010 13:20:56 -0500

author
zgu
date
Sat, 11 Dec 2010 13:20:56 -0500
changeset 2364
2d4762ec74af
child 3156
f08d439fab8c
permissions
-rw-r--r--

7003748: Decode C stack frames when symbols are presented (PhoneHome project)
Summary: Implemented in-process C native stack frame decoding when symbols are available.
Reviewed-by: coleenp, never

zgu@2364 1 /*
zgu@2364 2 * Copyright (c) 1997, 2010, 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@2364 25 #ifndef __ELF_STRING_TABLE_HPP
zgu@2364 26 #define __ELF_STRING_TABLE_HPP
zgu@2364 27
zgu@2364 28 #ifndef _WINDOWS
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@2364 38
zgu@2364 39 #define MAX_SYMBOL_LEN 256
zgu@2364 40
zgu@2364 41 class ElfStringTable: CHeapObj {
zgu@2364 42 friend class ElfFile;
zgu@2364 43 public:
zgu@2364 44 ElfStringTable(FILE* file, Elf_Shdr shdr, int index);
zgu@2364 45 ~ElfStringTable();
zgu@2364 46
zgu@2364 47 // section index
zgu@2364 48 int index() { return m_index; };
zgu@2364 49
zgu@2364 50 // get string at specified offset
zgu@2364 51 const char* string_at(int offset);
zgu@2364 52
zgu@2364 53 // get status code
zgu@2364 54 Decoder::decoder_status get_status() { return m_status; };
zgu@2364 55
zgu@2364 56 protected:
zgu@2364 57 ElfStringTable* m_next;
zgu@2364 58
zgu@2364 59 // section index
zgu@2364 60 int m_index;
zgu@2364 61
zgu@2364 62 // holds complete string table if can
zgu@2364 63 // allocate enough memory
zgu@2364 64 const char* m_table;
zgu@2364 65
zgu@2364 66 // file contains string table
zgu@2364 67 FILE* m_file;
zgu@2364 68
zgu@2364 69 // section header
zgu@2364 70 Elf_Shdr m_shdr;
zgu@2364 71
zgu@2364 72 // buffer for reading individual string
zgu@2364 73 char m_symbol[MAX_SYMBOL_LEN];
zgu@2364 74
zgu@2364 75 // error code
zgu@2364 76 Decoder::decoder_status m_status;
zgu@2364 77 };
zgu@2364 78
zgu@2364 79 #endif // _WINDOWS
zgu@2364 80
zgu@2364 81 #endif // __ELF_STRING_TABLE_HPP
zgu@2364 82

mercurial