Initilisation issue was causing a crash in the debug build tests in windows. Generic elements not initialising some parts of the structure - enhanced printing in 0v003 saw out of range in array. Assume linux passed due to zero initialisation of these elements.
Further invesigation showed that the .isa element on the generic output packet not always set in PTM and ETMv4
Signed-off-by: Mike Leach mike.leach@linaro.org --- decoder/include/common/trc_gen_elem.h | 6 ++++++ decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp | 14 ++++++++------ decoder/source/ptm/trc_pkt_decode_ptm.cpp | 7 ++++--- 3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/decoder/include/common/trc_gen_elem.h b/decoder/include/common/trc_gen_elem.h index 4f99c37..300b91b 100644 --- a/decoder/include/common/trc_gen_elem.h +++ b/decoder/include/common/trc_gen_elem.h @@ -148,6 +148,12 @@ inline void OcsdTraceElement::updateType(const ocsd_gen_trc_elem_t type)
inline void OcsdTraceElement::init() { + st_addr = en_addr = (ocsd_vaddr_t)-1; + isa = ocsd_isa_unknown; + + cycle_count = 0; + timestamp = 0; + context.ctxt_id_valid = 0; context.vmid_valid = 0; context.el_valid = 0; diff --git a/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp b/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp index 092f709..78ac7e6 100644 --- a/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp +++ b/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp @@ -883,9 +883,8 @@ ocsd_datapath_resp_t TrcPktDecodeEtmV4I::processAtom(const ocsd_atm_val atom, bo break; } m_output_elem.setType(OCSD_GEN_TRC_ELEM_INSTR_RANGE); - m_output_elem.last_instr_exec = (atom == ATOM_E) ? 1 : 0; - m_output_elem.last_i_type = m_instr_info.type; - m_output_elem.last_i_subtype = m_instr_info.sub_type; + m_output_elem.setLastInstrInfo((atom == ATOM_E),m_instr_info.type, m_instr_info.sub_type); + m_output_elem.setISA(m_instr_info.isa); resp = outputTraceElementIdx(pElem->getRootIndex(),m_output_elem);
} @@ -898,6 +897,8 @@ ocsd_datapath_resp_t TrcPktDecodeEtmV4I::processAtom(const ocsd_atm_val atom, bo { // some trace before we were out of memory access range m_output_elem.setType(OCSD_GEN_TRC_ELEM_INSTR_RANGE); + m_output_elem.setLastInstrInfo(true,m_instr_info.type, m_instr_info.sub_type); + m_output_elem.setISA(m_instr_info.isa); resp = outputTraceElementIdx(pElem->getRootIndex(),m_output_elem); }
@@ -1040,9 +1041,8 @@ ocsd_datapath_resp_t TrcPktDecodeEtmV4I::processException() } } m_output_elem.setType(OCSD_GEN_TRC_ELEM_INSTR_RANGE); - m_output_elem.last_instr_exec = 1; - m_output_elem.last_i_type = m_instr_info.type; - m_output_elem.last_i_subtype = m_instr_info.sub_type; + m_output_elem.setLastInstrInfo(true,m_instr_info.type, m_instr_info.sub_type); + m_output_elem.setISA(m_instr_info.isa); resp = outputTraceElementIdx(m_excep_index, m_output_elem); m_excep_proc = EXCEP_EXCEP; } @@ -1055,6 +1055,8 @@ ocsd_datapath_resp_t TrcPktDecodeEtmV4I::processException() { // some trace before we were out of memory access range m_output_elem.setType(OCSD_GEN_TRC_ELEM_INSTR_RANGE); + m_output_elem.setLastInstrInfo(true,m_instr_info.type, m_instr_info.sub_type); + m_output_elem.setISA(m_instr_info.isa); resp = outputTraceElementIdx(m_excep_index,m_output_elem); }
diff --git a/decoder/source/ptm/trc_pkt_decode_ptm.cpp b/decoder/source/ptm/trc_pkt_decode_ptm.cpp index 2699637..9c5b16d 100644 --- a/decoder/source/ptm/trc_pkt_decode_ptm.cpp +++ b/decoder/source/ptm/trc_pkt_decode_ptm.cpp @@ -531,9 +531,8 @@ ocsd_datapath_resp_t TrcPktDecodePtm::processAtomRange(const ocsd_atm_val A, con }
m_output_elem.setType(OCSD_GEN_TRC_ELEM_INSTR_RANGE); - m_output_elem.last_instr_exec = (A == ATOM_E) ? 1 : 0; - m_output_elem.last_i_type = m_instr_info.type; - m_output_elem.last_i_subtype = m_instr_info.sub_type; + m_output_elem.setLastInstrInfo((A == ATOM_E),m_instr_info.type, m_instr_info.sub_type); + m_output_elem.setISA(m_curr_pe_state.isa); if(m_curr_packet_in->hasCC()) m_output_elem.setCycleCount(m_curr_packet_in->getCCVal()); resp = outputTraceElementIdx(m_index_curr_pkt,m_output_elem); @@ -550,6 +549,8 @@ ocsd_datapath_resp_t TrcPktDecodePtm::processAtomRange(const ocsd_atm_val A, con { // some trace before we were out of memory access range m_output_elem.setType(OCSD_GEN_TRC_ELEM_INSTR_RANGE); + m_output_elem.setLastInstrInfo(true,m_instr_info.type, m_instr_info.sub_type); + m_output_elem.setISA(m_curr_pe_state.isa); resp = outputTraceElementIdx(m_index_curr_pkt,m_output_elem); } }