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
99 bool same_elf_file(const char* filepath) {
100 assert(filepath, "null file path");
101 assert(m_filepath, "already out of memory");
102 return (m_filepath && !strcmp(filepath, m_filepath));
103 }
104
105 NullDecoder::decoder_status get_status() {
106 return m_status;
107 }
108
109 private:
110 // sanity check, if the file is a real elf file
111 bool is_elf_file(Elf_Ehdr&);
|
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, bool load_tables);
92 ~ElfFile();
93
94 bool decode(address addr, char* buf, int buflen, int* offset);
95 const char* filepath() {
96 return m_filepath;
97 }
98
99 bool same_elf_file(const char* filepath) {
100 assert(filepath, "null file path");
101 assert(m_filepath, "already out of memory");
102 return (m_filepath && !strcmp(filepath, m_filepath));
103 }
104
105 NullDecoder::decoder_status get_status() {
106 return m_status;
107 }
108
109 private:
110 // sanity check, if the file is a real elf file
111 bool is_elf_file(Elf_Ehdr&);
|