7 #if !defined(_DataSource_h_) 12 #include "smart_ptr.h" 13 #include "StExecutableImage.h" 63 virtual unsigned getData(
unsigned offset,
unsigned maxBytes, uint8_t *buffer) = 0;
110 virtual unsigned getData(
unsigned offset,
unsigned maxBytes, uint8_t *buffer);
118 inline void setPattern(
const SizedIntegerValue &newPattern) { m_pattern = newPattern; }
210 void setData(
const uint8_t *data,
unsigned length);
221 virtual unsigned getData(
unsigned offset,
unsigned maxBytes, uint8_t *buffer);
262 virtual unsigned getData(
unsigned offset,
unsigned maxBytes, uint8_t *buffer);
300 #endif // _DataSource_h_ Abstract base class for data sources.
Definition: apps/elftosb/common/DataSource.h:33
DataSource()
Default constructor.
Definition: apps/elftosb/common/DataSource.h:136
virtual ~DataSource()
Destructor.
Definition: apps/elftosb/common/DataSource.h:142
Data source for data that is not memory mapped (has no natural address).
Definition: apps/elftosb/common/DataSource.h:200
Segment corresponding to a text region of the executable image.
Definition: apps/elftosb/common/DataSource.h:256
SizedIntegerValue m_pattern
The fill pattern.
Definition: apps/elftosb/common/DataSource.h:131
virtual DataSource::Segment * getSegmentAt(unsigned index)
Returns this object, as it is its own segment.
Definition: apps/elftosb/common/DataSource.h:185
virtual DataSource::Segment * getSegmentAt(unsigned index)
Returns this object, as it is its own segment.
Definition: apps/elftosb/common/DataSource.h:215
SizedIntegerValue & getPattern()
Return the fill pattern for the segment.
Definition: apps/elftosb/common/DataSource.h:121
virtual uint32_t getBaseAddress()
Returns the address associated with the segment.
Definition: apps/elftosb/common/DataSource.h:72
DataTarget * m_target
Corresponding target for this source.
Definition: apps/elftosb/common/DataSource.h:161
segment_array_t m_segments
The array of Segment instances.
Definition: apps/elftosb/common/DataSource.h:295
StExecutableImage * m_image
Coalesced image of the file.
Definition: apps/elftosb/common/DataSource.h:287
Used to build a representation of memory regions.
Definition: apps/elftosb/common/StExecutableImage.h:27
PatternSource & operator=(const SizedIntegerValue &value)
Assignment operator, sets the pattern value and length.
Definition: apps/elftosb/common/DataSource.h:187
Data source that takes its data from an executable image.
Definition: apps/elftosb/common/DataSource.h:237
Adds a word size attribute to IntegerValue.
Definition: apps/elftosb/common/Value.h:72
virtual unsigned getData(unsigned offset, unsigned maxBytes, uint8_t *buffer)=0
Gets all or a portion of the segment's data.
virtual bool hasNaturalLocation()
Returns whether the segment has an associated address.
Definition: apps/elftosb/common/DataSource.h:265
Definition: BootImage.h:13
Data source for a repeating pattern.
Definition: apps/elftosb/common/DataSource.h:173
unsigned m_index
Record index.
Definition: apps/elftosb/common/DataSource.h:270
Abstract base class for the target address or range of data.
Definition: apps/elftosb/common/DataTarget.h:34
This is a special type of segment containing a repeating pattern.
Definition: apps/elftosb/common/DataSource.h:87
std::vector< DataSource::Segment * > segment_array_t
An array of segments.
Definition: apps/elftosb/common/DataSource.h:294
virtual unsigned getLength()=0
Gets the length of the segment's data.
StExecutableImage * m_image
Coalesced image of the file.
Definition: apps/elftosb/common/DataSource.h:269
Segment corresponding to a fill region of the executable image.
Definition: apps/elftosb/common/DataSource.h:276
smart_array_ptr< uint8_t > m_data
The data.
Definition: apps/elftosb/common/DataSource.h:228
virtual unsigned getLength()
Returns the number of bytes of data managed by the source.
Definition: apps/elftosb/common/DataSource.h:224
virtual bool hasNaturalLocation()=0
Returns whether the segment has an associated address.
StExecutableImage * m_image
The memory image that is the data source.
Definition: apps/elftosb/common/DataSource.h:292
void setTarget(DataTarget *target)
Sets the associated data target.
Definition: apps/elftosb/common/DataSource.h:146
Discrete, contiguous part of the source's data.
Definition: apps/elftosb/common/DataSource.h:42
virtual unsigned getSegmentCount()
There is only one segment.
Definition: apps/elftosb/common/DataSource.h:183
DataSource & m_source
The data source to which this segment belongs.
Definition: apps/elftosb/common/DataSource.h:74
Segment(DataSource &source)
Default constructor.
Definition: apps/elftosb/common/DataSource.h:46
DataTarget * getTarget() const
Gets the associated data target.
Definition: apps/elftosb/common/DataSource.h:148
virtual bool hasNaturalLocation()
Pattern segments have no natural address.
Definition: apps/elftosb/common/DataSource.h:283
unsigned m_index
Record index.
Definition: apps/elftosb/common/DataSource.h:288
virtual Segment * getSegmentAt(unsigned index)=0
Returns segment number index of the data source.
PatternSegment & operator=(const SizedIntegerValue &value)
Assignment operator, sets the pattern value and length.
Definition: apps/elftosb/common/DataSource.h:123
virtual ~Segment()
Destructor.
Definition: apps/elftosb/common/DataSource.h:52
virtual unsigned getSegmentCount()=0
Returns the number of segments in this data source.
virtual unsigned getSegmentCount()
There is only one segment.
Definition: apps/elftosb/common/DataSource.h:213
unsigned m_length
Byte count of the data.
Definition: apps/elftosb/common/DataSource.h:229