< prev index next >
src/hotspot/share/utilities/elfFile.hpp
Print this page
@@ -43,10 +43,11 @@
typedef Elf64_Ehdr Elf_Ehdr;
typedef Elf64_Shdr Elf_Shdr;
typedef Elf64_Phdr Elf_Phdr;
typedef Elf64_Sym Elf_Sym;
+typedef Elf64_Nhdr Elf_Nhdr;
#if !defined(_ALLBSD_SOURCE) || defined(__APPLE__)
#define ELF_ST_TYPE ELF64_ST_TYPE
#endif
@@ -59,10 +60,11 @@
typedef Elf32_Ehdr Elf_Ehdr;
typedef Elf32_Shdr Elf_Shdr;
typedef Elf32_Phdr Elf_Phdr;
typedef Elf32_Sym Elf_Sym;
+typedef Elf32_Nhdr Elf_Nhdr;
#if !defined(_ALLBSD_SOURCE) || defined(__APPLE__)
#define ELF_ST_TYPE ELF32_ST_TYPE
#endif
#endif
@@ -115,10 +117,17 @@
~MarkedFileReader();
bool has_mark() const { return _marked_pos >= 0; }
};
+// Interface to external debug info file
+class ElfDebugInfo : public CHeapObj<mtInternal> {
+public:
+ virtual bool decode(address addr, char* const buf, size_t buflen, int* offset) = 0;
+ virtual bool has_error() const = 0;
+};
+
// ElfFile is basically an elf file parser, which can lookup the symbol
// that is the nearest to the given address.
// Beware, this code is called from vm error reporting code, when vm is already
// in "error" state, so there are scenarios, lookup will fail. We want this
// part of code to be very defensive, and bait out if anything went wrong.
@@ -146,14 +155,17 @@
ElfStringTable* _shdr_string_table;
// function descriptors table
ElfFuncDescTable* _funcDesc_table;
+ // external debug info
+ ElfDebugInfo* _debuginfo;
+
NullDecoder::decoder_status _status;
public:
- ElfFile(const char* filepath);
+ ElfFile(const char* filepath, bool load_debug_info = true);
~ElfFile();
bool decode(address addr, char* buf, int buflen, int* offset);
const char* filepath() const {
@@ -180,10 +192,16 @@
static bool is_elf_file(Elf_Ehdr&);
// parse this elf file
NullDecoder::decoder_status parse_elf(const char* filename);
+ // load external debuginfo file for this file.
+ ElfDebugInfo* load_debuginfo() NOT_LINUX({ return NULL; });
+
+ // internal implementation
+ bool decode_impl(address addr, char* buf, int buflen, int* offset);
+
// load string, symbol and function descriptor tables from the elf file
NullDecoder::decoder_status load_tables();
ElfFile* next() const { return _next; }
void set_next(ElfFile* file) { _next = file; }
< prev index next >