From 85152238da6ecb9d5fb97afb3f3eec504fbe93d4 Mon Sep 17 00:00:00 2001 From: Horst Schirmeier Date: Tue, 11 Feb 2014 10:32:55 +0100 Subject: [PATCH] tracing: fix endless loop when only tracing mem accesses With m_tracetype=TRACE_MEM, bool first was never reset to false in the tracing plugin's main loop. This bug was most probably never triggered, though, as nobody only traces memory accesses. This change also slightly simplifies the internal logic in the tracing plugin. Change-Id: I65d7df6a3781ec552cfb892bbf3394b421e227f1 --- src/plugins/tracing/TracingPlugin.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/tracing/TracingPlugin.cc b/src/plugins/tracing/TracingPlugin.cc index fbae8923..b17a01ec 100644 --- a/src/plugins/tracing/TracingPlugin.cc +++ b/src/plugins/tracing/TracingPlugin.cc @@ -35,18 +35,18 @@ bool TracingPlugin::run() simtime_t prevtime = 0, curtime; simtime_diff_t deltatime; - bool first = true; + bool record_first_ipevent = m_tracetype | TRACE_IP; while (true) { - if (!first) { + if (!record_first_ipevent) { ev = simulator.resume(); } curtime = simulator.getTimerTicks(); deltatime = curtime - prevtime; - if (ev == &ev_step || (first && (m_tracetype | TRACE_IP))) { - first = false; + if (ev == &ev_step || record_first_ipevent) { + record_first_ipevent = false; simulator.addListener(&ev_step); address_t ip = simulator.getCPU(0).getInstructionPointer(); @@ -127,7 +127,7 @@ bool TracingPlugin::run() ps->writeMessage(&e); } - } else if (!first) { + } else { if (m_os) *m_os << "[Tracing] SOMETHING IS SERIOUSLY WRONG\n"; }