1*fce4895dSRene Gollent /* 2*fce4895dSRene Gollent * Copyright 2016, Ingo Weinhold, ingo_weinhold@gmx.de. 3*fce4895dSRene Gollent * Distributed under the terms of the MIT License. 4*fce4895dSRene Gollent */ 5*fce4895dSRene Gollent #ifndef ELF_SYMBOL_LOOKUP_H 6*fce4895dSRene Gollent #define ELF_SYMBOL_LOOKUP_H 7*fce4895dSRene Gollent 8*fce4895dSRene Gollent 9*fce4895dSRene Gollent #include <Referenceable.h> 10*fce4895dSRene Gollent 11*fce4895dSRene Gollent #include "ElfFile.h" 12*fce4895dSRene Gollent #include "SymbolInfo.h" 13*fce4895dSRene Gollent 14*fce4895dSRene Gollent 15*fce4895dSRene Gollent class ElfSymbolLookupSource : public BReferenceable { 16*fce4895dSRene Gollent public: 17*fce4895dSRene Gollent virtual ssize_t Read(uint64 address, void* buffer, 18*fce4895dSRene Gollent size_t size) = 0; 19*fce4895dSRene Gollent }; 20*fce4895dSRene Gollent 21*fce4895dSRene Gollent 22*fce4895dSRene Gollent class ElfSymbolLookup { 23*fce4895dSRene Gollent public: 24*fce4895dSRene Gollent static const uint32 kGetSymbolCountFromHash = ~(uint32)0; 25*fce4895dSRene Gollent 26*fce4895dSRene Gollent public: 27*fce4895dSRene Gollent virtual ~ElfSymbolLookup(); 28*fce4895dSRene Gollent 29*fce4895dSRene Gollent static status_t Create(ElfSymbolLookupSource* source, 30*fce4895dSRene Gollent uint64 symbolTable, uint64 symbolHash, 31*fce4895dSRene Gollent uint64 stringTable, uint32 symbolCount, 32*fce4895dSRene Gollent uint32 symbolTableEntrySize, 33*fce4895dSRene Gollent uint64 textDelta, bool is64Bit, 34*fce4895dSRene Gollent bool swappedByteOrder, bool cacheSource, 35*fce4895dSRene Gollent ElfSymbolLookup*& _lookup); 36*fce4895dSRene Gollent 37*fce4895dSRene Gollent virtual status_t Init(bool cacheSource) = 0; 38*fce4895dSRene Gollent virtual status_t NextSymbolInfo(uint32& index, 39*fce4895dSRene Gollent SymbolInfo& _info) = 0; 40*fce4895dSRene Gollent virtual status_t GetSymbolInfo(const char* name, 41*fce4895dSRene Gollent uint32 symbolType, SymbolInfo& _info) = 0; 42*fce4895dSRene Gollent }; 43*fce4895dSRene Gollent 44*fce4895dSRene Gollent 45*fce4895dSRene Gollent #endif // ELF_SYMBOL_LOOKUP_H 46