diff --git a/src/core/sal/Event.hpp b/src/core/sal/Event.hpp index 6ed9de60..bc74a9f8 100644 --- a/src/core/sal/Event.hpp +++ b/src/core/sal/Event.hpp @@ -33,15 +33,16 @@ public: class BPEvent : public BaseEvent { protected: address_t m_TriggerInstrPtr; //!< the address which triggered the event - address_t m_CR3; //!< the content of the cr3 reg + address_t m_AddressSpace; //!< the address space identifier public: /** * Creates a new breakpoint event. The range information is specific to * the subclasses. * @param trigger the triggering address of the breakpoint event - * @param cr3 the address space of this event, given as the content of a CR3 register. + * @param address_space the address space identifier for this event */ - BPEvent(address_t trigger, address_t cr3) : m_TriggerInstrPtr(trigger), m_CR3(cr3) { } + BPEvent(address_t trigger, address_t address_space) + : m_TriggerInstrPtr(trigger), m_AddressSpace(address_space) { } /** * Returns the instruction pointer that triggered this event. * @return triggering IP @@ -55,11 +56,11 @@ public: /** * Returns the address space register of this event. */ - address_t getCR3() const { return m_CR3; } + address_t getAddressSpace() const { return m_AddressSpace; } /** * Sets the address space register for this event. */ - void setCR3(address_t iptr) { m_CR3 = iptr; } + void setAddressSpace(address_t iptr) { m_AddressSpace = iptr; } }; /** diff --git a/src/core/sal/Listener.cc b/src/core/sal/Listener.cc index 6290615e..8520381d 100644 --- a/src/core/sal/Listener.cc +++ b/src/core/sal/Listener.cc @@ -57,9 +57,9 @@ bool MemAccessListener::isMatching(const MemAccessEvent* pEv) const return true; } -bool BPListener::aspaceIsMatching(address_t aspace) const +bool BPListener::aspaceIsMatching(address_t address_space) const { - if (m_CR3 == ANY_ADDR || m_CR3 == aspace) + if (m_Data.getAddressSpace() == ANY_ADDR || m_Data.getAddressSpace() == address_space) return true; return false; } @@ -72,7 +72,7 @@ void BPRangeListener::setWatchInstructionPointerRange(address_t start, address_t bool BPRangeListener::isMatching(const BPEvent* pEv) const { - if (!aspaceIsMatching(pEv->getCR3())) + if (!aspaceIsMatching(pEv->getAddressSpace())) return false; if ((m_WatchStartAddr != ANY_ADDR && pEv->getTriggerInstructionPointer() < m_WatchStartAddr) || (m_WatchEndAddr != ANY_ADDR && pEv->getTriggerInstructionPointer() > m_WatchEndAddr)) @@ -82,7 +82,7 @@ bool BPRangeListener::isMatching(const BPEvent* pEv) const bool BPSingleListener::isMatching(const BPEvent* pEv) const { - if (aspaceIsMatching(pEv->getCR3())) { + if (aspaceIsMatching(pEv->getAddressSpace())) { if (m_WatchInstrPtr == ANY_ADDR || m_WatchInstrPtr == pEv->getTriggerInstructionPointer()) return true; } diff --git a/src/core/sal/Listener.hpp b/src/core/sal/Listener.hpp index d392032a..68bea55d 100644 --- a/src/core/sal/Listener.hpp +++ b/src/core/sal/Listener.hpp @@ -134,27 +134,28 @@ public: class BPListener : public BaseListener { protected: BPEvent m_Data; - address_t m_CR3; public: /** * Creates a new breakpoint listener. The range information is specific to * the subclasses. - * @param address_space the address space to be oberserved, given as the - * content of a CR3 register. The listener will not be triggered unless + * @param address_space the address space to be oberserved. + * The nature if its identifier is implementation-specific. + * For IA-32, it is given as the + * content of the CR3 register. The listener will not be triggered unless * \a ip is part of the given address space. * ANY_ADDR can be used as a placeholder to allow debugging * in a random address space. */ BPListener(address_t address_space = ANY_ADDR) - : m_Data(address_space, ANY_ADDR), m_CR3(ANY_ADDR) { } + : m_Data(address_space, ANY_ADDR) { } /** * Returns the address space register of this listener. */ - address_t getCR3() const { return m_CR3; } + address_t getAddressSpace() const { return m_Data.getAddressSpace(); } /** * Sets the address space register for this listener. */ - void setCR3(address_t iptr) { m_CR3 = iptr; } + void setAddressSpace(address_t iptr) { m_Data.setAddressSpace(iptr); } /** * Checks whether a given address space is matching. */ @@ -190,11 +191,8 @@ public: * flow reaches this address and its counter value is zero, the * listener will be triggered. \a ip can be set to the ANY_ADDR * wildcard to allow arbitrary addresses. Defaults to 0. - * @param address_space the address space to be oberserved, given as the - * content of a CR3 register. The listener will not be triggered unless - * \a ip is part of the given address space. Defaults to \c ANY_ADDR. - * Here, too, ANY_ADDR is a placeholder to allow debugging - * in a random address space. + * @param address_space the address space to be oberserved. + * \see BPListener */ BPSingleListener(address_t ip = 0, address_t address_space = ANY_ADDR) : BPListener(address_space), m_WatchInstrPtr(ip) { } diff --git a/src/experiments/l4-sys/experiment.cc b/src/experiments/l4-sys/experiment.cc index 2809b518..fd65ec49 100644 --- a/src/experiments/l4-sys/experiment.cc +++ b/src/experiments/l4-sys/experiment.cc @@ -235,8 +235,7 @@ bool L4SysExperiment::run() { golden_run_file.close(); simulator.terminate(10); } - simulator.clearListeners(); - bp.setCounter(1); + log << "saving output generated during normal execution" << endl; golden_run_file.close();