Removed BochController debug stuff. Merged: BochsController::onBreakpoint -> SimCon::onBreakpoint.
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1883 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -54,29 +54,20 @@ void SimulatorController::initExperiments()
|
||||
|
||||
void SimulatorController::onBreakpoint(address_t instrPtr, address_t address_space)
|
||||
{
|
||||
assert(false &&
|
||||
"FIXME: SimulatorController::onBreakpoint() has not been tested before");
|
||||
// FIXME: Improve performance!
|
||||
|
||||
// Loop through all listeners of type BP*Listener:
|
||||
// Check for active breakpoint-events:
|
||||
ListenerManager::iterator it = m_LstList.begin();
|
||||
BPEvent tmp(instrPtr, address_space);
|
||||
while (it != m_LstList.end()) {
|
||||
BaseListener* pev = *it;
|
||||
BPSingleListener* pbp; BPRangeListener* pbpr;
|
||||
if ((pbp = dynamic_cast<BPSingleListener*>(pev)) && pbp->isMatching(&tmp)) {
|
||||
pbp->setTriggerInstructionPointer(instrPtr);
|
||||
BaseListener* pLi = *it;
|
||||
BPListener* pBreakpt = dynamic_cast<BPListener*>(pLi);
|
||||
if (pBreakpt != NULL && pBreakpt->isMatching(&tmp)) {
|
||||
pBreakpt->setTriggerInstructionPointer(instrPtr);
|
||||
it = m_LstList.makeActive(it);
|
||||
// "it" has already been set to the next element (by calling
|
||||
// makeActive()):
|
||||
continue; // -> skip iterator increment
|
||||
} else if ((pbpr = dynamic_cast<BPRangeListener*>(pev)) &&
|
||||
pbpr->isMatching(&tmp)) {
|
||||
pbpr->setTriggerInstructionPointer(instrPtr);
|
||||
it = m_LstList.makeActive(it);
|
||||
continue; // dito
|
||||
}
|
||||
++it;
|
||||
it++;
|
||||
}
|
||||
m_LstList.triggerActiveListeners();
|
||||
}
|
||||
@ -84,7 +75,6 @@ void SimulatorController::onBreakpoint(address_t instrPtr, address_t address_spa
|
||||
void SimulatorController::onMemoryAccess(address_t addr, size_t len,
|
||||
bool is_write, address_t instrPtr)
|
||||
{
|
||||
// FIXME: Improve performance!
|
||||
MemAccessEvent::access_type_t accesstype =
|
||||
is_write ? MemAccessEvent::MEM_WRITE
|
||||
: MemAccessEvent::MEM_READ;
|
||||
|
||||
@ -44,11 +44,6 @@ BochsController::BochsController()
|
||||
m_Regs->add(pReg);
|
||||
}
|
||||
#endif // BX_SUPPORT_X86_64
|
||||
#ifdef DEBUG
|
||||
m_Regularity = 0; // disabled
|
||||
m_Counter = 0;
|
||||
m_pDest = NULL;
|
||||
#endif
|
||||
// -------------------------------------
|
||||
// Add the Program counter register:
|
||||
#if BX_SUPPORT_X86_64
|
||||
@ -79,44 +74,6 @@ BochsController::~BochsController()
|
||||
delete m_Mem;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void BochsController::dbgEnableInstrPtrOutput(unsigned regularity, std::ostream* dest)
|
||||
{
|
||||
m_Regularity = regularity;
|
||||
m_pDest = dest;
|
||||
m_Counter = 0;
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
void BochsController::onBreakpoint(address_t instrPtr, address_t address_space)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (m_Regularity != 0 && ++m_Counter % m_Regularity == 0)
|
||||
(*m_pDest) << "0x" << std::hex << instrPtr;
|
||||
#endif
|
||||
bool do_fire = false;
|
||||
// Check for active breakpoint-events:
|
||||
ListenerManager::iterator it = m_LstList.begin();
|
||||
BPEvent tmp(instrPtr, address_space);
|
||||
while (it != m_LstList.end()) {
|
||||
BaseListener* pLi = *it;
|
||||
BPListener* pBreakpt = dynamic_cast<BPListener*>(pLi);
|
||||
if (pBreakpt != NULL && pBreakpt->isMatching(&tmp)) {
|
||||
pBreakpt->setTriggerInstructionPointer(instrPtr);
|
||||
it = m_LstList.makeActive(it);
|
||||
do_fire = true;
|
||||
// "it" has already been set to the next element (by calling
|
||||
// makeActive()):
|
||||
continue; // -> skip iterator increment
|
||||
}
|
||||
it++;
|
||||
}
|
||||
if (do_fire)
|
||||
m_LstList.triggerActiveListeners();
|
||||
// Note: SimulatorController::onBreakpoint will not be invoked in this
|
||||
// implementation.
|
||||
}
|
||||
|
||||
void BochsController::updateBPEventInfo(BX_CPU_C *context, bxInstruction_c *instr)
|
||||
{
|
||||
assert(context != NULL && "FATAL ERROR: Bochs internal member was NULL (not expected)!");
|
||||
|
||||
@ -17,6 +17,8 @@
|
||||
#include "iodev/iodev.h"
|
||||
#include "pc_system.h"
|
||||
|
||||
#define DEBUG
|
||||
|
||||
namespace fail {
|
||||
|
||||
class ExperimentFlow;
|
||||
@ -24,17 +26,22 @@ class ExperimentFlow;
|
||||
/**
|
||||
* \class BochsController
|
||||
* Bochs-specific implementation of a SimulatorController.
|
||||
*
|
||||
* @note The instruction (IP) pointer modification handler (onBreakpoint())
|
||||
* is called (from the Breakpoints aspect) *every* time the Bochs-internal IP
|
||||
* changes. The handler itself evaluates if a breakpoint event needs to be
|
||||
* triggered. This handler needs to implement the breakpoint-mechanism in an
|
||||
* indirect fashion because the Bochs simulator doesn't support native
|
||||
* breakpoints. To be compatible with the interface specified by the simulator
|
||||
* class, we need to provide the two members \c m_CPUContext and \c m_CacheEntry.
|
||||
* The elements are being set before the handler is called (see
|
||||
* \c updateBPEventInfo())
|
||||
*/
|
||||
class BochsController : public SimulatorController {
|
||||
private:
|
||||
ExperimentFlow* m_CurrFlow; //!< Stores the current flow for save/restore-operations
|
||||
BX_CPU_C *m_CPUContext; //!< Additional information that is passed on occurence of a BPEvent
|
||||
bxInstruction_c *m_CurrentInstruction; //!< dito.
|
||||
#ifdef DEBUG
|
||||
unsigned m_Regularity; //! regularity of instruction ptr output
|
||||
unsigned m_Counter; //! current instr-ptr counter
|
||||
std::ostream* m_pDest; //! debug output object (defaults to \c std::cout)
|
||||
#endif
|
||||
public:
|
||||
// Initialize the controller.
|
||||
BochsController();
|
||||
@ -42,20 +49,6 @@ public:
|
||||
/* ********************************************************************
|
||||
* Standard Listener Handler API:
|
||||
* ********************************************************************/
|
||||
/**
|
||||
* Instruction pointer modification handler implementing the onBreakpoint
|
||||
* handler of the SimulatorController. This method is called (from
|
||||
* the Breakpoints aspect) *every* time the Bochs-internal IP changes.
|
||||
* The handler itself evaluates if a breakpoint event needs to be triggered.
|
||||
* This handler needs to implement the breakpoint-mechanism in an indirect
|
||||
* fashion because the Bochs simulator doesn't support native breakpoints.
|
||||
* To match the interface specified by the simulator class, we need to provide
|
||||
* the two members \c m_CPUContext and \c m_CacheEntry. The elements are
|
||||
* being set before the handler is called (see \c updateBPEventInfo()).
|
||||
* @param instrPtr the new instruction pointer
|
||||
* @param address_space the address space the CPU is currently in
|
||||
*/
|
||||
void onBreakpoint(address_t instrPtr, address_t address_space);
|
||||
/**
|
||||
* I/O port communication handler. This method is called (from
|
||||
* the IOPortCom aspect) every time when Bochs performs a port I/O operation.
|
||||
@ -123,15 +116,6 @@ public:
|
||||
/* ********************************************************************
|
||||
* BochsController-specific (not implemented in SimulatorController!):
|
||||
* ********************************************************************/
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* Enables instruction pointer debugging output.
|
||||
* @param regularity the output regularity; 1 to display every
|
||||
* instruction pointer, 0 to disable
|
||||
* @param dest specifies the output destition; defaults to \c std::cout
|
||||
*/
|
||||
void dbgEnableInstrPtrOutput(unsigned regularity, std::ostream* dest = &std::cout);
|
||||
#endif
|
||||
/**
|
||||
* Retrieves the textual description (mnemonic) for the current
|
||||
* instruction. The format of the returned string is Bochs-specific.
|
||||
|
||||
Reference in New Issue
Block a user