src/share/vm/utilities/decoder_elf.cpp

Mon, 25 Jun 2012 21:33:35 -0400

author
coleenp
date
Mon, 25 Jun 2012 21:33:35 -0400
changeset 3875
246d977b51f2
parent 3430
d7e3846464d0
child 4153
b9a9ed0f8eeb
permissions
-rw-r--r--

7178670: runtime/7158800/BadUtf8.java fails in SymbolTable::rehash_table
Summary: Cannot delete _buckets and HashtableEntries in shared space (CDS)
Reviewed-by: acorn, kvn, dlong, dcubed, kamg

     1 /*
     2  * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     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
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  *
    23  */
    25 #include "precompiled.hpp"
    27 #if !defined(_WINDOWS) && !defined(__APPLE__)
    28 #include "decoder_elf.hpp"
    30 ElfDecoder::~ElfDecoder() {
    31   if (_opened_elf_files != NULL) {
    32     delete _opened_elf_files;
    33     _opened_elf_files = NULL;
    34   }
    35 }
    37 bool ElfDecoder::decode(address addr, char *buf, int buflen, int* offset, const char* filepath) {
    38   assert(filepath, "null file path");
    39   assert(buf != NULL && buflen > 0, "Invalid buffer");
    40   if (has_error()) return false;
    41   ElfFile* file = get_elf_file(filepath);
    42   if (file == NULL) {
    43     return false;
    44   }
    46   if (!file->decode(addr, buf, buflen, offset)) {
    47     return false;
    48   }
    49   if (buf[0] != '\0') {
    50     demangle(buf, buf, buflen);
    51   }
    52   return true;
    53 }
    55 ElfFile* ElfDecoder::get_elf_file(const char* filepath) {
    56   ElfFile* file;
    58   file = _opened_elf_files;
    59   while (file != NULL) {
    60     if (file->same_elf_file(filepath)) {
    61       return file;
    62     }
    63     file = file->next();
    64   }
    66   file = new (std::nothrow)ElfFile(filepath);
    67   if (file != NULL) {
    68     if (_opened_elf_files != NULL) {
    69       file->set_next(_opened_elf_files);
    70     }
    71     _opened_elf_files = file;
    72   }
    74   return file;
    75 }
    76 #endif

mercurial