![]() |
Kinetis Bootloader Host
2.0.0
Host Tools for Kinetis devices
|
Used to build a representation of memory regions. More...
#include <StExecutableImage.h>
Collaboration diagram for StExecutableImage:Classes | |
| class | address_filter_exception |
| struct | AddressFilter |
| struct | MemoryRegion |
Public Member Functions | |
| StExecutableImage (int inAlignment=256) | |
| Constructor. | |
| StExecutableImage (const StExecutableImage &inOther) | |
| Copy constructor. More... | |
| virtual | ~StExecutableImage () |
| Destructor. More... | |
| StExecutableImage (int inAlignment=256) | |
| Constructor. | |
| StExecutableImage (const StExecutableImage &inOther) | |
| Copy constructor. | |
| virtual | ~StExecutableImage () |
| Destructor. | |
Image name | |
Methods for getting and setting the image name. | |
| virtual void | setName (const std::string &inName) |
| Sets the image's name to inName. More... | |
| virtual std::string | getName () const |
| Returns a copy of the image's name. | |
| virtual void | setName (const std::string &inName) |
| Sets the image's name to inName. | |
| virtual std::string | getName () const |
| Returns a copy of the image's name. | |
Regions | |
Methods to add and access memory regions. | |
| virtual void | addFillRegion (uint32_t inAddress, unsigned inLength) |
| Add a region to be filled with zeroes. More... | |
| virtual void | addTextRegion (uint32_t inAddress, const uint8_t *inData, unsigned inLength) |
| Add a region containing data to be loaded. More... | |
| unsigned | getRegionCount () const |
| Returns the total number of regions. More... | |
| const MemoryRegion & | getRegionAtIndex (unsigned inIndex) const |
| Returns a reference to the region specified by inIndex. More... | |
| const_iterator | getRegionBegin () const |
| Return an iterator to the first region. | |
| const_iterator | getRegionEnd () const |
| Return an iterator to the next-after-last region. | |
| virtual void | addFillRegion (uint32_t inAddress, unsigned inLength) |
| Add a region to be filled with zeroes. | |
| virtual void | addTextRegion (uint32_t inAddress, const uint8_t *inData, unsigned inLength) |
| Add a region containing data to be loaded. | |
| unsigned | getRegionCount () const |
| Returns the total number of regions. More... | |
| const MemoryRegion & | getRegionAtIndex (unsigned inIndex) const |
| Returns a reference to the region specified by inIndex. | |
| const_iterator | getRegionBegin () const |
| Return an iterator to the first region. | |
| const_iterator | getRegionEnd () const |
| Return an iterator to the next-after-last region. | |
Entry point | |
| void | setEntryPoint (uint32_t inEntryAddress) |
| Sets the entry point address. | |
| bool | hasEntryPoint () const |
| Returns true if an entry point has been set. | |
| uint32_t | getEntryPoint () const |
| Returns the entry point address. | |
| void | setEntryPoint (uint32_t inEntryAddress) |
| Sets the entry point address. | |
| bool | hasEntryPoint () const |
| Returns true if an entry point has been set. | |
| uint32_t | getEntryPoint () const |
| Returns the entry point address. | |
Address filter | |
| virtual void | addAddressFilter (const AddressFilter &filter) |
| Add a new address filter. More... | |
| template<typename _T > | |
| void | addAddressFilters (_T from, _T to) |
| Add multiple address filters at once. More... | |
| virtual void | clearAddressFilters () |
| Remove all active filters. | |
| virtual void | applyAddressFilters () |
| Process all active filters and perform associated actions. More... | |
| virtual void | addAddressFilter (const AddressFilter &filter) |
| Add a new address filter. | |
| template<typename _T > | |
| void | addAddressFilters (_T from, _T to) |
| Add multiple address filters at once. More... | |
| virtual void | clearAddressFilters () |
| Remove all active filters. | |
| virtual void | applyAddressFilters () |
| Process all active filters and perform associated actions. | |
Protected Member Functions | |
| void | cropRegionToFilter (MemoryRegion ®ion, const AddressFilter &filter) |
| Deletes the portion region that overlaps filter. More... | |
| void | insertOrMergeRegion (MemoryRegion &inRegion) |
| Inserts the region in sorted order or merges with one already in the image. More... | |
| void | mergeRegions (MemoryRegion &inOldRegion, MemoryRegion &inNewRegion) |
| Merges two memory regions into one. More... | |
| void | cropRegionToFilter (MemoryRegion ®ion, const AddressFilter &filter) |
| Deletes the portion region that overlaps filter. | |
| void | insertOrMergeRegion (MemoryRegion &inRegion) |
| Inserts the region in sorted order or merges with one already in the image. | |
| void | mergeRegions (MemoryRegion &inOldRegion, MemoryRegion &inNewRegion) |
| Merges two memory regions into one. | |
Protected Attributes | |
| std::string | m_name |
| The name of the image (can be a file name, for instance). | |
| int | m_alignment |
| The required address alignment for each memory region. | |
| bool | m_hasEntry |
| True if an entry point has been set. | |
| uint32_t | m_entry |
| Entry point address. | |
| MemoryRegionList | m_image |
| The memory regions. | |
| AddressFilterList | m_filters |
| List of active address filters. | |
Used to build a representation of memory regions.
An intermediate representation of the memory regions and segments loaded from an executable file. Also used to find contiguous segments that are specified separately in the source file.
When regions are added, an attempt is made to coalesce contiguous regions. In order for this to succeed, the touching regions must be of the same type and have the same permissions. Regions are also kept sorted by their address range as they are added.
An intermediate representation of the memory regions and segments loaded from an executable file. Also used to find contiguous segments that are specified separately in the source file.
When regions are added, an attempt is made to coalesce contiguous regions. In order for this to succeed, the touching regions must be of the same type and have the same permissions. Regions are also kept sorted by their address range as they are added.
| typedef MemoryRegionList::const_iterator StExecutableImage::const_iterator |
The iterator type used to access StExecutableImage::MemoryRegion objects. This type is used by the methods getRegionBegin() and getRegionEnd().
| typedef MemoryRegionList::const_iterator StExecutableImage::const_iterator |
The iterator type used to access StExecutableImage::MemoryRegion objects. This type is used by the methods getRegionBegin() and getRegionEnd().
| anonymous enum |
| anonymous enum |
The possible actions for regions matching an address filter range.
The possible actions for regions matching an address filter range.
| StExecutableImage::StExecutableImage | ( | const StExecutableImage & | inOther | ) |
Copy constructor.
Makes a duplicate of each memory region.
|
virtual |
Destructor.
Disposes of memory allocated for each region.
|
virtual |
Add a new address filter.
The list of address filters is kept sorted as filters are added.
|
inline |
Add multiple address filters at once.
The template argument _T must be an iterator or const iterator that dereferences to an StExecutableImage::AddressFilter reference. All filters from from to to will be added to the address filter list.
|
inline |
Add multiple address filters at once.
The template argument _T must be an iterator or const iterator that dereferences to an StExecutableImage::AddressFilter reference. All filters from from to to will be added to the address filter list.
|
virtual |
Add a region to be filled with zeroes.
| std::runtime_error | will be thrown if the new overlaps an existing region. |
|
virtual |
Add a region containing data to be loaded.
A copy of inData is made before returning. The copy will be deleted when the executable image is destructed. Currently, the text region is created with read, write, and executable flags set.
| std::runtime_error | will be thrown if the new overlaps an existing region. |
| std::bad_alloc | is thrown if memory for the copy of inData cannot be allocated. |
|
virtual |
Process all active filters and perform associated actions.
| StExecutableImage::address_filter_exception | Raised when a filter with the type ADDR_FILTER_ERROR or ADDR_FILTER_WARNING is matched. |
| StExecutableImage::address_filter_exception | Raised when a filter with the type ADDR_FILTER_ERROR or ADDR_FILTER_WARNING is matched. |
|
protected |
Deletes the portion region that overlaps filter.
There are several possible cases here:
| const StExecutableImage::MemoryRegion & StExecutableImage::getRegionAtIndex | ( | unsigned | inIndex | ) | const |
Returns a reference to the region specified by inIndex.
| std::out_of_range | is thrown if inIndex is out of range. |
|
inline |
Returns the total number of regions.
Note that this count may not be the same as the number of calls to addFillRegion() and addTextRegion() due to region coalescing.
|
inline |
Returns the total number of regions.
Note that this count may not be the same as the number of calls to addFillRegion() and addTextRegion() due to region coalescing.
|
protected |
Inserts the region in sorted order or merges with one already in the image.
| std::runtime_error | will be thrown if inRegion overlaps an existing region. |
| std::runtime_error | will be thrown if inRegion overlaps an existing region. |
|
protected |
Merges two memory regions into one.
Extends inNewRegion to include the data in inOldRegion. It is assumed that the two regions are compatible. The new region may come either before or after the old region in memory. Note that while the two regions don't necessarily have to be touching, it's probably a good idea. That's because any data between the regions will be set to 0.
For TEXT_REGION types, the two original regions will have their data deleted during the merge. Thus, this method is not safe if any outside callers may be accessing the region's data.
|
virtual |
Sets the image's name to inName.
A copy of inName is made, so the original may be disposed of by the caller after this method returns.