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


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