Upgrade OpenCSD to v0.14.1 am: a343e5d4d7 am: 5d94748063 am: af481213e0 am: d318465aa6
Change-Id: Iec4e6745577c6c27205c97f0f2c92ba9460366ee
diff --git a/METADATA b/METADATA
index 266e52a..7f44ac2 100644
--- a/METADATA
+++ b/METADATA
@@ -9,11 +9,11 @@
type: GIT
value: "https://github.com/Linaro/OpenCSD.git"
}
- version: "v0.14.0"
+ version: "v0.14.1"
license_type: RESTRICTED
last_upgrade_date {
year: 2020
- month: 3
- day: 30
+ month: 4
+ day: 27
}
}
diff --git a/README.md b/README.md
index 6805eac..c557523 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@
CoreSight Trace Component Support.
----------------------------------
-_Current Version 0.14.0_
+_Current Version 0.14.1_
### Current support:
@@ -141,51 +141,68 @@
AutoFDO: update documentation for AutoFDO usage and add in "record.sh" script
- _Version 0.9.3_: Bugfix: Test snapshot library not handling 'offset' parameters in dump file sections.
Install: ocsd_if_version.h moved to opencsd/include to allow installation on OS & use in compiling client apps.
-- _Version 0.10.0_: __Updates__: Add additional information about the last instruction to the generic output packet.
- __Docs__: update docs for updated output packet.
- __Bugfix__: typecast removed from OCSD_VER_NUM in ocsd_if_version.h to allow use in C pre-processor.
- __Bugfix__: ETMV4: Interworking ISA change between A32-T32 occasionally missed during instruction decode.
-- _Version 0.10.1_: __Updates__: Build update - allow multi-thread make (make -j<N>).
- __Docs__: Minor update to AutoFDO documentation.
-- _Version 0.11.0_: __Update__: ETM v4 decoder updated to support ETM version up to v4.4
- __Update__: Memory access callback function - added new callback signature to provide TraceID to client when requesting memory.
- __Update__: Created new example program to demonstrate using memory buffer in APIs.
- __Bugfix__: Typos in docs and source.
- __Bugfix__: Memory accessor - validate callback return values.
-- _Version 0.11.1_: __Update__: build:- change -fpic to -fPIC to allow Debian build on sparc.
- __Bugfix__: build:- remove unused variable
-- _Version 0.11.2_: __Update__: docs:- HOWTO.md update to match new perf build requirements.
- __Bugfix__: Minor spelling typos fixed.
-- _Version 0.12.0_: __Update__: Frame deformatter - TPIU FSYNC and HSYNC support added.
- __Update__: ETM v4: Bugfix & clarification on Exception trace handling. Where exception occurs at a branch target before any instructions
- have been executed, the preferred return address is also the target address of the branch instruction. This case now includes as specific flag in
- the packet. Additionally any context change associated with this target address was being applied incorrectly.
- __Update__: Core / Architecture mapping to core names as used by test programs / snapshots updated to include additional recent ARM cores.
- __Update__: Docs: Update to reflect new exception flag. Update test program example to reflect latest output.
- __Bugfix__: ETM v4: Valid trace info packet was not handled correctly (0x01, 0x00).
- __Bugfix__: ETM v4: Error messaging on commit stack overflow.
-- _Version 0.12.1_: __Update__: build: remove -g option from release build.
- __Update__: tests: Snapshots can now use generic arch+profile names rather than core names, e.g. ARMv8-A
- __Bugfix__: Instruction decode - v8.3 B[L]A{A|B}[Z] instructions mis-identified.
- __Bugfix__: Transition from A64 to A32 can be mis-decoded if the trace implementation represents the transition
- as an individual address packet followed by a context packet.
-- _Version 0.12.2_: __Bugfix__: Clean up memory leaks.
- __Bugfix__: ETMv4: Ensure addressing history zeroed after TINFO.
- __Update__: Allow GCC version to be included in build output path.
- __Bugfix__: Packet printing update when WFI/WFE is P0 element.
+- _Version 0.10.0_:
+ - __Updates__: Add additional information about the last instruction to the generic output packet.
+ - __Docs__: update docs for updated output packet.
+ - __Bugfix__: typecast removed from OCSD_VER_NUM in ocsd_if_version.h to allow use in C pre-processor.
+ - __Bugfix__: ETMV4: Interworking ISA change between A32-T32 occasionally missed during instruction decode.
+
+- _Version 0.10.1_:
+ - __Updates__: Build update - allow multi-thread make (make -j<N>).
+ - __Docs__: Minor update to AutoFDO documentation.
+
+- _Version 0.11.0_:
+ - __Update__: ETM v4 decoder updated to support ETM version up to v4.4
+ - __Update__: Memory access callback function - added new callback signature to provide TraceID to client when requesting memory.
+ - __Update__: Created new example program to demonstrate using memory buffer in APIs.
+ - __Bugfix__: Typos in docs and source.
+ - __Bugfix__: Memory accessor - validate callback return values.
+
+- _Version 0.11.1_:
+ - __Update__: build:- change -fpic to -fPIC to allow Debian build on sparc.
+ - __Bugfix__: build:- remove unused variable
+
+- _Version 0.11.2_:
+ - __Update__: docs:- HOWTO.md update to match new perf build requirements.
+ - __Bugfix__: Minor spelling typos fixed.
+
+- _Version 0.12.0_:
+ - __Update__: Frame deformatter - TPIU FSYNC and HSYNC support added.
+ - __Update__: ETM v4: Bugfix & clarification on Exception trace handling. Where exception occurs at a branch target before any instructions
+ have been executed, the preferred return address is also the target address of the branch instruction. This case now includes as specific flag in
+ the packet. Additionally any context change associated with this target address was being applied incorrectly.
+ - _Update__: Core / Architecture mapping to core names as used by test programs / snapshots updated to include additional recent ARM cores.
+ - __Update__: Docs: Update to reflect new exception flag. Update test program example to reflect latest output.
+ - __Bugfix__: ETM v4: Valid trace info packet was not handled correctly (0x01, 0x00).
+ - __Bugfix__: ETM v4: Error messaging on commit stack overflow.
+
+- _Version 0.12.1_:
+ - __Update__: build: remove -g option from release build.
+ - __Update__: tests: Snapshots can now use generic arch+profile names rather than core names, e.g. ARMv8-A
+ - __Bugfix__: Instruction decode - v8.3 B[L]A{A|B}[Z] instructions mis-identified.
+ -__Bugfix__: Transition from A64 to A32 can be mis-decoded if the trace implementation represents the transition
+ as an individual address packet followed by a context packet.
+
+- _Version 0.12.2_:
+ - __Bugfix__: Clean up memory leaks.
+ - __Bugfix__: ETMv4: Ensure addressing history zeroed after TINFO.
+ - __Update__: Allow GCC version to be included in build output path.
+ - __Bugfix__: Packet printing update when WFI/WFE is P0 element.
- _Version 0.13.x_ : Intermediate development version.
-- _Version 0.14.0_: __Update__: ETMv4 - decoder update & simplification to handle advanced trace features.
- __Update__: ETMv4 - decoder support for speculative trace.
- __Update__: Generic Elements: Additional information in EOT, UNSYNC, ON packets to give reason.
- __Update__: Memaccess: Add EL2 secure memory space flag.
- __Update__: Documentation: Updated for release changes and to reflect latest kernel version support for CoreSight.
- __Update__: Perf helper scripts updated to reflect latest build flow.
- __Bugfix__: Fix for component operational flag inputs.
-
+- _Version 0.14.0_:
+ - __Update__: ETMv4 - decoder update & simplification to handle advanced trace features.
+ - __Update__: ETMv4 - decoder support for speculative trace.
+ - __Update__: Generic Elements: Additional information in EOT, UNSYNC, ON packets to give reason.
+ - __Update__: Memaccess: Add EL2 secure memory space flag.
+ - __Update__: Documentation: Updated for release changes and to reflect latest kernel version support for CoreSight.
+ - __Update__: Perf helper scripts updated to reflect latest build flow.
+ - __Bugfix__: Fix for component operational flag inputs.
-
+- _Version 0.14.1_:
+ - __Update__: ETMv4 - Add support for Q elements.
+ - __Bugfix__: build: fix logic issue for && operator. (github issue #23, sumitted by yabinc)
Licence Information
diff --git a/decoder/build/linux/makefile b/decoder/build/linux/makefile
index 9edf328..659cf68 100644
--- a/decoder/build/linux/makefile
+++ b/decoder/build/linux/makefile
@@ -70,8 +70,8 @@
export INSTALL_INCLUDE_DIR=$(PREFIX)/include/
# compile flags
-CFLAGS += $(CPPFLAGS) -c -Wall -DLINUX -Wno-switch -fPIC
-CXXFLAGS += $(CPPFLAGS) -c -Wall -DLINUX -Wno-switch -fPIC -std=c++11
+CFLAGS += $(CPPFLAGS) -c -Wall -DLINUX -Wno-switch -Wlogical-op -fPIC
+CXXFLAGS += $(CPPFLAGS) -c -Wall -DLINUX -Wno-switch -Wlogical-op -fPIC -std=c++11
LDFLAGS += -Wl,-z,defs
ARFLAGS ?= rcs
diff --git a/decoder/docs/doxygen_config.dox b/decoder/docs/doxygen_config.dox
index b60bbb8..101c59e 100644
--- a/decoder/docs/doxygen_config.dox
+++ b/decoder/docs/doxygen_config.dox
@@ -38,7 +38,7 @@
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = 0.14.0
+PROJECT_NUMBER = 0.14.1
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
diff --git a/decoder/docs/prog_guide/prog_guide_generic_pkts.md b/decoder/docs/prog_guide/prog_guide_generic_pkts.md
index 9f69aac..e4d50b7 100644
--- a/decoder/docs/prog_guide/prog_guide_generic_pkts.md
+++ b/decoder/docs/prog_guide/prog_guide_generic_pkts.md
@@ -83,7 +83,7 @@
trace_on_reason_t trace_on_reason; /* reason for the trace on packet */
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) */
-
+ unsync_info_t unsync_eot_info; /* additional information for unsync / end-of-trace packets. */
};
const void *ptr_extended_data; /* pointer to extended data buffer (data trace, sw trace payload) / custom structure */
@@ -142,6 +142,19 @@
the trace range. In this case `has_cc` will be 1 and `cycle_count` will be valid.
+### OCSD_GEN_TRC_ELEM_I_RANGE_NOPATH ###
+__packet fields valid__: `isa, st_addr, en_addr, num_instr_range`
+
+`num_instr_range` represents the number of instructions executed in this range, but there is incomplete information
+as to program execution path from start to end of range.
+If `num_instr` is 0, then an unknown number of instructions were executed between the start and end of the range.
+`st_addr` represents the start of execution represented by this packet.
+`en_addr` represents the address where execution will continue from after the instructions represented by this packet.
+`isa` represents the ISA for the instruction at `en_addr`.
+
+Used when ETMv4 Q elements are being traced.
+
+
### OCSD_GEN_TRC_ELEM_ADDR_NACC ###
__packet fields valid__: `st_addr`
diff --git a/decoder/include/opencsd/etmv4/trc_pkt_decode_etmv4i.h b/decoder/include/opencsd/etmv4/trc_pkt_decode_etmv4i.h
index c85bf48..826554e 100644
--- a/decoder/include/opencsd/etmv4/trc_pkt_decode_etmv4i.h
+++ b/decoder/include/opencsd/etmv4/trc_pkt_decode_etmv4i.h
@@ -85,6 +85,9 @@
// process an exception element - output instruction trace + exception generic type.
ocsd_err_t processException();
+ // process Q element
+ ocsd_err_t processQElement();
+
// process an element that cannot be cancelled / discarded
ocsd_err_t processTS_CC_EventElem(TrcStackElem *pElem);
diff --git a/decoder/include/opencsd/ocsd_if_version.h b/decoder/include/opencsd/ocsd_if_version.h
index ad8d710..609a4e1 100644
--- a/decoder/include/opencsd/ocsd_if_version.h
+++ b/decoder/include/opencsd/ocsd_if_version.h
@@ -44,7 +44,7 @@
@{*/
#define OCSD_VER_MAJOR 0x0 /**< Library Major Version */
#define OCSD_VER_MINOR 0xE /**< Library Minor Version */
-#define OCSD_VER_PATCH 0x0 /**< Library Patch Version */
+#define OCSD_VER_PATCH 0x1 /**< Library Patch Version */
/** Library version number - MMMMnnpp format.
MMMM = major version,
@@ -53,7 +53,7 @@
*/
#define OCSD_VER_NUM ((OCSD_VER_MAJOR << 16) | (OCSD_VER_MINOR << 8) | OCSD_VER_PATCH)
-#define OCSD_VER_STRING "0.14.0" /**< Library Version string */
+#define OCSD_VER_STRING "0.14.1" /**< Library Version string */
#define OCSD_LIB_NAME "OpenCSD Library" /**< Library name string */
#define OCSD_LIB_SHORT_NAME "OCSD" /**< Library Short name string */
/** @}*/
diff --git a/decoder/include/pkt_printers/pkt_printer_t.h b/decoder/include/pkt_printers/pkt_printer_t.h
index 9eb37f4..c00daa1 100644
--- a/decoder/include/pkt_printers/pkt_printer_t.h
+++ b/decoder/include/pkt_printers/pkt_printer_t.h
@@ -102,7 +102,7 @@
if(!m_bRawPrint && (m_last_resp == OCSD_RESP_WAIT))
{
// expect a flush or a complete reset after a wait.
- if((op != OCSD_OP_FLUSH) || (op != OCSD_OP_RESET))
+ if((op != OCSD_OP_FLUSH) && (op != OCSD_OP_RESET))
{
m_oss <<"ID:"<< std::hex << (uint32_t)m_trcID << "\tERROR: FLUSH operation expected after wait on trace decode path\n";
itemPrintLine(m_oss.str());
diff --git a/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp b/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp
index d429f21..393046b 100644
--- a/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp
+++ b/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp
@@ -218,11 +218,6 @@
err = OCSD_ERR_HW_CFG_UNSUPP;
LogError(ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_HW_CFG_UNSUPP,"ETMv4 instruction decode : Trace on conditional non-branch elements not supported."));
}
- else if(m_config->enabledQE())
- {
- err = OCSD_ERR_HW_CFG_UNSUPP;
- LogError(ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_HW_CFG_UNSUPP,"ETMv4 instruction decode : Trace using Q elements not supported."));
- }
return err;
}
@@ -484,9 +479,30 @@
m_elem_res.discard = true;
break;
- /*** presently unsupported packets ***/
- /* Q elemnts */
+ /* Q packets */
case ETM4_PKT_I_Q:
+ {
+ TrcStackQElem *pQElem = m_P0_stack.createQElem(m_curr_packet_in->getType(), m_index_curr_pkt, m_curr_packet_in->Q_pkt.q_count);
+ if (pQElem)
+ {
+ if (m_curr_packet_in->Q_pkt.addr_present)
+ {
+ etmv4_addr_val_t addr;
+
+ addr.val = m_curr_packet_in->getAddrVal();
+ addr.isa = m_curr_packet_in->getAddrIS();
+ pQElem->setAddr(addr);
+ m_curr_spec_depth++;
+ }
+ else
+ m_elem_pending_addr = true;
+ }
+ else
+ bAllocErr = true;
+ }
+ break;
+
+ /*** presently unsupported packets ***/
/* conditional instruction tracing */
case ETM4_PKT_I_COND_FLUSH:
case ETM4_PKT_I_COND_I_F1:
@@ -729,6 +745,11 @@
if (pElem->isP0())
m_elem_res.P0_commit--;
break;
+
+ case P0_Q:
+ err = processQElement();
+ m_elem_res.P0_commit--;
+ break;
}
if(bPopElem)
@@ -794,6 +815,7 @@
case P0_EXCEP:
case P0_EXCEP_RET:
case P0_OVERFLOW:
+ case P0_Q:
m_P0_stack.delete_all();
break;
@@ -1300,6 +1322,137 @@
return err;
}
+ocsd_err_t TrcPktDecodeEtmV4I::processQElement()
+{
+ ocsd_err_t err = OCSD_OK;
+ TrcStackQElem *pQElem;
+ etmv4_addr_val_t QAddr; // address where trace restarts
+ int iCount = 0;
+
+ pQElem = dynamic_cast<TrcStackQElem *>(m_P0_stack.back()); // get the exception element
+ m_P0_stack.pop_back(); // remove the Q element.
+
+ if (!pQElem->hasAddr()) // no address - it must be next on the stack....
+ {
+ TrcStackElemAddr *pAddressElem = 0;
+ TrcStackElemCtxt *pCtxtElem = 0;
+ TrcStackElem *pElem = 0;
+
+ pElem = m_P0_stack.back(); // look at next element.
+ if (pElem->getP0Type() == P0_CTXT)
+ {
+ pCtxtElem = dynamic_cast<TrcStackElemCtxt *>(pElem);
+ m_P0_stack.pop_back(); // remove the context element
+ pElem = m_P0_stack.back(); // next one should be an address element
+ }
+
+ if (pElem->getP0Type() != P0_ADDR)
+ {
+ // no following address element - indicate processing error.
+ err = OCSD_ERR_BAD_PACKET_SEQ;
+ LogError(ocsdError(OCSD_ERR_SEV_ERROR, err, pQElem->getRootIndex(), m_CSID, "Address missing in Q packet."));
+ m_P0_stack.delete_popped();
+ return err;
+ }
+ pAddressElem = dynamic_cast<TrcStackElemAddr *>(pElem);
+ QAddr = pAddressElem->getAddr();
+ m_P0_stack.pop_back(); // remove the address element
+ m_P0_stack.delete_popped(); // clear used elements
+
+ // return the context element for processing next time.
+ if (pCtxtElem)
+ {
+ // need a new copy at the back - old one will be deleted as popped.
+ m_P0_stack.createContextElem(pCtxtElem->getRootPkt(), pCtxtElem->getRootIndex(), pCtxtElem->getContext(),true);
+ }
+ }
+ else
+ QAddr = pQElem->getAddr();
+
+ // process the Q element with address.
+ iCount = pQElem->getInstrCount();
+
+ bool isBranch = false;
+
+ // need to output something - set up an element
+ if ((err = m_out_elem.addElem(pQElem->getRootIndex())))
+ return err;
+
+ instr_range_t addr_range;
+ addr_range.st_addr = addr_range.en_addr = m_instr_info.instr_addr;
+ addr_range.num_instr = 0;
+
+ // walk iCount instructions
+ for (int i = 0; i < iCount; i++)
+ {
+ uint32_t opcode;
+ uint32_t bytesReq = 4;
+
+ err = accessMemory(m_instr_info.instr_addr, getCurrMemSpace(), &bytesReq, (uint8_t *)&opcode);
+ if (err != OCSD_OK) break;
+
+ if (bytesReq == 4) // got data back
+ {
+ m_instr_info.opcode = opcode;
+ err = instrDecode(&m_instr_info);
+ if (err != OCSD_OK) break;
+
+ // increment address - may be adjusted by direct branch value later
+ m_instr_info.instr_addr += m_instr_info.instr_size;
+ addr_range.num_instr++;
+
+ isBranch = (m_instr_info.type == OCSD_INSTR_BR) ||
+ (m_instr_info.type == OCSD_INSTR_BR_INDIRECT);
+
+ // on a branch no way of knowing if taken - bail out
+ if (isBranch)
+ break;
+ }
+ else
+ break; // missing memory
+
+ }
+
+ if (err == OCSD_OK)
+ {
+ bool inCompleteRange = true;
+ if (iCount && (addr_range.num_instr == (unsigned)iCount))
+ {
+ if ((m_instr_info.instr_addr == QAddr.val) || // complete range
+ (isBranch)) // or ends on branch - only way we know if branch taken.
+ {
+ // output a range and continue
+ inCompleteRange = false;
+ // update the range decoded address in the output packet.
+ addr_range.en_addr = m_instr_info.instr_addr;
+ setElemTraceRange(outElem(), addr_range, true, pQElem->getRootIndex());
+ }
+ }
+
+ if (inCompleteRange)
+ {
+ // unknown instructions executed.
+ addr_range.en_addr = QAddr.val;
+ addr_range.num_instr = iCount;
+
+ outElem().setType(OCSD_GEN_TRC_ELEM_I_RANGE_NOPATH);
+ outElem().setAddrRange(addr_range.st_addr, addr_range.en_addr, addr_range.num_instr);
+ outElem().setISA(calcISA(m_is_64bit, QAddr.isa));
+ }
+
+ // after the Q element, tracing resumes at the address supplied
+ SetInstrInfoInAddrISA(QAddr.val, QAddr.isa);
+ m_need_addr = false;
+ }
+ else
+ {
+ // output error and halt decode.
+ LogError(ocsdError(OCSD_ERR_SEV_ERROR, err, pQElem->getRootIndex(), m_CSID, "Error processing Q packet"));
+ }
+ m_P0_stack.delete_popped();
+ return err;
+}
+
void TrcPktDecodeEtmV4I::SetInstrInfoInAddrISA(const ocsd_vaddr_t addr_val, const uint8_t isa)
{
m_instr_info.instr_addr = addr_val;
@@ -1388,7 +1541,7 @@
{
ocsd_err_t err = OCSD_OK;
- if(getComponentOpMode() && OCSD_OPFLG_PKTDEC_ERROR_BAD_PKTS)
+ if(getComponentOpMode() & OCSD_OPFLG_PKTDEC_ERROR_BAD_PKTS)
{
// error out - stop decoding
err = OCSD_ERR_BAD_DECODE_PKT;
diff --git a/decoder/source/etmv4/trc_pkt_elem_etmv4i.cpp b/decoder/source/etmv4/trc_pkt_elem_etmv4i.cpp
index 8ba258a..853fde4 100644
--- a/decoder/source/etmv4/trc_pkt_elem_etmv4i.cpp
+++ b/decoder/source/etmv4/trc_pkt_elem_etmv4i.cpp
@@ -239,8 +239,34 @@
str += oss.str();
}
break;
+
+ case ETM4_PKT_I_Q:
+ {
+ std::ostringstream oss;
+ if (Q_pkt.count_present)
+ {
+ oss << "; Count(" << std::dec << Q_pkt.q_count << ")";
+ str += oss.str();
+ }
+ else
+ str += "; Count(Unknown)";
+
+ if (Q_pkt.addr_match)
+ {
+ addrMatchIdx(valStr);
+ str += "; " + valStr;
+ }
+
+ if (Q_pkt.addr_present || Q_pkt.addr_match)
+ {
+ trcPrintableElem::getValStr(valStr, (v_addr.size == VA_64BIT) ? 64 : 32, v_addr.valid_bits, v_addr.val, true, (v_addr.pkt_bits < 64) ? v_addr.pkt_bits : 0);
+ str += "; Addr=" + valStr;
+ }
+ }
+ break;
}
-}
+
+}
void EtmV4ITrcPacket::toStringFmt(const uint32_t fmtFlags, std::string &str) const
{
diff --git a/decoder/source/etmv4/trc_pkt_proc_etmv4i.cpp b/decoder/source/etmv4/trc_pkt_proc_etmv4i.cpp
index ee05b36..d8c7d84 100644
--- a/decoder/source/etmv4/trc_pkt_proc_etmv4i.cpp
+++ b/decoder/source/etmv4/trc_pkt_proc_etmv4i.cpp
@@ -1072,7 +1072,7 @@
default:
m_curr_packet.err_type = m_curr_packet.type;
m_curr_packet.type = ETM4_PKT_I_BAD_SEQUENCE;
- //SendBadIPacket( PKT_BAD_SEQUENCE, "ERROR: Bad Q packet type", PKT_Q );
+ m_process_state = SEND_PKT;
break;
}
}