src/share/vm/utilities/elfSymbolTable.hpp

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


  28 #if !defined(_WINDOWS) && !defined(__APPLE__)
  29 
  30 
  31 #include "memory/allocation.hpp"
  32 #include "utilities/decoder.hpp"
  33 #include "utilities/elfFile.hpp"
  34 
  35 /*
  36  * symbol table object represents a symbol section in an elf file.
  37  * Whenever possible, it will load all symbols from the corresponding section
  38  * of the elf file into memory. Otherwise, it will walk the section in file
  39  * to look up the symbol that nearest the given address.
  40  */
  41 class ElfSymbolTable: public CHeapObj<mtInternal> {
  42   friend class ElfFile;
  43  public:
  44   ElfSymbolTable(FILE* file, Elf_Shdr shdr);
  45   ~ElfSymbolTable();
  46 
  47   // search the symbol that is nearest to the specified address.



  48   bool lookup(address addr, int* stringtableIndex, int* posIndex, int* offset);

  49 
  50   NullDecoder::decoder_status get_status() { return m_status; };
  51 
  52  protected:
  53   ElfSymbolTable*  m_next;
  54 
  55   // holds a complete symbol table section if
  56   // can allocate enough memory
  57   Elf_Sym*            m_symbols;
  58 
  59   // file contains string table
  60   FILE*               m_file;
  61 
  62   // section header
  63   Elf_Shdr            m_shdr;
  64 
  65   NullDecoder::decoder_status  m_status;
  66 };





























  67 
  68 #endif // _WINDOWS and _APPLE
  69 
  70 #endif // SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP


  28 #if !defined(_WINDOWS) && !defined(__APPLE__)
  29 
  30 
  31 #include "memory/allocation.hpp"
  32 #include "utilities/decoder.hpp"
  33 #include "utilities/elfFile.hpp"
  34 
  35 /*
  36  * symbol table object represents a symbol section in an elf file.
  37  * Whenever possible, it will load all symbols from the corresponding section
  38  * of the elf file into memory. Otherwise, it will walk the section in file
  39  * to look up the symbol that nearest the given address.
  40  */
  41 class ElfSymbolTable: public CHeapObj<mtInternal> {
  42   friend class ElfFile;
  43  public:
  44   ElfSymbolTable(FILE* file, Elf_Shdr shdr);
  45   ~ElfSymbolTable();
  46 
  47   // search the symbol that is nearest to the specified address.
  48 #if defined(PPC64)
  49   bool lookup(address addr, int* stringtableIndex, int* posIndex, int* offset, ElfFuncDescTable* funcDescTable);
  50 #else
  51   bool lookup(address addr, int* stringtableIndex, int* posIndex, int* offset);
  52 #endif
  53 
  54   NullDecoder::decoder_status get_status() { return m_status; };
  55 
  56  protected:
  57   ElfSymbolTable*  m_next;
  58 
  59   // holds a complete symbol table section if
  60   // can allocate enough memory
  61   Elf_Sym*            m_symbols;
  62 
  63   // file contains string table
  64   FILE*               m_file;
  65 
  66   // section header
  67   Elf_Shdr            m_shdr;
  68 
  69   NullDecoder::decoder_status  m_status;
  70 };
  71 
  72 #if defined(PPC64)
  73 
  74 class ElfFuncDescTable: public CHeapObj<mtInternal> {
  75   friend class ElfFile;
  76  public:
  77   ElfFuncDescTable(FILE* file, Elf_Shdr shdr);
  78   ~ElfFuncDescTable();
  79 
  80   // return the function address for the function descriptor at 'index' or NULL on error
  81   address lookup(Elf_Word index);
  82 
  83   NullDecoder::decoder_status get_status() { return m_status; };
  84 
  85  protected:
  86   // holds the complete function descriptor section if
  87   // we can allocate enough memory
  88   address*            m_funcDescs;
  89 
  90   // file contains string table
  91   FILE*               m_file;
  92 
  93   // section header
  94   Elf_Shdr            m_shdr;
  95 
  96   NullDecoder::decoder_status  m_status;
  97 };
  98 
  99 #endif
 100 
 101 #endif // _WINDOWS and _APPLE
 102 
 103 #endif // SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP