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