OpenCSD - CoreSight Trace Decode Library
1.3.3
|
Memory accessor for a binary file. More...
#include <trc_mem_acc_file.h>
Public Member Functions | |
virtual const uint32_t | readBytes (const ocsd_vaddr_t address, const ocsd_mem_space_acc_t memSpace, const uint8_t trcID, const uint32_t reqBytes, uint8_t *byteBuffer) |
bool | AddOffsetRange (const ocsd_vaddr_t startAddr, const size_t size, const size_t offset) |
virtual const bool | addrInRange (const ocsd_vaddr_t s_address) const |
virtual const bool | addrStartOfRange (const ocsd_vaddr_t s_address) const |
virtual const uint32_t | bytesInRange (const ocsd_vaddr_t s_address, const uint32_t reqBytes) const |
virtual const bool | overLapRange (const TrcMemAccessorBase *p_test_acc) const |
virtual void | getMemAccString (std::string &accStr) const |
![]() | |
TrcMemAccessorBase (MemAccTypes type) | |
TrcMemAccessorBase (MemAccTypes type, ocsd_vaddr_t startAddr, ocsd_vaddr_t endAddr) | |
virtual | ~TrcMemAccessorBase () |
void | setRange (ocsd_vaddr_t startAddr, ocsd_vaddr_t endAddr) |
enum MemAccTypes | getType () const |
void | setMemSpace (ocsd_mem_space_acc_t memSpace) |
const ocsd_mem_space_acc_t | getMemSpace () const |
const bool | inMemSpace (const ocsd_mem_space_acc_t mem_space) const |
Static Public Member Functions | |
static ocsd_err_t | createFileAccessor (TrcMemAccessorFile **p_acc, const std::string &pathToFile, ocsd_vaddr_t startAddr, size_t offset=0, size_t size=0) |
static void | destroyFileAccessor (TrcMemAccessorFile *p_accessor) |
static const bool | isExistingFileAccessor (const std::string &pathToFile) |
static TrcMemAccessorFile * | getExistingFileAccessor (const std::string &pathToFile) |
Protected Member Functions | |
TrcMemAccessorFile () | |
virtual | ~ TrcMemAccessorFile () |
void | IncRefCount () |
void | DecRefCount () |
const int | getRefCount () const |
ocsd_err_t | initAccessor (const std::string &pathToFile, ocsd_vaddr_t startAddr, size_t offset, size_t size) |
const std::string & | getFilePath () const |
FileRegionMemAccessor * | getRegionForAddress (const ocsd_vaddr_t startAddr) const |
virtual const bool | validateRange () |
Additional Inherited Members | |
![]() | |
enum | MemAccTypes { MEMACC_UNKNOWN , MEMACC_FILE , MEMACC_BUFPTR , MEMACC_CB_IF } |
![]() | |
ocsd_vaddr_t | m_startAddress |
ocsd_vaddr_t | m_endAddress |
const MemAccTypes | m_type |
ocsd_mem_space_acc_t | m_mem_space |
Memory accessor for a binary file.
Memory accessor based on a binary file snapshot of some memory.
Static creation code to allow reference counted accessor usable for multiple access maps attached to multiple source trees for the same system.
Definition at line 76 of file trc_mem_acc_file.h.
|
protected |
protected default constructor
|
protectedvirtual |
protected default destructor
bool TrcMemAccessorFile::AddOffsetRange | ( | const ocsd_vaddr_t | startAddr, |
const size_t | size, | ||
const size_t | offset | ||
) |
File may contain multiple none-overlapping ranges in a single file.
startAddr | : Address for beginning of byte data. |
size | : size of range in bytes. |
offset | : offset into file for that data. |
|
virtual |
Override in case we have multiple regions in the file.
s_address | : Address to test. |
Reimplemented from TrcMemAccessorBase.
|
virtual |
test if an address is the start of range for this accessor
s_address | : Address to test. |
Reimplemented from TrcMemAccessorBase.
|
virtual |
Test number of bytes available from the start address, up to the number of requested bytes. Tests if all the requested bytes are available from the supplied start address. Returns the number available up to full requested amount.
s_address | : Start address within the range. |
reqBytes | : Number of bytes needed from the start address. |
Reimplemented from TrcMemAccessorBase.
|
static |
Create a file accessor based on the supplied path and address. Keeps a list of file accessors created.
File will be checked to ensure valid accessor can be created.
If an accessor using the supplied file is currently in use then a reference to that accessor will be returned and the accessor reference counter updated.
&pathToFile | : Path to binary file |
startAddr | : Start address of data represented by file. |
|
inlineprotected |
decrement reference counter
Definition at line 90 of file trc_mem_acc_file.h.
|
static |
Destroy supplied accessor.
Reference counter decremented and checked and accessor destroyed if no longer in use.
*p_accessor | : File Accessor to destroy. |
|
static |
Get the accessor using the supplied file path Use after createFileAccessor if additional memory ranges need adding to an exiting file accessor.
&pathToFile | : Path to test. |
|
inlineprotected |
get the file path
Definition at line 107 of file trc_mem_acc_file.h.
|
virtual |
Override to handle ranges and offset accessors plus add in file name.
Reimplemented from TrcMemAccessorBase.
|
inlineprotected |
get current reference count
Definition at line 93 of file trc_mem_acc_file.h.
|
protected |
get an offset region if extant for the address
|
inlineprotected |
increment reference counter
Definition at line 87 of file trc_mem_acc_file.h.
|
protected |
Initialise accessor with file name and path, and start address. File opened and length calculated to determine end address for the range.
&pathToFile | : Binary file path and name |
startAddr | : system memory address associated with start of binary datain file. |
|
static |
Test if any accessor is currently using the supplied file path
&pathToFile | : Path to test. |
|
virtual |
test is supplied range accessor overlaps this range.
*p_test_acc | : Accessor to test for overlap. |
Reimplemented from TrcMemAccessorBase.
|
virtual |
read bytes override - reads from file
Implements TrcMemAccessorBase.
|
protectedvirtual |
Validate the address range - ensure addresses aligned, different, st < en etc.
Reimplemented from TrcMemAccessorBase.