hotspot/src/share/vm/utilities/elfStringTable.hpp
author mikael
Tue, 24 Dec 2013 11:48:39 -0800
changeset 22234 da823d78ad65
parent 13963 e5b53c306fb5
child 22857 2167396cfc83
permissions -rw-r--r--
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013 Summary: Copyright year updated for files modified during 2013 Reviewed-by: twisti, iveresov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     1
/*
13963
e5b53c306fb5 7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents: 13195
diff changeset
     2
 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     4
 *
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     7
 * published by the Free Software Foundation.
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     8
 *
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    13
 * accompanied this code).
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    14
 *
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    18
 *
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    21
 * questions.
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    22
 *
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    23
 */
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    24
11483
4d3f4bca0019 7071311: Decoder enhancement
zgu
parents: 10565
diff changeset
    25
#ifndef SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP
4d3f4bca0019 7071311: Decoder enhancement
zgu
parents: 10565
diff changeset
    26
#define SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    27
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 7447
diff changeset
    28
#if !defined(_WINDOWS) && !defined(__APPLE__)
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    29
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    30
#include "memory/allocation.hpp"
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    31
#include "utilities/decoder.hpp"
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    32
#include "utilities/elfFile.hpp"
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    33
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    34
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    35
// The string table represents a string table section in an elf file.
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    36
// Whenever there is enough memory, it will load whole string table as
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    37
// one blob. Otherwise, it will load string from file when requested.
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 11483
diff changeset
    38
class ElfStringTable: CHeapObj<mtInternal> {
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    39
  friend class ElfFile;
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    40
 public:
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    41
  ElfStringTable(FILE* file, Elf_Shdr shdr, int index);
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    42
  ~ElfStringTable();
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    43
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    44
  // section index
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    45
  int index() { return m_index; };
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    46
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    47
  // get string at specified offset
11483
4d3f4bca0019 7071311: Decoder enhancement
zgu
parents: 10565
diff changeset
    48
  bool string_at(int offset, char* buf, int buflen);
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    49
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    50
  // get status code
11483
4d3f4bca0019 7071311: Decoder enhancement
zgu
parents: 10565
diff changeset
    51
  NullDecoder::decoder_status get_status() { return m_status; };
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    52
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    53
 protected:
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    54
  ElfStringTable*        m_next;
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    55
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    56
  // section index
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    57
  int                      m_index;
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    58
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    59
  // holds complete string table if can
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    60
  // allocate enough memory
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    61
  const char*              m_table;
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    62
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    63
  // file contains string table
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    64
  FILE*                    m_file;
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    65
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    66
  // section header
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    67
  Elf_Shdr                 m_shdr;
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    68
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    69
  // error code
11483
4d3f4bca0019 7071311: Decoder enhancement
zgu
parents: 10565
diff changeset
    70
  NullDecoder::decoder_status  m_status;
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    71
};
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    72
11483
4d3f4bca0019 7071311: Decoder enhancement
zgu
parents: 10565
diff changeset
    73
#endif // _WINDOWS and _APPLE
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    74
11483
4d3f4bca0019 7071311: Decoder enhancement
zgu
parents: 10565
diff changeset
    75
#endif // SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP