RemoteDrawingEngine: Reduce RP_READ_BITMAP result timeout.
[haiku.git] / src / bin / debug / profile / SharedImage.h
blob1afa03b72defe729c77abf8610106052d9ce8ba4
1 /*
2 * Copyright 2008-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef SHARED_IMAGE_H
6 #define SHARED_IMAGE_H
8 #include <image.h>
9 #include <OS.h>
10 #include <String.h>
12 #include "Referenceable.h"
15 class debug_symbol_iterator;
16 class debug_symbol_lookup_context;
17 class SharedImage;
20 class Symbol {
21 public:
22 Symbol(SharedImage* image, addr_t base, size_t size, const char* name)
24 image(image),
25 base(base),
26 size(size),
27 name(name)
31 const char* Name() const { return name.String(); }
33 SharedImage* image;
34 addr_t base;
35 size_t size;
36 BString name;
40 struct SymbolComparator {
41 inline bool operator()(const Symbol* a, const Symbol* b) const
43 return a->base < b->base;
48 class SharedImage : public BReferenceable {
49 public:
50 SharedImage();
51 ~SharedImage();
53 status_t Init(team_id owner, image_id imageID);
54 status_t Init(const char* path);
56 inline const char* Name() const;
57 inline const image_info& Info() const;
59 inline Symbol** Symbols() const;
60 inline int32 SymbolCount() const;
62 inline bool ContainsAddress(addr_t address) const;
63 int32 FindSymbol(addr_t address) const;
65 private:
66 status_t _Init(debug_symbol_iterator* iterator);
68 private:
69 image_info fInfo;
70 Symbol** fSymbols;
71 int32 fSymbolCount;
75 // #pragma mark -
78 const char*
79 SharedImage::Name() const
81 return fInfo.name;
85 const image_info&
86 SharedImage::Info() const
88 return fInfo;
92 Symbol**
93 SharedImage::Symbols() const
95 return fSymbols;
99 int32
100 SharedImage::SymbolCount() const
102 return fSymbolCount;
106 bool
107 SharedImage::ContainsAddress(addr_t address) const
109 return address >= (addr_t)fInfo.text
110 && address <= (addr_t)fInfo.data + fInfo.data_size - 1;
114 #endif // SHARED_IMAGE_H