< prev index next >

src/hotspot/share/utilities/elfStringTable.cpp

Print this page




   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  */
  24 
  25 #include "precompiled.hpp"
  26 
  27 #if !defined(_WINDOWS) && !defined(__APPLE__)
  28 

  29 #include "memory/allocation.inline.hpp"
  30 #include "prims/jvm.h"
  31 #include "runtime/os.hpp"
  32 #include "utilities/elfStringTable.hpp"
  33 
  34 // We will try to load whole string table into memory if we can.
  35 // Otherwise, fallback to more expensive file operation.
  36 ElfStringTable::ElfStringTable(FILE* file, Elf_Shdr shdr, int index) {
  37   assert(file, "null file handle");
  38   m_table = NULL;
  39   m_index = index;
  40   m_next = NULL;
  41   m_file = file;
  42   m_status = NullDecoder::no_error;
  43 
  44   // try to load the string table
  45   long cur_offset = ftell(file);
  46   m_table = (char*)os::malloc(sizeof(char) * shdr.sh_size, mtInternal);
  47   if (m_table != NULL) {
  48     // if there is an error, mark the error
  49     if (fseek(file, shdr.sh_offset, SEEK_SET) ||
  50       fread((void*)m_table, shdr.sh_size, 1, file) != 1 ||




   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  */
  24 
  25 #include "precompiled.hpp"
  26 
  27 #if !defined(_WINDOWS) && !defined(__APPLE__)
  28 
  29 #include "jvm.h"
  30 #include "memory/allocation.inline.hpp"

  31 #include "runtime/os.hpp"
  32 #include "utilities/elfStringTable.hpp"
  33 
  34 // We will try to load whole string table into memory if we can.
  35 // Otherwise, fallback to more expensive file operation.
  36 ElfStringTable::ElfStringTable(FILE* file, Elf_Shdr shdr, int index) {
  37   assert(file, "null file handle");
  38   m_table = NULL;
  39   m_index = index;
  40   m_next = NULL;
  41   m_file = file;
  42   m_status = NullDecoder::no_error;
  43 
  44   // try to load the string table
  45   long cur_offset = ftell(file);
  46   m_table = (char*)os::malloc(sizeof(char) * shdr.sh_size, mtInternal);
  47   if (m_table != NULL) {
  48     // if there is an error, mark the error
  49     if (fseek(file, shdr.sh_offset, SEEK_SET) ||
  50       fread((void*)m_table, shdr.sh_size, 1, file) != 1 ||


< prev index next >