sim: Initialize Drainable::_drainState to the system's state
authorAndreas Sandberg <andreas.sandberg@arm.com>
Tue, 4 Aug 2015 09:31:37 +0000 (10:31 +0100)
committerAndreas Sandberg <andreas.sandberg@arm.com>
Tue, 4 Aug 2015 09:31:37 +0000 (10:31 +0100)
commit7c904d9d3faff80d724c8ab3e6f1d3815545e2f5
tree80bb80679fb357f0ab242987731f073fc5807936
parent1a7802598b3c3d667f7150269f6a26d977ce575c
sim: Initialize Drainable::_drainState to the system's state

It is sometimes desirable to be able to instantiate Drainable objects
when the simulator isn't in the Running state. Currently, we always
initialize Drainable objects to the Running state. However, this
confuses many of the sanity checks in the base class since objects
aren't expected to be in the Running state if the system is in the
Draining or Drained state.

Instead of always initializing the state variable in Drainable to
DrainState::Running, initialize it to the state the DrainManager is
in.

Note: This means an object can be created in the Draining/Drained
state without first calling drain().
src/sim/drain.cc