This class is a container of multiple memory items. More...
#include <CCodeStore.h>
Public Member Functions | |
| CCodeStore (const SPConnectionMgr &rspConnectionMgr) | |
| Creates a new instance. | |
| void | clear () |
| Clears all items. | |
| void | copy (const CCodeStore &rSrc) |
| Copies from another code store instance. | |
| bool | empty () const |
| Returns true if container is empty. | |
| void | exclude (TCodeStoreAddress aAddressExcl, TCodeStoreAddress aEndExcl) |
| Excludes a range. | |
| int | findItem (TCodeStoreAddress aAddress) const |
| Finds an item in the requested range. | |
| uint32_t | get_MAU_size () |
| Returns the size of one MAU (minimum addressable unit) in bytes. | |
| TCodeStoreAddress | getBuffer (TCodeStoreAddress aAddress, std::vector< BYTE > &vBuffer) const |
| Obtains the code from the specified region. | |
| SPCodeStoreItem | getItem (int nIndex) const |
| Returns item at index nIndex. | |
| TCodeStoreAddress | getRangeHi () const |
| Returns highest loaded location. | |
| TCodeStoreAddress | getRangeLo () const |
| Returns lowest loaded location. | |
| TCodeStoreAddress | getTotal () const |
| Returns total number of contained locations. | |
| void | insert (TCodeStoreAddress aAddress, const std::vector< BYTE > vBuffer) |
| Inserts a new chunk of code. | |
| void | insertWithAccessInfo (TCodeStoreAddress aAddress, const std::vector< BYTE > vBuffer) |
| Inserts a new chunk of code, but only bytes, which have valid access. | |
| void | load (DWORD dwFlags, const std::string &rstrFileName, TCodeStoreAddress aOffset) |
| Load from a file. | |
| DWORD | load1 (DWORD dwFlags, const std::string &rstrFileName, TCodeStoreAddress aOffset) |
| Load from a file. | |
| int | numItems () const |
| Returns number of all items. | |
| bool | report (const std::string &fileReport, bool append, const std::string &format, DWORD maxInLine) const |
| Creates a report to file. | |
| bool | reportDif (const std::string &fileReport, bool append, const std::string &format, DWORD maxInLine, const CCodeStore &rCC1, const CCodeStore &rCC2) const |
| Creates a difference report to file. | |
| void | save (DWORD dwFlags, const std::string &rstrFileName, TCodeStoreAddress aOffset) |
| Save to file. | |
| void | set_MAU_size (uint32_t bytesPerMAU) |
| Sets the size of one MAU (minimum addressable unit) in bytes. | |
This class is a container of multiple memory items.
Each item is of type CCodeStoreItem
Note: This class has not been ported to Linux yet.
Python example for saving memory to Motorola S format: test_code_store.py
| isys::CCodeStore::CCodeStore | ( | const SPConnectionMgr & | rspConnectionMgr | ) |
| void isys::CCodeStore::clear | ( | ) |
Clears all items.
| void isys::CCodeStore::copy | ( | const CCodeStore & | rSrc | ) |
Copies from another code store instance.
Previous contents are cleared.
| rSrc | CCodeStore object to copy from |
| bool isys::CCodeStore::empty | ( | ) | const |
Returns true if container is empty.
| void isys::CCodeStore::exclude | ( | TCodeStoreAddress | aAddressExcl, |
| TCodeStoreAddress | aEndExcl ) |
Excludes a range.
| aAddressExcl | start of range to exclude |
| aEndExcl | last address of range to exclude |
| int isys::CCodeStore::findItem | ( | TCodeStoreAddress | aAddress | ) | const |
Finds an item in the requested range.
| aAddress | address which the found item covers |
| uint32_t isys::CCodeStore::get_MAU_size | ( | ) |
Returns the size of one MAU (minimum addressable unit) in bytes.
| TCodeStoreAddress isys::CCodeStore::getBuffer | ( | TCodeStoreAddress | aAddress, |
| std::vector< BYTE > & | vBuffer ) const |
Obtains the code from the specified region.
| aAddress | address from which the code should be retrieved |
| vBuffer | buffer which is filled with the code. Caller must preallocate vBuffer to the size that should be retrieved. For languages other than C++ use vBuffer = isystem.connect.VectorBYTE(size). |
| SPCodeStoreItem isys::CCodeStore::getItem | ( | int | nIndex | ) | const |
Returns item at index nIndex.
| nIndex | index of the element. Must be in range 0 .. numItems()-1 |
| TCodeStoreAddress isys::CCodeStore::getRangeHi | ( | ) | const |
Returns highest loaded location.
| TCodeStoreAddress isys::CCodeStore::getRangeLo | ( | ) | const |
Returns lowest loaded location.
| TCodeStoreAddress isys::CCodeStore::getTotal | ( | ) | const |
Returns total number of contained locations.
| void isys::CCodeStore::insert | ( | TCodeStoreAddress | aAddress, |
| const std::vector< BYTE > | vBuffer ) |
Inserts a new chunk of code.
| aAddress | address at which the new code is inserted |
| vBuffer | code to insert |
| void isys::CCodeStore::insertWithAccessInfo | ( | TCodeStoreAddress | aAddress, |
| const std::vector< BYTE > | vBuffer ) |
Inserts a new chunk of code, but only bytes, which have valid access.
Use this method if data was obtaind by method CDataController::readMemory(), because only bytes, which have ACCESS_OK may be inserted into code cache.
| aAddress | address at which the new code is inserted |
| vBuffer | code to insert in the first vBuffer.size() / 2 bytes, access info in the last half. |
| void isys::CCodeStore::load | ( | DWORD | dwFlags, |
| const std::string & | rstrFileName, | ||
| TCodeStoreAddress | aOffset ) |
Load from a file.
| dwFlags | for default behavior specify 0 for dwFlags, otherwise use ICodeCache::ESaveLoadFlags |
| rstrFileName | path to the file to load from |
| aOffset | offset to add to the code loaded from the file |
| DWORD isys::CCodeStore::load1 | ( | DWORD | dwFlags, |
| const std::string & | rstrFileName, | ||
| TCodeStoreAddress | aOffset ) |
Load from a file.
The same operation as load(), but this one returns format used in loading the file.
| dwFlags | for default behavior specify 0 for dwFlags, otherwise use ICodeCache::ESaveLoadFlags |
| rstrFileName | path to the file to load from |
| aOffset | offset to add to the code loaded from the file |
| int isys::CCodeStore::numItems | ( | ) | const |
Returns number of all items.
| bool isys::CCodeStore::report | ( | const std::string & | fileReport, |
| bool | append, | ||
| const std::string & | format, | ||
| DWORD | maxInLine ) const |
Creates a report to file.
| fileReport | path to the report file |
| append | true to append, false to create a new file |
| format | for every single item, using %ADDR%, %SIZE%, %EADDR% and %DATA% macros. If empty, the default "A:%ADDR% S:%SIZE% D:%DATA%" is used |
| maxInLine | specifies maximum number of addresses reported in a line. Use 0 to report contiguous ranges in one line |
| bool isys::CCodeStore::reportDif | ( | const std::string & | fileReport, |
| bool | append, | ||
| const std::string & | format, | ||
| DWORD | maxInLine, | ||
| const CCodeStore & | rCC1, | ||
| const CCodeStore & | rCC2 ) const |
Creates a difference report to file.
| fileReport | path to the report file |
| append | true to append, false to create a new file |
| format | for every single item, using %ADDR%, %SIZE%, %EADDR%, %DIF% and %DATA1%, %DATA2% macros. If empty, the default "A:%ADDR% S:%SIZE%\n D1:%DATA1%\n D2:%DATA2%" is used |
| maxInLine | specifies maximum number of addresses reported in a line. Use 0 to report contiguous ranges in one line |
| rCC1 | is the first reference code store from which this difference object was created |
| rCC2 | is the second reference code store from which this difference object was created |
| void isys::CCodeStore::save | ( | DWORD | dwFlags, |
| const std::string & | rstrFileName, | ||
| TCodeStoreAddress | aOffset ) |
Save to file.
| dwFlags | use ICodeCache::ESaveLoadFlags to specify format. Only lFormatMotorolaS lFormatIntelHex and lFormatBinary are supported. Note: Gaps in the store are padded with 0h when saving to binary file. |
| rstrFileName | path to the file to save to |
| aOffset | offset to add to the code saved to the file. If format is binary, then the offset determines the position in the store from where the saving starts. |
| void isys::CCodeStore::set_MAU_size | ( | uint32_t | bytesPerMAU | ) |
Sets the size of one MAU (minimum addressable unit) in bytes.
The default value is 1, which is appropriate for most architectures.
The number of bytes required for every MAU is:
| MAU Size in bits | Bytes Required per MAU |
|---|---|
| 1 - 8 | 1 |
| 9 - 16 | 2 |
| 17 - 32 | 4 |
| bytesPerMAU | Number of bytes required for one MAU. |