aboutsummaryrefslogtreecommitdiff
path: root/decoder/tests/snapshot_parser_lib
diff options
context:
space:
mode:
Diffstat (limited to 'decoder/tests/snapshot_parser_lib')
-rw-r--r--decoder/tests/snapshot_parser_lib/include/snapshot_parser.h6
-rw-r--r--decoder/tests/snapshot_parser_lib/include/snapshot_parser_util.h1
-rw-r--r--decoder/tests/snapshot_parser_lib/include/ss_key_value_names.h4
-rw-r--r--decoder/tests/snapshot_parser_lib/include/ss_to_dcdtree.h5
-rw-r--r--decoder/tests/snapshot_parser_lib/source/snapshot_parser.cpp4
-rw-r--r--decoder/tests/snapshot_parser_lib/source/ss_to_dcdtree.cpp57
6 files changed, 70 insertions, 7 deletions
diff --git a/decoder/tests/snapshot_parser_lib/include/snapshot_parser.h b/decoder/tests/snapshot_parser_lib/include/snapshot_parser.h
index 8b9171255d0c..9e5b37189099 100644
--- a/decoder/tests/snapshot_parser_lib/include/snapshot_parser.h
+++ b/decoder/tests/snapshot_parser_lib/include/snapshot_parser.h
@@ -135,9 +135,9 @@ namespace Parser
std::vector<std::string> GetBufferNameList(ParsedTrace &metadata);
- static ITraceErrorLog *s_pErrorLogger = 0;
- static ocsd_hndl_err_log_t s_errlog_handle = 0;
- static bool s_verbose_logging = true;
+ //static ITraceErrorLog *s_pErrorLogger = 0;
+ //static ocsd_hndl_err_log_t s_errlog_handle = 0;
+ //static bool s_verbose_logging = true;
void SetIErrorLogger(ITraceErrorLog *i_err_log);
void SetVerboseLogging(bool verbose);
diff --git a/decoder/tests/snapshot_parser_lib/include/snapshot_parser_util.h b/decoder/tests/snapshot_parser_lib/include/snapshot_parser_util.h
index 815afe9267d9..d4fd6cd952ad 100644
--- a/decoder/tests/snapshot_parser_lib/include/snapshot_parser_util.h
+++ b/decoder/tests/snapshot_parser_lib/include/snapshot_parser_util.h
@@ -35,6 +35,7 @@
#ifndef ARM_SNAPSHOT_PARSER_UTIL_H_INCLUDED
#define ARM_SNAPSHOT_PARSER_UTIL_H_INCLUDED
+#include <algorithm>
#include <string>
#include <sstream>
#include <iomanip>
diff --git a/decoder/tests/snapshot_parser_lib/include/ss_key_value_names.h b/decoder/tests/snapshot_parser_lib/include/ss_key_value_names.h
index 6e3a301dae50..ad0823b556a0 100644
--- a/decoder/tests/snapshot_parser_lib/include/ss_key_value_names.h
+++ b/decoder/tests/snapshot_parser_lib/include/ss_key_value_names.h
@@ -58,6 +58,10 @@ const char * const ETMv4RegIDR11("TRCIDR11");
const char * const ETMv4RegIDR12("TRCIDR12");
const char * const ETMv4RegIDR13("TRCIDR13");
+/*** ETE ***/
+const char *const ETEProtocol("ETE");
+const char *const ETERegDevArch("TRCDEVARCH");
+
/*** ETMv3/PTM ***/
const char * const ETMv3Protocol("ETM3");
const char * const PTMProtocol("PTM1");
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 a84e1843881f..3c85f9d152da 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 @@ public:
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(); };
@@ -66,6 +66,7 @@ private:
bool createETMv4Decoder(const std::string &coreName, Parser::Parsed *devSrc, const bool bDataChannel = false);
bool createETMv3Decoder(const std::string &coreName, Parser::Parsed *devSrc);
bool createPTMDecoder(const std::string &coreName, Parser::Parsed *devSrc);
+ bool createETEDecoder(const std::string &coreName, Parser::Parsed *devSrc);
// TBD add etmv4d
// create a decoder related to a software trace source (ITM, STM)
@@ -91,7 +92,7 @@ private:
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/snapshot_parser.cpp b/decoder/tests/snapshot_parser_lib/source/snapshot_parser.cpp
index 6e62d1e200c2..4570700dd4c8 100644
--- a/decoder/tests/snapshot_parser_lib/source/snapshot_parser.cpp
+++ b/decoder/tests/snapshot_parser_lib/source/snapshot_parser.cpp
@@ -49,6 +49,10 @@ using namespace Parser;
#include "opencsd.h"
+static ITraceErrorLog *s_pErrorLogger = 0;
+static ocsd_hndl_err_log_t s_errlog_handle = 0;
+static bool s_verbose_logging = true;
+
/*************************************************************************
* Note, this file handles the parsring of the general (device specific)
* ini file and the (much smaller) device_list file
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 4eeec732c15b..902ce566f44e 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 @@ CreateDcdTreeFromSnapShot::CreateDcdTreeFromSnapShot() :
m_BufferFileName("")
{
m_errlog_handle = 0;
+ m_add_create_flags = 0;
}
CreateDcdTreeFromSnapShot::~CreateDcdTreeFromSnapShot()
@@ -63,8 +64,9 @@ void CreateDcdTreeFromSnapShot::initialise(SnapShotReader *pReader, ITraceErrorL
}
}
-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())
@@ -236,6 +238,10 @@ bool CreateDcdTreeFromSnapShot::createPEDecoder(const std::string &coreName, Par
{
bCreatedDecoder = createPTMDecoder(coreName,devSrc);
}
+ else if (devTypeName == ETEProtocol)
+ {
+ bCreatedDecoder = createETEDecoder(coreName, devSrc);
+ }
return bCreatedDecoder;
}
@@ -277,7 +283,7 @@ bool CreateDcdTreeFromSnapShot::createETMv4Decoder(const std::string &coreName,
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;
@@ -291,6 +297,53 @@ bool CreateDcdTreeFromSnapShot::createETMv4Decoder(const std::string &coreName,
return createdDecoder;
}
+bool CreateDcdTreeFromSnapShot::createETEDecoder(const std::string &coreName, Parser::Parsed *devSrc)
+{
+ bool createdDecoder = false;
+ bool configOK = true;
+
+ // generate the config data from the device data.
+ ocsd_ete_cfg config;
+
+ // ete regs are same names Etmv4 in places...
+ regs_to_access_t regs_to_access[] = {
+ { ETMv4RegCfg, true, &config.reg_configr, 0 },
+ { ETMv4RegIDR, true, &config.reg_traceidr, 0 },
+ { ETMv4RegIDR0, true, &config.reg_idr0, 0 },
+ { ETMv4RegIDR1, false, &config.reg_idr1, 0x4100F403 },
+ { ETMv4RegIDR2, true, &config.reg_idr2, 0 },
+ { ETMv4RegIDR8, false, &config.reg_idr8, 0 },
+ { ETERegDevArch, false, &config.reg_devarch, 0x47705A13 },
+ };
+
+ // extract registers
+ configOK = getRegisters(devSrc->regDefs, sizeof(regs_to_access) / sizeof(regs_to_access_t), regs_to_access);
+
+ // extract core profile
+ if (configOK)
+ configOK = getCoreProfile(coreName, config.arch_ver, config.core_prof);
+
+ // good config - generate the decoder on the tree.
+ if (configOK)
+ {
+ ocsd_err_t err = OCSD_OK;
+ ETEConfig configObj(&config);
+ const char *decoderName = OCSD_BUILTIN_DCD_ETE;
+
+ 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;
+ else
+ {
+ std::string msg = "Snapshot processor : failed to create " + (std::string)decoderName + " decoder on decode tree.";
+ LogError(ocsdError(OCSD_ERR_SEV_ERROR, err, msg));
+ }
+ }
+
+ return createdDecoder;
+}
+
// create an ETMv3 decoder based on the register values in the deviceN.ini file.
bool CreateDcdTreeFromSnapShot::createETMv3Decoder(const std::string &coreName, Parser::Parsed *devSrc)
{