30 #if !defined(_DataSource_h_) 31 #define _DataSource_h_ 35 #include "smart_ptr.h" 36 #include "StExecutableImage.h" 86 virtual unsigned getData(
unsigned offset,
unsigned maxBytes, uint8_t *buffer) = 0;
133 virtual unsigned getData(
unsigned offset,
unsigned maxBytes, uint8_t *buffer);
141 inline void setPattern(
const SizedIntegerValue &newPattern) { m_pattern = newPattern; }
233 void setData(
const uint8_t *data,
unsigned length);
244 virtual unsigned getData(
unsigned offset,
unsigned maxBytes, uint8_t *buffer);
288 virtual unsigned getData(
unsigned offset,
unsigned maxBytes, uint8_t *buffer);
326 #endif // _DataSource_h_ DataTarget * getTarget() const
Gets the associated data target.
Definition: src/blfwk/DataSource.h:171
unsigned m_index
Record index.
Definition: src/blfwk/DataSource.h:314
virtual unsigned getLength()
Returns the number of bytes of data managed by the source.
Definition: src/blfwk/DataSource.h:247
virtual unsigned getData(unsigned offset, unsigned maxBytes, uint8_t *buffer)=0
Gets all or a portion of the segment's data.
Definition: BlfwkErrors.h:16
Data source for a repeating pattern.
Definition: src/blfwk/DataSource.h:196
segment_array_t m_segments
The array of Segment instances.
Definition: src/blfwk/DataSource.h:321
virtual ~Segment()
Destructor.
Definition: src/blfwk/DataSource.h:75
void setTarget(DataTarget *target)
Sets the associated data target.
Definition: src/blfwk/DataSource.h:169
virtual unsigned getSegmentCount()=0
Returns the number of segments in this data source.
unsigned m_length
Byte count of the data.
Definition: src/blfwk/DataSource.h:255
virtual uint32_t getBaseAddress()
Returns the address associated with the segment.
Definition: src/blfwk/DataSource.h:95
DataTarget * m_target
Corresponding target for this source.
Definition: src/blfwk/DataSource.h:184
PatternSource & operator=(const SizedIntegerValue &value)
Assignment operator, sets the pattern value and length.
Definition: src/blfwk/DataSource.h:210
PatternSegment & operator=(const SizedIntegerValue &value)
Assignment operator, sets the pattern value and length.
Definition: src/blfwk/DataSource.h:146
StExecutableImage * m_image
Coalesced image of the file.
Definition: src/blfwk/DataSource.h:295
unsigned m_index
Record index.
Definition: src/blfwk/DataSource.h:296
Abstract base class for the target address or range of data.
Definition: src/blfwk/DataTarget.h:57
Used to build a representation of memory regions.
Definition: apps/elftosb/common/StExecutableImage.h:27
virtual Segment * getSegmentAt(unsigned index)=0
Returns segment number index of the data source.
virtual bool hasNaturalLocation()
Returns whether the segment has an associated address.
Definition: src/blfwk/DataSource.h:291
SizedIntegerValue m_pattern
The fill pattern.
Definition: src/blfwk/DataSource.h:154
virtual bool hasNaturalLocation()=0
Returns whether the segment has an associated address.
Adds a word size attribute to IntegerValue.
Definition: src/blfwk/Value.h:95
Segment(DataSource &source)
Default constructor.
Definition: src/blfwk/DataSource.h:69
Segment corresponding to a text region of the executable image.
Definition: src/blfwk/DataSource.h:282
StExecutableImage * m_image
The memory image that is the data source.
Definition: src/blfwk/DataSource.h:318
Data source for data that is not memory mapped (has no natural address).
Definition: src/blfwk/DataSource.h:223
virtual unsigned getSegmentCount()
There is only one segment.
Definition: src/blfwk/DataSource.h:206
DataSource()
Default constructor.
Definition: src/blfwk/DataSource.h:159
virtual DataSource::Segment * getSegmentAt(unsigned index)
Returns this object, as it is its own segment.
Definition: src/blfwk/DataSource.h:208
Segment corresponding to a fill region of the executable image.
Definition: src/blfwk/DataSource.h:302
Discrete, contiguous part of the source's data.
Definition: src/blfwk/DataSource.h:65
std::vector< DataSource::Segment * > segment_array_t
An array of segments.
Definition: src/blfwk/DataSource.h:320
virtual unsigned getSegmentCount()
There is only one segment.
Definition: src/blfwk/DataSource.h:236
Data source that takes its data from an executable image.
Definition: src/blfwk/DataSource.h:263
StExecutableImage * m_image
Coalesced image of the file.
Definition: src/blfwk/DataSource.h:313
SizedIntegerValue & getPattern()
Return the fill pattern for the segment.
Definition: src/blfwk/DataSource.h:144
DataSource & m_source
The data source to which this segment belongs.
Definition: src/blfwk/DataSource.h:97
virtual ~DataSource()
Destructor.
Definition: src/blfwk/DataSource.h:165
virtual DataSource::Segment * getSegmentAt(unsigned index)
Returns this object, as it is its own segment.
Definition: src/blfwk/DataSource.h:238
Abstract base class for data sources.
Definition: src/blfwk/DataSource.h:56
virtual bool hasNaturalLocation()
Pattern segments have no natural address.
Definition: src/blfwk/DataSource.h:309
smart_array_ptr< uint8_t > m_data
The data.
Definition: src/blfwk/DataSource.h:254
virtual unsigned getLength()=0
Gets the length of the segment's data.
This is a special type of segment containing a repeating pattern.
Definition: src/blfwk/DataSource.h:110