src/share/vm/utilities/elfFile.hpp

Print this page
rev 5729 : 8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables


  58 typedef Elf32_Addr      Elf_Addr;
  59 
  60 
  61 typedef Elf32_Ehdr      Elf_Ehdr;
  62 typedef Elf32_Shdr      Elf_Shdr;
  63 typedef Elf32_Phdr      Elf_Phdr;
  64 typedef Elf32_Sym       Elf_Sym;
  65 
  66 #if !defined(_ALLBSD_SOURCE) || defined(__APPLE__)
  67 #define ELF_ST_TYPE ELF32_ST_TYPE
  68 #endif
  69 #endif
  70 
  71 #include "globalDefinitions.hpp"
  72 #include "memory/allocation.hpp"
  73 #include "utilities/decoder.hpp"
  74 
  75 
  76 class ElfStringTable;
  77 class ElfSymbolTable;

  78 
  79 
  80 // On Solaris/Linux platforms, libjvm.so does contain all private symbols.
  81 // ElfFile is basically an elf file parser, which can lookup the symbol
  82 // that is the nearest to the given address.
  83 // Beware, this code is called from vm error reporting code, when vm is already
  84 // in "error" state, so there are scenarios, lookup will fail. We want this
  85 // part of code to be very defensive, and bait out if anything went wrong.
  86 
  87 class ElfFile: public CHeapObj<mtInternal> {
  88   friend class ElfDecoder;
  89  public:
  90   ElfFile(const char* filepath);
  91   ~ElfFile();
  92 
  93   bool decode(address addr, char* buf, int buflen, int* offset);
  94   const char* filepath() {
  95     return m_filepath;
  96   }
  97 


 132   // is not set at all, or if the file can not be read.
 133   // On systems other than linux it always returns false.
 134   bool specifies_noexecstack() NOT_LINUX({ return false; });
 135 
 136  protected:
 137     ElfFile*         m_next;
 138 
 139  private:
 140   // file
 141   const char* m_filepath;
 142   FILE* m_file;
 143 
 144   // Elf header
 145   Elf_Ehdr                     m_elfHdr;
 146 
 147   // symbol tables
 148   ElfSymbolTable*              m_symbol_tables;
 149 
 150   // string tables
 151   ElfStringTable*              m_string_tables;



 152 
 153   NullDecoder::decoder_status  m_status;
 154 };
 155 
 156 #endif // _WINDOWS
 157 
 158 #endif // SHARE_VM_UTILITIES_ELF_FILE_HPP


  58 typedef Elf32_Addr      Elf_Addr;
  59 
  60 
  61 typedef Elf32_Ehdr      Elf_Ehdr;
  62 typedef Elf32_Shdr      Elf_Shdr;
  63 typedef Elf32_Phdr      Elf_Phdr;
  64 typedef Elf32_Sym       Elf_Sym;
  65 
  66 #if !defined(_ALLBSD_SOURCE) || defined(__APPLE__)
  67 #define ELF_ST_TYPE ELF32_ST_TYPE
  68 #endif
  69 #endif
  70 
  71 #include "globalDefinitions.hpp"
  72 #include "memory/allocation.hpp"
  73 #include "utilities/decoder.hpp"
  74 
  75 
  76 class ElfStringTable;
  77 class ElfSymbolTable;
  78 class ElfFuncDescTable;
  79 
  80 
  81 // On Solaris/Linux platforms, libjvm.so does contain all private symbols.
  82 // ElfFile is basically an elf file parser, which can lookup the symbol
  83 // that is the nearest to the given address.
  84 // Beware, this code is called from vm error reporting code, when vm is already
  85 // in "error" state, so there are scenarios, lookup will fail. We want this
  86 // part of code to be very defensive, and bait out if anything went wrong.
  87 
  88 class ElfFile: public CHeapObj<mtInternal> {
  89   friend class ElfDecoder;
  90  public:
  91   ElfFile(const char* filepath);
  92   ~ElfFile();
  93 
  94   bool decode(address addr, char* buf, int buflen, int* offset);
  95   const char* filepath() {
  96     return m_filepath;
  97   }
  98 


 133   // is not set at all, or if the file can not be read.
 134   // On systems other than linux it always returns false.
 135   bool specifies_noexecstack() NOT_LINUX({ return false; });
 136 
 137  protected:
 138     ElfFile*         m_next;
 139 
 140  private:
 141   // file
 142   const char* m_filepath;
 143   FILE* m_file;
 144 
 145   // Elf header
 146   Elf_Ehdr                     m_elfHdr;
 147 
 148   // symbol tables
 149   ElfSymbolTable*              m_symbol_tables;
 150 
 151   // string tables
 152   ElfStringTable*              m_string_tables;
 153 
 154   // function descriptors table
 155   ElfFuncDescTable*            m_funcDesc_table;
 156 
 157   NullDecoder::decoder_status  m_status;
 158 };
 159 
 160 #endif // _WINDOWS
 161 
 162 #endif // SHARE_VM_UTILITIES_ELF_FILE_HPP