aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Leach <mike.leach@linaro.org>2018-04-24 11:31:13 +0100
committerMike Leach <mike.leach@linaro.org>2018-05-17 16:14:06 +0100
commit4f7a4a75f7e583cd7005d0d8457e3cef19e01292 (patch)
tree8b3538e7baccfb6db1ccf1c834b6b7a468e24d7e
parent864d52537d441447a25e282459e1ae2557e7bd5f (diff)
opencsd: Add instruction count for range
Decoder will now count the number of instructions processed to create an instruction range packet. This is to cover the case in T32 where the number of instructions cannot be calculated from (end_addr - st_addr / 4). Signed-off-by: Mike Leach <mike.leach@linaro.org>
-rw-r--r--decoder/include/common/trc_gen_elem.h5
-rw-r--r--decoder/include/opencsd/trc_gen_elem_types.h3
-rw-r--r--decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp4
-rw-r--r--decoder/source/ptm/trc_pkt_decode_ptm.cpp2
-rw-r--r--decoder/source/trc_gen_elem.cpp1
5 files changed, 11 insertions, 4 deletions
diff --git a/decoder/include/common/trc_gen_elem.h b/decoder/include/common/trc_gen_elem.h
index 00081b556904..813992999c30 100644
--- a/decoder/include/common/trc_gen_elem.h
+++ b/decoder/include/common/trc_gen_elem.h
@@ -73,7 +73,7 @@ public:
void setTraceOnReason(const trace_on_reason_t reason);
- void setAddrRange(const ocsd_vaddr_t st_addr, const ocsd_vaddr_t en_addr);
+ void setAddrRange(const ocsd_vaddr_t st_addr, const ocsd_vaddr_t en_addr, const int num_instr = 1);
void setLastInstrInfo(const bool exec, const ocsd_instr_type last_i_type, const ocsd_instr_subtype last_i_subtype);
void setAddrStart(const ocsd_vaddr_t st_addr) { this->st_addr = st_addr; };
@@ -122,10 +122,11 @@ inline void OcsdTraceElement::setEvent(const event_t ev_type, const uint16_t num
trace_event.ev_number = ev_type == EVENT_NUMBERED ? number : 0;
}
-inline void OcsdTraceElement::setAddrRange(const ocsd_vaddr_t st_addr, const ocsd_vaddr_t en_addr)
+inline void OcsdTraceElement::setAddrRange(const ocsd_vaddr_t st_addr, const ocsd_vaddr_t en_addr, const int num_instr /* = 1 */)
{
this->st_addr = st_addr;
this->en_addr = en_addr;
+ this->num_instr_range = num_instr;
}
inline void OcsdTraceElement::setLastInstrInfo(const bool exec, const ocsd_instr_type last_i_type, const ocsd_instr_subtype last_i_subtype)
diff --git a/decoder/include/opencsd/trc_gen_elem_types.h b/decoder/include/opencsd/trc_gen_elem_types.h
index 3766785dbd6d..401aee83a784 100644
--- a/decoder/include/opencsd/trc_gen_elem_types.h
+++ b/decoder/include/opencsd/trc_gen_elem_types.h
@@ -105,7 +105,8 @@ typedef struct _ocsd_generic_trace_elem {
uint32_t exception_number; /**< exception number for exception type packets */
trace_event_t trace_event; /**< Trace event - trigger etc */
trace_on_reason_t trace_on_reason; /**< reason for the trace on packet */
- ocsd_swt_info_t sw_trace_info; /**< software trace packet info */
+ ocsd_swt_info_t sw_trace_info; /**< software trace packet info */
+ uint32_t num_instr_range; /**< number of instructions covered by range packet (for T32 this cannot be calculated from en-st/i_size) */
};
const void *ptr_extended_data; /**< pointer to extended data buffer (data trace, sw trace payload) / custom structure */
diff --git a/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp b/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp
index 4545aed0a53f..d125e4db0299 100644
--- a/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp
+++ b/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp
@@ -1036,6 +1036,7 @@ ocsd_err_t TrcPktDecodeEtmV4I::traceInstrToWP(bool &bWPFound, const bool traceTo
ocsd_mem_space_acc_t mem_space = m_is_secure ? OCSD_MEM_SPACE_S : OCSD_MEM_SPACE_N;
m_output_elem.st_addr = m_output_elem.en_addr = m_instr_info.instr_addr;
+ m_output_elem.num_instr_range = 0;
bWPFound = false;
@@ -1057,6 +1058,7 @@ ocsd_err_t TrcPktDecodeEtmV4I::traceInstrToWP(bool &bWPFound, const bool traceTo
// update the range decoded address in the output packet.
m_output_elem.en_addr = m_instr_info.instr_addr;
+ m_output_elem.num_instr_range++;
// either walking to match the next instruction address or a real watchpoint
if(traceToAddrNext)
@@ -1068,7 +1070,7 @@ ocsd_err_t TrcPktDecodeEtmV4I::traceInstrToWP(bool &bWPFound, const bool traceTo
{
// not enough memory accessible.
m_mem_nacc_pending = true;
- m_nacc_addr = m_instr_info.instr_addr;
+ m_nacc_addr = m_instr_info.instr_addr;
}
}
return err;
diff --git a/decoder/source/ptm/trc_pkt_decode_ptm.cpp b/decoder/source/ptm/trc_pkt_decode_ptm.cpp
index aa426889fd52..24faacae2598 100644
--- a/decoder/source/ptm/trc_pkt_decode_ptm.cpp
+++ b/decoder/source/ptm/trc_pkt_decode_ptm.cpp
@@ -612,6 +612,7 @@ ocsd_err_t TrcPktDecodePtm::traceInstrToWP(bool &bWPFound, const waypoint_trace_
ocsd_mem_space_acc_t mem_space = (m_pe_context.security_level == ocsd_sec_secure) ? OCSD_MEM_SPACE_S : OCSD_MEM_SPACE_N;
m_output_elem.st_addr = m_output_elem.en_addr = m_instr_info.instr_addr;
+ m_output_elem.num_instr_range = 0;
bWPFound = false;
@@ -634,6 +635,7 @@ ocsd_err_t TrcPktDecodePtm::traceInstrToWP(bool &bWPFound, const waypoint_trace_
// update the range decoded address in the output packet.
m_output_elem.en_addr = m_instr_info.instr_addr;
+ m_output_elem.num_instr_range++;
m_output_elem.last_i_type = m_instr_info.type;
// either walking to match the next instruction address or a real waypoint
diff --git a/decoder/source/trc_gen_elem.cpp b/decoder/source/trc_gen_elem.cpp
index 8897080ff26e..c4b2ddb3d7ac 100644
--- a/decoder/source/trc_gen_elem.cpp
+++ b/decoder/source/trc_gen_elem.cpp
@@ -105,6 +105,7 @@ void OcsdTraceElement::toString(std::string &str) const
{
case OCSD_GEN_TRC_ELEM_INSTR_RANGE:
oss << "exec range=0x" << std::hex << st_addr << ":[0x" << en_addr << "] ";
+ oss << "num_i(" << std::dec << num_instr_range << ") ";
oss << "(ISA=" << s_isa_str[(int)isa] << ") ";
oss << ((last_instr_exec == 1) ? "E " : "N ");
if((int)last_i_type < T_SIZE)