winIDEA SDK
|
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.
#include <CCodeStore.h>
Public Member Functions | |
CCodeStore (const SPConnectionMgr &rspConnectionMgr) | |
Creates a new instance. More... | |
void | clear () |
Clears all items. | |
void | copy (const CCodeStore &rSrc) |
Copies from another code store instance. More... | |
void | load (DWORD dwFlags, const std::string &rstrFileName, TCodeStoreAddress aOffset) |
Load from a file. More... | |
DWORD | load1 (DWORD dwFlags, const std::string &rstrFileName, TCodeStoreAddress aOffset) |
Load from a file. More... | |
void | save (DWORD dwFlags, const std::string &rstrFileName, TCodeStoreAddress aOffset) |
Save to file. More... | |
void | insert (TCodeStoreAddress aAddress, const std::vector< BYTE > vBuffer) |
Inserts a new chunk of code. More... | |
void | insertWithAccessInfo (TCodeStoreAddress aAddress, const std::vector< BYTE > vBuffer) |
Inserts a new chunk of code, but only bytes, which have valid access. More... | |
void | exclude (TCodeStoreAddress aAddressExcl, TCodeStoreAddress aEndExcl) |
Excludes a range. More... | |
bool | empty () const |
Returns true if container is empty. More... | |
int | numItems () const |
Returns number of all items. More... | |
SPCodeStoreItem | getItem (int nIndex) const |
Returns item at index nIndex. More... | |
int | findItem (TCodeStoreAddress aAddress) const |
Finds an item in the requested range. More... | |
TCodeStoreAddress | getBuffer (TCodeStoreAddress aAddress, std::vector< BYTE > &vBuffer) const |
Obtains the code from the specified region. More... | |
TCodeStoreAddress | getTotal () const |
Returns total number of contained locations. More... | |
TCodeStoreAddress | getRangeLo () const |
Returns lowest loaded location. More... | |
TCodeStoreAddress | getRangeHi () const |
Returns highest loaded location. More... | |
bool | report (const std::string &fileReport, bool append, const std::string &format, DWORD maxInLine) const |
Creates a report to file. More... | |
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. More... | |
isys::CCodeStore::CCodeStore | ( | const SPConnectionMgr & | rspConnectionMgr | ) |
Creates a new instance.
rspConnectionMgr | ConnectionMgr object |
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 |
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 |
lFormat...
for possible return values and associated format. In Python you can refer to them as ic.ICodeCache.lFormatELF
, for example. 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 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. |