From 205c7ec919abf910f72e2f345c6dcfac478f257a Mon Sep 17 00:00:00 2001 From: hoffmann Date: Sat, 16 Feb 2013 23:05:07 +0000 Subject: [PATCH] T32: Breakpoint test code git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@2107 8c4709b5-6ec9-48aa-a5cd-a96041d1645a --- debuggers/t32/src/T32Connector.cc | 21 +++++++++++++++++++ debuggers/t32/src/T32Connector.hpp | 24 ---------------------- src/core/sal/t32/T32Listener.ah | 6 ++---- src/experiments/vezs-example/experiment.cc | 13 +++++++++++- 4 files changed, 35 insertions(+), 29 deletions(-) delete mode 100644 debuggers/t32/src/T32Connector.hpp diff --git a/debuggers/t32/src/T32Connector.cc b/debuggers/t32/src/T32Connector.cc index 73d9ebb4..e3add8e5 100644 --- a/debuggers/t32/src/T32Connector.cc +++ b/debuggers/t32/src/T32Connector.cc @@ -57,5 +57,26 @@ int main(int argc, char** argv){ // Let the SimulatorController do the dirty work. fail::simulator.startup(); + // Here, we come back after any experiment called a resume + // Start execution of the SUT. + // The experiments/traces hopefully set some Breakpoints, we can react on. + // We may also provide a timeout, if a TimerListener was set wanted. + + /* + while(1) { + // Start execution (with next timeout, in any) + + // Wait for debugger to stop. + + // Evaluate state. + + // Call appropriate callback of the SimulatorController. + + } + */ + cout << "[T32 Backend] After startup" << endl; return 0; } + + + diff --git a/debuggers/t32/src/T32Connector.hpp b/debuggers/t32/src/T32Connector.hpp deleted file mode 100644 index 1a60f38e..00000000 --- a/debuggers/t32/src/T32Connector.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __T32_CONNECTOR_HPP__ - #define __T32_CONNECTOR_HPP__ - -#include - -namespace fail { - -/** - * \class T32Connector - */ -class T32Connector { -public: - - - /** - * Save simulator state. Quite hard on real hardware! Also safe all HW registers! - * @param path Location to store state information - * @return \c true if the state has been successfully saved, \c false otherwise - */ -}; - -} // end-of-namespace: fail - -#endif // __T32_CONNECTOR_HPP__ diff --git a/src/core/sal/t32/T32Listener.ah b/src/core/sal/t32/T32Listener.ah index 8eb2fef7..802c1589 100644 --- a/src/core/sal/t32/T32Listener.ah +++ b/src/core/sal/t32/T32Listener.ah @@ -17,16 +17,14 @@ aspect T32Listener bool onAddition() { // Setup Breakpoint in T32 - std::cout << "T32Listener::onAddition" << std::endl; - // Enable Breakpoint - T32_WriteBreakpoint( m_WatchInstrPtr, T32::MEMACCESS::PROGRAM, T32::BP::EXECUTION, 1); - return true; + return T32_WriteBreakpoint( m_WatchInstrPtr, T32::MEMACCESS::PROGRAM, T32::BP::EXECUTION, 1) == 0; } void onDeletion() { // Delete Breakpoint in T32 T32_WriteBreakpoint( m_WatchInstrPtr, T32::MEMACCESS::PROGRAM, T32::BP::CLEAR, 1); + // TODO Error handling } }; }; diff --git a/src/experiments/vezs-example/experiment.cc b/src/experiments/vezs-example/experiment.cc index 3e7d123b..bce4aced 100644 --- a/src/experiments/vezs-example/experiment.cc +++ b/src/experiments/vezs-example/experiment.cc @@ -24,7 +24,7 @@ bool VEZSExperiment::run() { m_log << "STARTING EXPERIMENT" << endl; m_log << "Instruction Pointer: 0x" << hex << simulator.getCPU(0).getInstructionPointer() << endl; - +// Test register access Register* reg = simulator.getCPU(0).getRegister(RI_R1); m_log << "Register R2: 0x" << hex << simulator.getCPU(0).getRegisterContent(reg) << endl; @@ -33,6 +33,7 @@ bool VEZSExperiment::run() simulator.getCPU(0).setRegisterContent(reg, 0x23); +// Test Memory access address_t targetaddress = 0x12345678; MemoryManager& mm = simulator.getMemoryManager(); mm.setByte(targetaddress, 0x42); @@ -44,6 +45,16 @@ bool VEZSExperiment::run() // read back bytes mm.getBytes(targetaddress, 4, tb); +// Test Breakpoints + address_t address = 0x11223344; + BPSingleListener bp(address); + simulator.addListener(&bp); + + simulator.clearListeners(); + +// resume backend. + simulator.resume(); + // Explicitly terminate, or the simulator will continue to run. simulator.terminate(); }