| 1 | |
| 2 | |
| 3 | #ifndef __ELFMANAGER_H__ |
| 4 | #define __ELFMANAGER_H__ |
| 5 | |
| 6 | |
| 7 | typedef enum { |
| 8 | ELF_NO_TYPE = -1, |
| 9 | ELF_NULL_TYPE = 0, |
| 10 | ELF_text_TYPE, |
| 11 | ELF_rodata_TYPE, |
| 12 | ELF_data_TYPE, |
| 13 | ELF_bss_TYPE, |
| 14 | ELF_heap_TYPE, |
| 15 | ELF_debug_TYPE, |
| 16 | ELF_comment_TYPE, |
| 17 | ELF_shstrtab_TYPE, |
| 18 | ELF_symtab_TYPE, |
| 19 | ELF_strtab_TYPE, |
| 20 | ELF_debug_abbrev_TYPE, // Abbreviations used in the .debug_info section |
| 21 | ELF_debug_aranges_TYPE, // Lookup table for mapping addresses to compilation units |
| 22 | ELF_debug_frame_TYPE, // Call frame information |
| 23 | ELF_debug_info_TYPE, // Core DWARF information section |
| 24 | ELF_debug_line_TYPE, // Line number information |
| 25 | ELF_debug_loc_TYPE, // Location lists used in the DW_AT_location attributes |
| 26 | ELF_debug_macinfo_TYPE, // Macro information |
| 27 | ELF_debug_pubnames_TYPE, // Lookup table for mapping object and function names to compilation units |
| 28 | ELF_debug_pubtypes_TYPE, // Lookup table for mapping type names to compilation units |
| 29 | ELF_debug_ranges_TYPE, // Address ranges used in the DW_AT_ranges attributes |
| 30 | ELF_debug_str_TYPE, // String table used in .debug_info |
| 31 | ELF_debug_types_TYPE, // Type descriptions |
| 32 | ELF_END_TYPE |
| 33 | }ELFSECTIONTYPE; |
| 34 | |
| 35 | |
| 36 | // Internal manager |
| 37 | extern void ELFManager_Init(void); |
| 38 | extern bool ELFManager_DwarfInit(Elf *PtrElfMem); |
| 39 | extern Elf *ELFManager_MemOpen(char *PtrELFExe, size_t Size); |
| 40 | extern int ELFManager_MemEnd(void); |
| 41 | extern void ELFManager_Reset(void); |
| 42 | extern void ELFManager_Close(void); |
| 43 | extern bool ELFManager_AddTab(void *Ptr, size_t type); |
| 44 | extern void *ELFManager_ExeCopy(void *src, size_t size); |
| 45 | |
| 46 | // Sections manager |
| 47 | extern size_t ELFManager_GetSectionType(char *SectionName); |
| 48 | |
| 49 | // Symbols manager |
| 50 | extern size_t ELFManager_GetAdrFromSymbolName(char *SymbolName); |
| 51 | extern char *ELFManager_GetSymbolnameFromAdr(size_t Adr); |
| 52 | |
| 53 | // Functions manager |
| 54 | extern char *ELFManager_GetFunctionName(size_t Adr); |
| 55 | |
| 56 | |
| 57 | #endif // __ELFMANAGER_H__ |