Hi All,
I am seeing this bug in STM decoder. Where STM decoder is going into an infinite loop and never comes out of it.
I have pasted the debug patch and log excerpts for your reference. Read "*Bug Description*" from Step-1 to Step-6 for detailed explanation. Please help me with a fix.
*Debug Patch:--------------------------------------*diff --git a/decoder/source/stm/trc_pkt_proc_stm.cpp b/decoder/source/stm/trc_pkt_proc_stm.cpp index b39a053..3bc754f 100644 --- a/decoder/source/stm/trc_pkt_proc_stm.cpp +++ b/decoder/source/stm/trc_pkt_proc_stm.cpp @@ -81,7 +81,10 @@ ocsd_datapath_resp_t TrcPktProcStm::processData( const ocsd_trc_index_t index, m_p_data_in = pDataBlock; m_data_in_size = dataBlockSize; m_data_in_used = 0; - + + printf("while-entry (m_data_in_used[%d] < m_data_in_size[%d]) || m_nibble_2nd_valid[%d] || (m_proc_state[%d] == SEND_PKT)\n", + m_data_in_used,m_data_in_size,m_nibble_2nd_valid,m_proc_state); + // while there is data and a continue response on the data path while( dataToProcess() && OCSD_DATA_RESP_IS_CONT(resp) ) { @@ -141,6 +144,8 @@ ocsd_datapath_resp_t TrcPktProcStm::processData( const ocsd_trc_index_t index, fatal.setMessage("Unknown System Error decoding trace."); LogError(fatal); } +
*+ /*** Bug Description Step-4: m_data_in_used = 12 < m_data_in_size = 14, exit condition does not satisfy in processData(). + Control enters into waitForSync() again ***/*+ + printf("while-exit (m_data_in_used[%d] < m_data_in_size[%d]) || m_nibble_2nd_valid[%d] || (m_proc_state[%d] == SEND_PKT)\n", + m_data_in_used,m_data_in_size,m_nibble_2nd_valid,m_proc_state); }
*numBytesProcessed = m_data_in_used; @@ -249,9 +254,12 @@ void TrcPktProcStm::waitForSync(const ocsd_trc_index_t blk_st_index)
m_bWaitSyncSaveSuppressed = true; // no need to save bytes until we want to send data.
*+ /*** Bug Description Step-1: m_data_in_used = 0 and m_data_in_size = 14 for first time entry. ***/+ /*** Bug Description Step-5: m_data_in_used = 12 and m_data_in_size = 14 for second time entry.+ But m_is_sync = TRUE, control does not enter into while loop . readNibble() is not called. ***/*+ + printf("(bGotData[%d] && !m_is_sync[%d])\n", bGotData, m_is_sync); while(bGotData && !m_is_sync) { bGotData = readNibble(); // read until we have a sync or run out of data +
*+ /*** Bug Description Step-2: m_data_in_used = 12 and m_is_sync = TRUE, when we have found sync packet. ***/*+ + printf("m_data_in_used[%d], m_nibble_2nd_valid[%d], m_num_nibbles[%d], m_is_sync[%d]\n", + m_data_in_used, m_nibble_2nd_valid, m_num_nibbles, m_is_sync); }
m_bWaitSyncSaveSuppressed = false; @@ -272,7 +280,7 @@ void TrcPktProcStm::waitForSync(const ocsd_trc_index_t blk_st_index) { // for a), b), c) send the none sync data then re-enter // if out of data, or sync with some previous data, this is sent as unsynced. - +
*+ /*** Bug Description Step-3: m_data_in_used = 12 and m_data_in_size = 14 NOTSYNC packet sent ***/+ /*** Bug Description Step-6: step 3 to 6 creates an infinite loop. ***/*+ + printf("(!bGotData[%d] || m_num_nibbles[%d] > 22)\n", bGotData, m_num_nibbles); m_curr_packet.setPacketType(STM_PKT_NOTSYNC,false); if(mon_in_use.usingMonitor()) {
*Log With Debug Patch:------------------------------------------*while-entry (m_data_in_used[0] < m_data_in_size[14]) || m_nibble_2nd_valid[0] || (m_proc_state[0] == SEND_PKT) (bGotData[1] && !m_is_sync[0]) m_data_in_used[1], m_nibble_2nd_valid[1], m_num_nibbles[1], m_is_sync[0] m_data_in_used[1], m_nibble_2nd_valid[0], m_num_nibbles[2], m_is_sync[0] m_data_in_used[2], m_nibble_2nd_valid[1], m_num_nibbles[3], m_is_sync[0] m_data_in_used[2], m_nibble_2nd_valid[0], m_num_nibbles[4], m_is_sync[0] m_data_in_used[3], m_nibble_2nd_valid[1], m_num_nibbles[5], m_is_sync[0] m_data_in_used[3], m_nibble_2nd_valid[0], m_num_nibbles[6], m_is_sync[0] m_data_in_used[4], m_nibble_2nd_valid[1], m_num_nibbles[7], m_is_sync[0] m_data_in_used[4], m_nibble_2nd_valid[0], m_num_nibbles[8], m_is_sync[0] m_data_in_used[5], m_nibble_2nd_valid[1], m_num_nibbles[9], m_is_sync[0] m_data_in_used[5], m_nibble_2nd_valid[0], m_num_nibbles[10], m_is_sync[0] m_data_in_used[6], m_nibble_2nd_valid[1], m_num_nibbles[11], m_is_sync[0] m_data_in_used[6], m_nibble_2nd_valid[0], m_num_nibbles[12], m_is_sync[0] m_data_in_used[7], m_nibble_2nd_valid[1], m_num_nibbles[13], m_is_sync[0] m_data_in_used[7], m_nibble_2nd_valid[0], m_num_nibbles[14], m_is_sync[0] m_data_in_used[8], m_nibble_2nd_valid[1], m_num_nibbles[15], m_is_sync[0] m_data_in_used[8], m_nibble_2nd_valid[0], m_num_nibbles[16], m_is_sync[0] m_data_in_used[9], m_nibble_2nd_valid[1], m_num_nibbles[17], m_is_sync[0] m_data_in_used[9], m_nibble_2nd_valid[0], m_num_nibbles[18], m_is_sync[0] m_data_in_used[10], m_nibble_2nd_valid[1], m_num_nibbles[19], m_is_sync[0] m_data_in_used[10], m_nibble_2nd_valid[0], m_num_nibbles[20], m_is_sync[0] m_data_in_used[11], m_nibble_2nd_valid[1], m_num_nibbles[21], m_is_sync[0] m_data_in_used[11], m_nibble_2nd_valid[0], m_num_nibbles[22], m_is_sync[0] m_data_in_used[12], m_nibble_2nd_valid[1], m_num_nibbles[23], m_is_sync[0] m_data_in_used[12], m_nibble_2nd_valid[0], m_num_nibbles[24], m_is_sync[1] (!bGotData[1] || m_num_nibbles[24] > 22) while-exit (m_data_in_used[12] < m_data_in_size[14]) || m_nibble_2nd_valid[0] || (m_proc_state[3] == SEND_PKT) Idx:0;[ 0xF1 ];NOTSYNC:STM not synchronised while-exit (m_data_in_used[12] < m_data_in_size[14]) || m_nibble_2nd_valid[0] || (m_proc_state[0] == SEND_PKT) (bGotData[1] && !m_is_sync[1]) (!bGotData[1] || m_num_nibbles[23] > 22) while-exit (m_data_in_used[12] < m_data_in_size[14]) || m_nibble_2nd_valid[0] || (m_proc_state[3] == SEND_PKT) Idx:12;[ 0x0F ];NOTSYNC:STM not synchronised while-exit (m_data_in_used[12] < m_data_in_size[14]) || m_nibble_2nd_valid[0] || (m_proc_state[0] == SEND_PKT) (bGotData[1] && !m_is_sync[1]) (!bGotData[1] || m_num_nibbles[23] > 22) while-exit (m_data_in_used[12] < m_data_in_size[14]) || m_nibble_2nd_valid[0] || (m_proc_state[3] == SEND_PKT) Idx:12;[ 0x0F ];NOTSYNC:STM not synchronised while-exit (m_data_in_used[12] < m_data_in_size[14]) || m_nibble_2nd_valid[0] || (m_proc_state[0] == SEND_PKT) (bGotData[1] && !m_is_sync[1]) (!bGotData[1] || m_num_nibbles[23] > 22) while-exit (m_data_in_used[12] < m_data_in_size[14]) || m_nibble_2nd_valid[0] || (m_proc_state[3] == SEND_PKT) Idx:12;[ 0x0F ];NOTSYNC:STM not synchronised while-exit (m_data_in_used[12] < m_data_in_size[14]) || m_nibble_2nd_valid[0] || (m_proc_state[0] == SEND_PKT) (bGotData[1] && !m_is_sync[1]) (!bGotData[1] || m_num_nibbles[23] > 22) while-exit (m_data_in_used[12] < m_data_in_size[14]) || m_nibble_2nd_valid[0] || (m_proc_state[3] == SEND_PKT) Idx:12;[ 0x0F ];NOTSYNC:STM not synchronised while-exit (m_data_in_used[12] < m_data_in_size[14]) || m_nibble_2nd_valid[0] || (m_proc_state[0] == SEND_PKT) (bGotData[1] && !m_is_sync[1]) (!bGotData[1] || m_num_nibbles[23] > 22)
Thank alot for your support, Subhasish