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 {
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 Decoder::decoder_status lookup(address addr, int* stringtableIndex, int* posIndex, int* offset);
49
50 Decoder::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 Decoder::decoder_status m_status;
66 };
67
68 #endif // _WINDOWS
|
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 {
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 Decoder::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 Decoder::decoder_status m_status;
66 };
67
68 #endif // _WINDOWS
|