src/share/vm/utilities/elfFile.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File hotspot Sdiff src/share/vm/utilities

src/share/vm/utilities/elfFile.cpp

Print this page




  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 
  27 #if !defined(_WINDOWS) && !defined(__APPLE__)
  28 
  29 #include <string.h>
  30 #include <stdio.h>
  31 #include <limits.h>
  32 #include <new>
  33 
  34 #include "memory/allocation.inline.hpp"
  35 #include "utilities/decoder.hpp"
  36 #include "utilities/elfFile.hpp"
  37 #include "utilities/elfFuncDescTable.hpp"
  38 #include "utilities/elfStringTable.hpp"
  39 #include "utilities/elfSymbolTable.hpp"
  40 
  41 
  42 ElfFile::ElfFile(const char* filepath) {
  43   assert(filepath, "null file path");
  44   memset(&m_elfHdr, 0, sizeof(m_elfHdr));
  45   m_string_tables = NULL;
  46   m_symbol_tables = NULL;
  47   m_funcDesc_table = NULL;
  48   m_next = NULL;
  49   m_status = NullDecoder::no_error;
  50 
  51   int len = strlen(filepath) + 1;
  52   m_filepath = (const char*)os::malloc(len * sizeof(char), mtInternal);
  53   if (m_filepath != NULL) {
  54     strcpy((char*)m_filepath, filepath);
  55     m_file = fopen(filepath, "r");
  56     if (m_file != NULL) {

  57       load_tables();

  58     } else {
  59       m_status = NullDecoder::file_not_found;
  60     }
  61   } else {
  62     m_status = NullDecoder::out_of_memory;
  63   }
  64 }
  65 
  66 ElfFile::~ElfFile() {
  67   if (m_string_tables != NULL) {
  68     delete m_string_tables;
  69   }
  70 
  71   if (m_symbol_tables != NULL) {
  72     delete m_symbol_tables;
  73   }
  74 
  75   if (m_file != NULL) {
  76     fclose(m_file);
  77   }




  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 
  27 #if !defined(_WINDOWS) && !defined(__APPLE__)
  28 
  29 #include <string.h>
  30 #include <stdio.h>
  31 #include <limits.h>
  32 #include <new>
  33 
  34 #include "memory/allocation.inline.hpp"
  35 #include "utilities/decoder.hpp"
  36 #include "utilities/elfFile.hpp"
  37 #include "utilities/elfFuncDescTable.hpp"
  38 #include "utilities/elfStringTable.hpp"
  39 #include "utilities/elfSymbolTable.hpp"
  40 
  41 
  42 ElfFile::ElfFile(const char* filepath, bool load_tbls) {
  43   assert(filepath, "null file path");
  44   memset(&m_elfHdr, 0, sizeof(m_elfHdr));
  45   m_string_tables = NULL;
  46   m_symbol_tables = NULL;
  47   m_funcDesc_table = NULL;
  48   m_next = NULL;
  49   m_status = NullDecoder::no_error;
  50 
  51   int len = strlen(filepath) + 1;
  52   m_filepath = (const char*)os::malloc(len * sizeof(char), mtInternal);
  53   if (m_filepath != NULL) {
  54     strcpy((char*)m_filepath, filepath);
  55     m_file = fopen(filepath, "r");
  56     if (m_file != NULL) {
  57       if (load_tbls) {
  58         load_tables();
  59       }
  60     } else {
  61       m_status = NullDecoder::file_not_found;
  62     }
  63   } else {
  64     m_status = NullDecoder::out_of_memory;
  65   }
  66 }
  67 
  68 ElfFile::~ElfFile() {
  69   if (m_string_tables != NULL) {
  70     delete m_string_tables;
  71   }
  72 
  73   if (m_symbol_tables != NULL) {
  74     delete m_symbol_tables;
  75   }
  76 
  77   if (m_file != NULL) {
  78     fclose(m_file);
  79   }


src/share/vm/utilities/elfFile.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File