tests: ete: add option to test I_SRC_ADDR packet range split
Adds command line option to trc_pkt_lister to allow I_SRC_ADDR packets to
emit multiple trace ranges for skipped N atoms.
Signed-off-by: Mike Leach <mike.leach@linaro.org>
diff --git a/decoder/tests/snapshot_parser_lib/include/ss_to_dcdtree.h b/decoder/tests/snapshot_parser_lib/include/ss_to_dcdtree.h
index fde4441..3c85f9d 100644
--- a/decoder/tests/snapshot_parser_lib/include/ss_to_dcdtree.h
+++ b/decoder/tests/snapshot_parser_lib/include/ss_to_dcdtree.h
@@ -52,7 +52,7 @@
void initialise(SnapShotReader *m_pReader, ITraceErrorLog *m_pErrLogInterface);
- bool createDecodeTree(const std::string &SourceBufferName, bool bPacketProcOnly);
+ bool createDecodeTree(const std::string &SourceBufferName, bool bPacketProcOnly, uint32_t add_create_flags = 0);
void destroyDecodeTree();
DecodeTree *getDecodeTree() const { return m_pDecodeTree; };
const char *getBufferFileName() const { return m_BufferFileName.c_str(); };
@@ -92,7 +92,7 @@
void processDumpfiles(std::vector<Parser::DumpDef> &dumps);
-
+ uint32_t m_add_create_flags;
bool m_bInit;
DecodeTree *m_pDecodeTree;
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 a7983e5..902ce56 100644
--- a/decoder/tests/snapshot_parser_lib/source/ss_to_dcdtree.cpp
+++ b/decoder/tests/snapshot_parser_lib/source/ss_to_dcdtree.cpp
@@ -45,6 +45,7 @@
m_BufferFileName("")
{
m_errlog_handle = 0;
+ m_add_create_flags = 0;
}
CreateDcdTreeFromSnapShot::~CreateDcdTreeFromSnapShot()
@@ -63,8 +64,9 @@
}
}
-bool CreateDcdTreeFromSnapShot::createDecodeTree(const std::string &SourceName, bool bPacketProcOnly)
+bool CreateDcdTreeFromSnapShot::createDecodeTree(const std::string &SourceName, bool bPacketProcOnly, uint32_t add_create_flags)
{
+ m_add_create_flags = add_create_flags;
if(m_bInit)
{
if(!m_pReader->snapshotReadOK())
@@ -281,7 +283,7 @@
EtmV4Config configObj(&config);
const char *decoderName = bDataChannel ? OCSD_BUILTIN_DCD_ETMV4D : OCSD_BUILTIN_DCD_ETMV4I;
- err = m_pDecodeTree->createDecoder(decoderName, m_bPacketProcOnly ? OCSD_CREATE_FLG_PACKET_PROC : OCSD_CREATE_FLG_FULL_DECODER,&configObj);
+ err = m_pDecodeTree->createDecoder(decoderName, m_add_create_flags | (m_bPacketProcOnly ? OCSD_CREATE_FLG_PACKET_PROC : OCSD_CREATE_FLG_FULL_DECODER),&configObj);
if(err == OCSD_OK)
createdDecoder = true;
@@ -328,7 +330,7 @@
ETEConfig configObj(&config);
const char *decoderName = OCSD_BUILTIN_DCD_ETE;
- err = m_pDecodeTree->createDecoder(decoderName, m_bPacketProcOnly ? OCSD_CREATE_FLG_PACKET_PROC : OCSD_CREATE_FLG_FULL_DECODER, &configObj);
+ err = m_pDecodeTree->createDecoder(decoderName, m_add_create_flags | (m_bPacketProcOnly ? OCSD_CREATE_FLG_PACKET_PROC : OCSD_CREATE_FLG_FULL_DECODER), &configObj);
if (err == OCSD_OK)
createdDecoder = true;
diff --git a/decoder/tests/source/trc_pkt_lister.cpp b/decoder/tests/source/trc_pkt_lister.cpp
index d3f4588..9a1705b 100644
--- a/decoder/tests/source/trc_pkt_lister.cpp
+++ b/decoder/tests/source/trc_pkt_lister.cpp
@@ -73,6 +73,7 @@
static bool dstream_format = false;
static bool tpiu_format = false;
static bool has_hsync = false;
+static bool src_addr_n = false;
int main(int argc, char* argv[])
{
@@ -193,6 +194,7 @@
oss << "-o_raw_packed Output raw packed trace frames\n";
oss << "-o_raw_unpacked Output raw unpacked trace data per ID\n";
oss << "-test_waits <N> Force wait from packet printer for N packets - test the wait/flush mechanisms for the decoder\n";
+ oss << "-src_addr_n Split source address ranges on N atoms";
oss << "\nOutput:\n";
oss << " Setting any of these options cancels the default output to file & stdout,\n using _only_ the options supplied.\n\n";
oss << "-logstdout Output to stdout -> console.\n";
@@ -390,6 +392,10 @@
no_undecoded_packets = true;
decode = true;
}
+ else if (strcmp(argv[optIdx], "-src_addr_n") == 0)
+ {
+ src_addr_n = true;
+ }
else if((strcmp(argv[optIdx], "-help") == 0) || (strcmp(argv[optIdx], "--help") == 0) || (strcmp(argv[optIdx], "-h") == 0))
{
print_help();
@@ -536,7 +542,7 @@
tree_creator.initialise(&reader, &err_logger);
- if(tree_creator.createDecodeTree(trace_buffer_name, (decode == false)))
+ if(tree_creator.createDecodeTree(trace_buffer_name, (decode == false), src_addr_n ? ETE_OPFLG_PKTDEC_SRCADDR_N_ATOMS : 0))
{
DecodeTree *dcd_tree = tree_creator.getDecodeTree();
dcd_tree->setAlternateErrorLogger(&err_logger);