On 1 August 2016 at 07:19, Mike Leach mike.leach@linaro.org wrote:
Memory accessor API on decode tree was different to simpler API on C API.
I can't figure out what this sentence is - please revisit.
Decode tree API re-worked to make the two more consistent.
Signed-off-by: Mike Leach mike.leach@linaro.org
decoder/include/c_api/ocsd_c_api_deprc_fn.h | 4 + decoder/include/c_api/ocsd_c_api_types.h | 10 +- decoder/include/c_api/opencsd_c_api.h | 2 +- decoder/include/common/ocsd_dcd_tree.h | 16 +- decoder/include/ocsd_if_types.h | 8 + decoder/source/c_api/ocsd_c_api.cpp | 163 ++++----------------- decoder/source/ocsd_dcd_tree.cpp | 151 ++++++++++++++++--- .../snapshot_parser_lib/source/ss_to_dcdtree.cpp | 13 +- decoder/tests/source/c_api_pkt_print_test.c | 2 +- 9 files changed, 191 insertions(+), 178 deletions(-)
diff --git a/decoder/include/c_api/ocsd_c_api_deprc_fn.h b/decoder/include/c_api/ocsd_c_api_deprc_fn.h index 70986ff..7c74987 100644 --- a/decoder/include/c_api/ocsd_c_api_deprc_fn.h +++ b/decoder/include/c_api/ocsd_c_api_deprc_fn.h @@ -168,6 +168,10 @@ OCSD_C_API ocsd_err_t ocsd_dt_attach_ptm_pkt_mon(const dcd_tree_handle_t handle, */ OCSD_C_API ocsd_err_t ocsd_dt_create_stm_pkt_proc(const dcd_tree_handle_t handle, const void *stm_cfg, FnStmPacketDataIn pPktFn, const void *p_context);
+/** deprecated memory region type for adding multi-region binary files to memory access interface */ +typedef ocsd_file_mem_region_t file_mem_region_t; /** @}*/
#endif // ARM_OCSD_C_API_DEPRC_FN_H_INCLUDED diff --git a/decoder/include/c_api/ocsd_c_api_types.h b/decoder/include/c_api/ocsd_c_api_types.h index 1e98255..aa11391 100644 --- a/decoder/include/c_api/ocsd_c_api_types.h +++ b/decoder/include/c_api/ocsd_c_api_types.h @@ -135,20 +135,12 @@ typedef void (* FnStmPktMonDataIn)( const void *p_context, const uint32_t size, const uint8_t *p_data);
-/** memory region type for adding multi-region binary files to memory access interface */ -typedef struct _file_mem_region {
- size_t file_offset; /**< Offset from start of file for memory region */
- ocsd_vaddr_t start_address; /**< Start address of memory region */
- size_t region_size; /**< size in bytes of memory region */
-} file_mem_region_t;
+/** Callback interface type when attaching monitor/sink to packet processor */ typedef enum _ocsd_c_api_cb_types { OCSD_C_API_CB_PKT_SINK, OCSD_C_API_CB_PKT_MON, } ocsd_c_api_cb_types;
/** @}*/
#endif // ARM_OCSD_C_API_TYPES_H_INCLUDED diff --git a/decoder/include/c_api/opencsd_c_api.h b/decoder/include/c_api/opencsd_c_api.h index 7c0648a..061bfe4 100644 --- a/decoder/include/c_api/opencsd_c_api.h +++ b/decoder/include/c_api/opencsd_c_api.h @@ -252,7 +252,7 @@ OCSD_C_API ocsd_err_t ocsd_dt_add_binfile_mem_acc(const dcd_tree_handle_t handle
- @return ocsd_err_t : Library error code - RCDTL_OK if successful.
*/ -OCSD_C_API ocsd_err_t ocsd_dt_add_binfile_region_mem_acc(const dcd_tree_handle_t handle, const file_mem_region_t *region_array, const int num_regions, const ocsd_mem_space_acc_t mem_space, const char *filepath); +OCSD_C_API ocsd_err_t ocsd_dt_add_binfile_region_mem_acc(const dcd_tree_handle_t handle, const ocsd_file_mem_region_t *region_array, const int num_regions, const ocsd_mem_space_acc_t mem_space, const char *filepath);
/*!
- Add a memory buffer based memory range accessor to the decode tree.
diff --git a/decoder/include/common/ocsd_dcd_tree.h b/decoder/include/common/ocsd_dcd_tree.h index 7073a5d..0461eef 100644 --- a/decoder/include/common/ocsd_dcd_tree.h +++ b/decoder/include/common/ocsd_dcd_tree.h @@ -109,14 +109,19 @@ public: void setMemAccessI(ITargetMemAccess *i_mem_access); void setGenTraceElemOutI(ITrcGenElemIn *i_gen_trace_elem);
- /* create mapper within the decode tree. */
- /* create mapper within the decode tree - also allows direct manipulation of the mapper object to set up custom arrangements of accessors. */ ocsd_err_t createMemAccMapper(memacc_mapper_t type = MEMACC_MAP_GLOBAL);
- ocsd_err_t addMemAccessorToMap(TrcMemAccessorBase *p_accessor, const uint8_t cs_trace_id);
- ocsd_err_t removeMemAccessor(TrcMemAccessorBase *p_accessor);
- ocsd_err_t removeMemAccessorByAddress(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t cs_trace_id);
TrcMemAccMapper *getMemAccMapper() const { return m_default_mapper; };
void setExternMemAccMapper(TrcMemAccMapper * pMapper); const bool hasMemAccMapper() const { return (bool)(m_default_mapper != 0); }; void logMappedRanges();
/* create and destroy accessor types - all using global CSID value - on default accessor */
ocsd_err_t addBufferMemAcc(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t *p_mem_buffer, const uint32_t mem_length);
ocsd_err_t addBinFileMemAcc(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const std::string &filepath);
ocsd_err_t addBinFileRegionMemAcc(const ocsd_file_mem_region_t *region_array, const int num_regions, const ocsd_mem_space_acc_t mem_space, const std::string &filepath);
ocsd_err_t addCallbackMemAcc(const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address, const ocsd_mem_space_acc_t mem_space, Fn_MemAcc_CB p_cb_func, const void *p_context);
ocsd_err_t removeMemAccByAddress(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space);
/* get decoder elements currently in use */ DecodeTreeElement *getDecoderElement(const uint8_t CSID) const;
@@ -153,7 +158,8 @@ private:
uint8_t m_decode_elem_iter;
- TrcMemAccMapper *m_default_mapper;
TrcMemAccMapper *m_default_mapper; //!< the mem acc mapper to use
bool m_created_mapper; //!< true if created by decode tree object
/* global error logger - all sources */ static ITraceErrorLog *s_i_error_logger;
diff --git a/decoder/include/ocsd_if_types.h b/decoder/include/ocsd_if_types.h index 7e17f04..f5d1fde 100644 --- a/decoder/include/ocsd_if_types.h +++ b/decoder/include/ocsd_if_types.h @@ -435,6 +435,14 @@ typedef enum _ocsd_mem_space_acc_t { */ typedef uint32_t (* Fn_MemAcc_CB)(const void *p_context, const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint32_t reqBytes, uint8_t *byteBuffer);
+/** memory region type for adding multi-region binary files to memory access interface */ +typedef struct _ocsd_file_mem_region {
- size_t file_offset; /**< Offset from start of file for memory region */
- ocsd_vaddr_t start_address; /**< Start address of memory region */
- size_t region_size; /**< size in bytes of memory region */
+} ocsd_file_mem_region_t;
/** @}*/
/** @name Packet Processor Operation Control Flags diff --git a/decoder/source/c_api/ocsd_c_api.cpp b/decoder/source/c_api/ocsd_c_api.cpp index 1e327ae..335bbe5 100644 --- a/decoder/source/c_api/ocsd_c_api.cpp +++ b/decoder/source/c_api/ocsd_c_api.cpp @@ -55,6 +55,7 @@ namespace std { const nothrow_t nothrow = nothrow_t(); }
static ocsd_err_t ocsd_create_pkt_sink_cb(ocsd_trace_protocol_t protocol, FnDefPktDataIn pPktInFn, const void *p_context, ITrcTypedBase **ppCBObj ); static ocsd_err_t ocsd_create_pkt_mon_cb(ocsd_trace_protocol_t protocol, FnDefPktDataMon pPktInFn, const void *p_context, ITrcTypedBase **ppCBObj ); +static ocsd_err_t ocsd_check_and_add_mem_acc_mapper(const dcd_tree_handle_t handle, DecodeTree **ppDT);
/*******************************************************************************/ /* C library data - additional data on top of the C++ library objects */ @@ -332,156 +333,45 @@ OCSD_C_API ocsd_err_t ocsd_gen_elem_str(const ocsd_generic_trace_elem *p_pkt, ch }
-/*** Decode tree -- memeory accessor control */ +/*** Decode tree -- memory accessor control */
OCSD_C_API ocsd_err_t ocsd_dt_add_binfile_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const char *filepath) { ocsd_err_t err = OCSD_OK;
- if(handle != C_API_INVALID_TREE_HANDLE)
- {
DecodeTree *pDT = static_cast<DecodeTree *>(handle);
if(!pDT->hasMemAccMapper())
err = pDT->createMemAccMapper();
if(err == OCSD_OK)
{
TrcMemAccessorBase *p_accessor;
std::string pathToFile = filepath;
err = TrcMemAccFactory::CreateFileAccessor(&p_accessor,pathToFile,address);
if(err == OCSD_OK)
{
TrcMemAccessorFile *pAcc = dynamic_cast<TrcMemAccessorFile *>(p_accessor);
if(pAcc)
{
pAcc->setMemSpace(mem_space);
err = pDT->addMemAccessorToMap(pAcc,0);
}
else
err = OCSD_ERR_MEM; // wrong type of object - treat as mem error
if(err != OCSD_OK)
TrcMemAccFactory::DestroyAccessor(p_accessor);
}
}
- }
- else
err = OCSD_ERR_INVALID_PARAM_VAL;
- DecodeTree *pDT;
- err = ocsd_check_and_add_mem_acc_mapper(handle,&pDT);
- if(err == OCSD_OK)
return err;err = pDT->addBinFileMemAcc(address,mem_space,filepath);
}
-OCSD_C_API ocsd_err_t ocsd_dt_add_binfile_region_mem_acc(const dcd_tree_handle_t handle, const file_mem_region_t *region_array, const int num_regions, const ocsd_mem_space_acc_t mem_space, const char *filepath) +OCSD_C_API ocsd_err_t ocsd_dt_add_binfile_region_mem_acc(const dcd_tree_handle_t handle, const ocsd_file_mem_region_t *region_array, const int num_regions, const ocsd_mem_space_acc_t mem_space, const char *filepath) { ocsd_err_t err = OCSD_OK;
- if((handle != C_API_INVALID_TREE_HANDLE) && (region_array != 0) && (num_regions != 0))
- {
DecodeTree *pDT = static_cast<DecodeTree *>(handle);
if(!pDT->hasMemAccMapper())
err = pDT->createMemAccMapper();
if(err == OCSD_OK)
{
TrcMemAccessorBase *p_accessor;
std::string pathToFile = filepath;
int curr_region_idx = 0;
err = TrcMemAccFactory::CreateFileAccessor(&p_accessor,pathToFile,region_array[curr_region_idx].start_address,region_array[curr_region_idx].file_offset, region_array[curr_region_idx].region_size);
if(err == OCSD_OK)
{
TrcMemAccessorFile *pAcc = dynamic_cast<TrcMemAccessorFile *>(p_accessor);
if(pAcc)
{
curr_region_idx++;
while(curr_region_idx < num_regions)
{
pAcc->AddOffsetRange(region_array[curr_region_idx].start_address,
region_array[curr_region_idx].region_size,
region_array[curr_region_idx].file_offset);
curr_region_idx++;
}
pAcc->setMemSpace(mem_space);
err = pDT->addMemAccessorToMap(pAcc,0);
}
else
err = OCSD_ERR_MEM; // wrong type of object - treat as mem error
if(err != OCSD_OK)
TrcMemAccFactory::DestroyAccessor(p_accessor);
}
}
- }
- else
err = OCSD_ERR_INVALID_PARAM_VAL;
- DecodeTree *pDT;
- err = ocsd_check_and_add_mem_acc_mapper(handle,&pDT);
- if(err == OCSD_OK)
return err;err = pDT->addBinFileRegionMemAcc(region_array,num_regions,mem_space,filepath);
}
OCSD_C_API ocsd_err_t ocsd_dt_add_buffer_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t *p_mem_buffer, const uint32_t mem_length) { ocsd_err_t err = OCSD_OK;
- if(handle != C_API_INVALID_TREE_HANDLE)
- {
DecodeTree *pDT = static_cast<DecodeTree *>(handle);
if(!pDT->hasMemAccMapper())
err = pDT->createMemAccMapper();
if(err == OCSD_OK)
{
TrcMemAccessorBase *p_accessor;
err = TrcMemAccFactory::CreateBufferAccessor(&p_accessor, address, p_mem_buffer, mem_length);
if(err == OCSD_OK)
{
TrcMemAccBufPtr *pMBuffAcc = dynamic_cast<TrcMemAccBufPtr *>(p_accessor);
if(pMBuffAcc)
{
pMBuffAcc->setMemSpace(mem_space);
err = pDT->addMemAccessorToMap(p_accessor,0);
}
else
err = OCSD_ERR_MEM; // wrong type of object - treat as mem error
if(err != OCSD_OK)
TrcMemAccFactory::DestroyAccessor(p_accessor);
}
}
- }
- else
err = OCSD_ERR_INVALID_PARAM_VAL;
- DecodeTree *pDT;
- err = ocsd_check_and_add_mem_acc_mapper(handle,&pDT);
- if(err == OCSD_OK)
return err;err = pDT->addBufferMemAcc(address,mem_space,p_mem_buffer,mem_length);
}
OCSD_C_API ocsd_err_t ocsd_dt_add_callback_mem_acc(const dcd_tree_handle_t handle, const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address, const ocsd_mem_space_acc_t mem_space, Fn_MemAcc_CB p_cb_func, const void *p_context) { ocsd_err_t err = OCSD_OK;
- if(handle != C_API_INVALID_TREE_HANDLE)
- {
DecodeTree *pDT = static_cast<DecodeTree *>(handle);
if(!pDT->hasMemAccMapper())
err = pDT->createMemAccMapper();
if(err == OCSD_OK)
{
TrcMemAccessorBase *p_accessor;
err = TrcMemAccFactory::CreateCBAccessor(&p_accessor, st_address, en_address, mem_space);
if(err == OCSD_OK)
{
TrcMemAccCB *pCBAcc = dynamic_cast<TrcMemAccCB *>(p_accessor);
if(pCBAcc)
{
pCBAcc->setCBIfFn(p_cb_func, p_context);
err = pDT->addMemAccessorToMap(p_accessor,0);
}
else
err = OCSD_ERR_MEM; // wrong type of object - treat as mem error
if(err != OCSD_OK)
TrcMemAccFactory::DestroyAccessor(p_accessor);
}
}
- }
- else
err = OCSD_ERR_INVALID_PARAM_VAL;
- DecodeTree *pDT;
- err = ocsd_check_and_add_mem_acc_mapper(handle,&pDT);
- if(err == OCSD_OK)
return err;err = pDT->addCallbackMemAcc(st_address,en_address,mem_space,p_cb_func,p_context);
}
@@ -492,10 +382,7 @@ OCSD_C_API ocsd_err_t ocsd_dt_remove_mem_acc(const dcd_tree_handle_t handle, con if(handle != C_API_INVALID_TREE_HANDLE) { DecodeTree *pDT = static_cast<DecodeTree *>(handle);
if(!pDT->hasMemAccMapper())
err = OCSD_ERR_INVALID_PARAM_VAL; /* no mapper, no remove*/
else
err = pDT->removeMemAccessorByAddress(st_address,mem_space,0);
} else err = OCSD_ERR_INVALID_PARAM_VAL;err = pDT->removeMemAccByAddress(st_address,mem_space);
@@ -582,6 +469,16 @@ static ocsd_err_t ocsd_create_pkt_mon_cb(ocsd_trace_protocol_t protocol, FnDefPk return err; }
+static ocsd_err_t ocsd_check_and_add_mem_acc_mapper(const dcd_tree_handle_t handle, DecodeTree **ppDT) +{
- *ppDT = 0;
- if(handle == C_API_INVALID_TREE_HANDLE)
return OCSD_ERR_INVALID_PARAM_VAL;
- *ppDT = static_cast<DecodeTree *>(handle);
- if(!(*ppDT)->hasMemAccMapper())
return (*ppDT)->createMemAccMapper();
- return OCSD_OK;
+}
/*******************************************************************************/ /* C API Helper objects */ diff --git a/decoder/source/ocsd_dcd_tree.cpp b/decoder/source/ocsd_dcd_tree.cpp index cd0995b..b6451d0 100644 --- a/decoder/source/ocsd_dcd_tree.cpp +++ b/decoder/source/ocsd_dcd_tree.cpp @@ -96,8 +96,8 @@ DecodeTree::DecodeTree() : m_i_decoder_root(0), m_frame_deformatter_root(0), m_decode_elem_iter(0),
- m_default_mapper(0)
- m_default_mapper(0),
- m_created_mapper(false)
{ for(int i = 0; i < 0x80; i++) m_decode_elements[i] = 0; @@ -167,7 +167,7 @@ void DecodeTree::setGenTraceElemOutI(ITrcGenElemIn *i_gen_trace_elem) } }
-ocsd_err_t DecodeTree::createMemAccMapper(memacc_mapper_t type) +ocsd_err_t DecodeTree::createMemAccMapper(memacc_mapper_t type /* = MEMACC_MAP_GLOBAL*/ ) { // clean up any old one destroyMemAccMapper(); @@ -184,6 +184,7 @@ ocsd_err_t DecodeTree::createMemAccMapper(memacc_mapper_t type) // set the access interface if(m_default_mapper) {
}m_created_mapper = true; setMemAccessI(m_default_mapper); m_default_mapper->setErrorLog(s_i_error_logger);
@@ -191,48 +192,160 @@ ocsd_err_t DecodeTree::createMemAccMapper(memacc_mapper_t type) return (m_default_mapper != 0) ? OCSD_OK : OCSD_ERR_MEM; }
-ocsd_err_t DecodeTree::addMemAccessorToMap(TrcMemAccessorBase *p_accessor, const uint8_t cs_trace_id) +void DecodeTree::setExternMemAccMapper(TrcMemAccMapper* pMapper) {
- ocsd_err_t err= OCSD_ERR_NOT_INIT;
- if(m_default_mapper)
err = m_default_mapper->AddAccessor(p_accessor,cs_trace_id);
- return err;
- destroyMemAccMapper(); // destroy any existing mapper - if decode tree created it.
- m_default_mapper = pMapper;
}
void DecodeTree::destroyMemAccMapper() {
- if(m_default_mapper)
- if(m_default_mapper && m_created_mapper) { m_default_mapper->RemoveAllAccessors(); delete m_default_mapper; m_default_mapper = 0;
}m_created_mapper = false;
}
-ocsd_err_t DecodeTree::removeMemAccessor(TrcMemAccessorBase *p_accessor) +void DecodeTree::logMappedRanges() {
- ocsd_err_t err= OCSD_ERR_NOT_INIT; if(m_default_mapper)
m_default_mapper->logMappedRanges();
+}
+/* Memory accessor creation - all on default mem accessor using the 0 CSID for global core space. */ +ocsd_err_t DecodeTree::addBufferMemAcc(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t *p_mem_buffer, const uint32_t mem_length) +{
- if(!hasMemAccMapper())
return OCSD_ERR_NOT_INIT;
- // need a valid memory buffer, and a least enough bytes for one opcode.
- if((p_mem_buffer == 0) || (mem_length < 4))
return OCSD_ERR_INVALID_PARAM_VAL;
- TrcMemAccessorBase *p_accessor;
- ocsd_err_t err = TrcMemAccFactory::CreateBufferAccessor(&p_accessor, address, p_mem_buffer, mem_length);
- if(err == OCSD_OK) {
err = m_default_mapper->RemoveAccessor(p_accessor);
TrcMemAccBufPtr *pMBuffAcc = dynamic_cast<TrcMemAccBufPtr *>(p_accessor);
if(pMBuffAcc)
{
pMBuffAcc->setMemSpace(mem_space);
err = m_default_mapper->AddAccessor(p_accessor,0);
}
else
err = OCSD_ERR_MEM; // wrong type of object - treat as mem error
if(err != OCSD_OK)
} return err;TrcMemAccFactory::DestroyAccessor(p_accessor);
}
-ocsd_err_t DecodeTree::removeMemAccessorByAddress(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const uint8_t cs_trace_id) +ocsd_err_t DecodeTree::addBinFileMemAcc(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space, const std::string &filepath) {
- ocsd_err_t err= OCSD_ERR_NOT_INIT;
- if(m_default_mapper)
- if(!hasMemAccMapper())
return OCSD_ERR_NOT_INIT;
- if(filepath.length() == 0)
return OCSD_ERR_INVALID_PARAM_VAL;
- TrcMemAccessorBase *p_accessor;
- ocsd_err_t err = TrcMemAccFactory::CreateFileAccessor(&p_accessor,filepath,address);
- if(err == OCSD_OK) {
err = m_default_mapper->RemoveAccessorByAddress(address,mem_space,cs_trace_id);
TrcMemAccessorFile *pAcc = dynamic_cast<TrcMemAccessorFile *>(p_accessor);
if(pAcc)
{
pAcc->setMemSpace(mem_space);
err = m_default_mapper->AddAccessor(pAcc,0);
}
else
err = OCSD_ERR_MEM; // wrong type of object - treat as mem error
if(err != OCSD_OK)
} return err;TrcMemAccFactory::DestroyAccessor(p_accessor);
}
-void DecodeTree::logMappedRanges() +ocsd_err_t DecodeTree::addBinFileRegionMemAcc(const ocsd_file_mem_region_t *region_array, const int num_regions, const ocsd_mem_space_acc_t mem_space, const std::string &filepath) {
- if(m_default_mapper)
m_default_mapper->logMappedRanges();
- if(!hasMemAccMapper())
return OCSD_ERR_NOT_INIT;
- if((region_array == 0) || (num_regions == 0) || (filepath.length() == 0))
return OCSD_ERR_INVALID_PARAM_VAL;
- TrcMemAccessorBase *p_accessor;
- int curr_region_idx = 0;
- // add first region during the creation of the file accessor.
- ocsd_err_t err = TrcMemAccFactory::CreateFileAccessor(&p_accessor,filepath,region_array[curr_region_idx].start_address,region_array[curr_region_idx].file_offset, region_array[curr_region_idx].region_size);
- if(err == OCSD_OK)
- {
TrcMemAccessorFile *pAcc = dynamic_cast<TrcMemAccessorFile *>(p_accessor);
if(pAcc)
{
// add additional regions to the file accessor.
curr_region_idx++;
while(curr_region_idx < num_regions)
{
pAcc->AddOffsetRange(region_array[curr_region_idx].start_address,
region_array[curr_region_idx].region_size,
region_array[curr_region_idx].file_offset);
curr_region_idx++;
}
pAcc->setMemSpace(mem_space);
// add the accessor to the map.
err = m_default_mapper->AddAccessor(pAcc,0);
}
else
err = OCSD_ERR_MEM; // wrong type of object - treat as mem error
if(err != OCSD_OK)
TrcMemAccFactory::DestroyAccessor(p_accessor);
- }
- return err;
+}
+ocsd_err_t DecodeTree::addCallbackMemAcc(const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address, const ocsd_mem_space_acc_t mem_space, Fn_MemAcc_CB p_cb_func, const void *p_context) +{
- if(!hasMemAccMapper())
return OCSD_ERR_NOT_INIT;
- if(p_cb_func == 0)
return OCSD_ERR_INVALID_PARAM_VAL;
- TrcMemAccessorBase *p_accessor;
- ocsd_err_t err = TrcMemAccFactory::CreateCBAccessor(&p_accessor, st_address, en_address, mem_space);
- if(err == OCSD_OK)
- {
TrcMemAccCB *pCBAcc = dynamic_cast<TrcMemAccCB *>(p_accessor);
if(pCBAcc)
{
pCBAcc->setCBIfFn(p_cb_func, p_context);
err = m_default_mapper->AddAccessor(p_accessor,0);
}
else
err = OCSD_ERR_MEM; // wrong type of object - treat as mem error
if(err != OCSD_OK)
TrcMemAccFactory::DestroyAccessor(p_accessor);
- }
- return err;
+}
+ocsd_err_t DecodeTree::removeMemAccByAddress(const ocsd_vaddr_t address, const ocsd_mem_space_acc_t mem_space) +{
- if(!hasMemAccMapper())
return OCSD_ERR_NOT_INIT;
- return m_default_mapper->RemoveAccessorByAddress(address,mem_space,0);
}
ocsd_err_t DecodeTree::createDecoder(const std::string &decoderName, const int createFlags, const CSConfig *pConfig) diff --git a/decoder/tests/snapshot_parser_lib/source/ss_to_dcdtree.cpp b/decoder/tests/snapshot_parser_lib/source/ss_to_dcdtree.cpp index 9c6c55b..00e1173 100644 --- a/decoder/tests/snapshot_parser_lib/source/ss_to_dcdtree.cpp +++ b/decoder/tests/snapshot_parser_lib/source/ss_to_dcdtree.cpp @@ -509,16 +509,9 @@ void CreateDcdTreeFromSnapShot::processDumpfiles(std::vectorParser::DumpDef &d dumpFilePathName = m_pReader->getSnapShotDir() + it->path; if(!TrcMemAccessorFile::isExistingFileAccessor(dumpFilePathName)) {
TrcMemAccessorBase *p_acc;
// not already a file accessor on this tree (n.b. assume only one tree in use)
ocsd_err_t err = TrcMemAccFactory::CreateFileAccessor(&p_acc, dumpFilePathName,it->address);
if(err == OCSD_OK)
{
err = m_pDecodeTree->addMemAccessorToMap(p_acc,0);
}
else
{
ocsd_err_t err = m_pDecodeTree->addBinFileMemAcc(it->address,OCSD_MEM_SPACE_ANY,dumpFilePathName);
if(err != OCSD_OK)
{ std::ostringstream oss; oss << "Failed to create memory accessor for file " << dumpFilePathName << "."; LogError(ocsdError(OCSD_ERR_SEV_ERROR,err,oss.str()));
diff --git a/decoder/tests/source/c_api_pkt_print_test.c b/decoder/tests/source/c_api_pkt_print_test.c index 138df1a..5448331 100644 --- a/decoder/tests/source/c_api_pkt_print_test.c +++ b/decoder/tests/source/c_api_pkt_print_test.c @@ -255,7 +255,7 @@ static ocsd_err_t create_test_memory_acc(dcd_tree_handle_t handle) int i = 0;
/* region list to test multi region memory file API */
- file_mem_region_t region_list[4];
ocsd_file_mem_region_t region_list[4];
/* path to the file containing the memory image traced - raw binary data in the snapshot */ strcpy(mem_file_path,default_path_to_snapshot);
-- 2.7.4
CoreSight mailing list CoreSight@lists.linaro.org https://lists.linaro.org/mailman/listinfo/coresight