cpn: Not every InjectionPointHops calcs smart-hops

As the InjectionPoint is considered to be a container for abstract
"points in time" which can be navigated to, not every object of
a InjectionPointHops needs a smart-hopping calculator.

Change-Id: I150a46cf79a2b9d8ddb2d24a6d89dc3d4246cdb3
This commit is contained in:
Lars Rademacher
2013-12-02 17:27:51 +01:00
parent e824e7a0fa
commit d7a9a2811d
2 changed files with 20 additions and 4 deletions

View File

@ -63,6 +63,9 @@ class InjectionPointHops : public InjectionPointBase {
private:
SmartHops *m_sa; // !< Hop calculator which generates the hop chain
uint32_t m_curr_inst; // !< Instruction for which currently a hop chain is available
bool m_initialized;
void init();
public:
InjectionPointHops();
virtual ~InjectionPointHops();

View File

@ -3,8 +3,19 @@
namespace fail {
InjectionPointHops::InjectionPointHops() : InjectionPointBase(), m_sa(new SmartHops()), m_curr_inst(0) {
InjectionPointHops::InjectionPointHops() : InjectionPointBase(), m_sa(NULL), m_curr_inst(0), m_initialized(false) {
}
InjectionPointHops::~InjectionPointHops() {
if (m_initialized)
delete m_sa;
}
void InjectionPointHops::init()
{
m_sa = new SmartHops();
m_curr_inst = 0;
char * elfpath = getenv("FAIL_TRACE_PATH");
if(elfpath == NULL){
m_log << "FAIL_TRACE_PATH not set :(" << std::endl;
@ -12,13 +23,15 @@ InjectionPointHops::InjectionPointHops() : InjectionPointBase(), m_sa(new SmartH
}else{
m_sa->init((const char*)elfpath);
}
}
InjectionPointHops::~InjectionPointHops() {
delete m_sa;
m_initialized = true;
}
void InjectionPointHops::parseFromInjectionInstr(unsigned inj_instr) {
if (!m_initialized) {
init();
}
// Already calculated result needed?
if (m_curr_inst == inj_instr) {
return;