2 * Copyright 2005-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
11 #include <elf_common.h>
15 #include <util/DoublyLinkedList.h>
19 struct runtime_loader_debug_area
;
26 class Image
: public DoublyLinkedListLinkImpl
<Image
> {
31 const image_info
& Info() const { return fInfo
; }
32 image_id
ID() const { return fInfo
.id
; }
33 const char* Name() const { return fInfo
.name
; }
34 addr_t
TextAddress() const
35 { return (addr_t
)fInfo
.text
; }
36 size_t TextSize() const { return fInfo
.text_size
; }
38 virtual const elf_sym
* LookupSymbol(addr_t address
,
40 const char** _symbolName
,
41 size_t *_symbolNameLen
,
42 bool *_exactMatch
) const = 0;
43 virtual status_t
NextSymbol(int32
& iterator
,
44 const char** _symbolName
,
45 size_t* _symbolNameLen
,
46 addr_t
* _symbolAddress
, size_t* _symbolSize
,
47 int32
* _symbolType
) const = 0;
49 virtual status_t
GetSymbol(const char* name
, int32 symbolType
,
50 void** _symbolLocation
, size_t* _symbolSize
,
51 int32
* _symbolType
) const;
58 class SymbolTableBasedImage
: public Image
{
60 SymbolTableBasedImage();
61 virtual ~SymbolTableBasedImage();
63 virtual const elf_sym
* LookupSymbol(addr_t address
,
65 const char** _symbolName
,
66 size_t *_symbolNameLen
,
67 bool *_exactMatch
) const;
68 virtual status_t
NextSymbol(int32
& iterator
,
69 const char** _symbolName
,
70 size_t* _symbolNameLen
,
71 addr_t
* _symbolAddress
, size_t* _symbolSize
,
72 int32
* _symbolType
) const;
75 size_t _SymbolNameLen(const char* symbolName
) const;
79 elf_sym
* fSymbolTable
;
82 size_t fStringTableSize
;
86 class ImageFile
: public SymbolTableBasedImage
{
91 status_t
Init(const image_info
& info
);
92 status_t
Init(const char* path
);
95 status_t
_LoadFile(const char* path
,
96 addr_t
* _textAddress
, size_t* _textSize
,
97 addr_t
* _dataAddress
, size_t* _dataSize
);
99 status_t
_FindTableInSection(elf_ehdr
* elfHeader
,
109 class KernelImage
: public SymbolTableBasedImage
{
112 virtual ~KernelImage();
114 status_t
Init(const image_info
& info
);
118 class CommPageImage
: public SymbolTableBasedImage
{
121 virtual ~CommPageImage();
123 status_t
Init(const image_info
& info
);
127 } // namespace BPrivate
130 using BPrivate::Debug::ImageFile
;