diff options
Diffstat (limited to 'src/uscxml/debug')
-rw-r--r-- | src/uscxml/debug/Benchmark.cpp | 42 | ||||
-rw-r--r-- | src/uscxml/debug/Benchmark.h | 10 | ||||
-rw-r--r-- | src/uscxml/debug/DebugSession.cpp | 8 | ||||
-rw-r--r-- | src/uscxml/debug/Debugger.cpp | 124 | ||||
-rw-r--r-- | src/uscxml/debug/Debugger.h | 72 | ||||
-rw-r--r-- | src/uscxml/debug/DebuggerServlet.cpp | 2 |
6 files changed, 127 insertions, 131 deletions
diff --git a/src/uscxml/debug/Benchmark.cpp b/src/uscxml/debug/Benchmark.cpp index 0d2d789..b529bb4 100644 --- a/src/uscxml/debug/Benchmark.cpp +++ b/src/uscxml/debug/Benchmark.cpp @@ -23,33 +23,33 @@ namespace uscxml { std::mutex Benchmark::benchMutex; std::map<std::string, size_t> Benchmark::benchmarks; - + Benchmark::Benchmark(const std::string& domain) : domain(domain), started(std::chrono::system_clock::now()) { } Benchmark::~Benchmark() { - std::lock_guard<std::mutex> lock(benchMutex); - benchmarks[domain] += std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now() - started).count(); + std::lock_guard<std::mutex> lock(benchMutex); + benchmarks[domain] += std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now() - started).count(); } - + std::ostream& Benchmark::report(std::ostream& stream) { - std::lock_guard<std::mutex> lock(benchMutex); - - size_t longestDomain = 0; - for (auto benchmark : benchmarks) { - longestDomain = (benchmark.first.size() > longestDomain ? benchmark.first.size() : longestDomain); - } - longestDomain += 8; - - for (auto benchmark : benchmarks) { - std::string padding; - for (int i = benchmark.first.size(); i < (longestDomain - log10(benchmark.second)); i++) { - padding += " "; - } - - stream << benchmark.first << ":" << padding << (double)benchmark.second / 1000.0 << "ms" << std::endl; - } - return stream; + std::lock_guard<std::mutex> lock(benchMutex); + + size_t longestDomain = 0; + for (auto benchmark : benchmarks) { + longestDomain = (benchmark.first.size() > longestDomain ? benchmark.first.size() : longestDomain); + } + longestDomain += 8; + + for (auto benchmark : benchmarks) { + std::string padding; + for (int i = benchmark.first.size(); i < (longestDomain - log10(benchmark.second)); i++) { + padding += " "; + } + + stream << benchmark.first << ":" << padding << (double)benchmark.second / 1000.0 << "ms" << std::endl; + } + return stream; } } diff --git a/src/uscxml/debug/Benchmark.h b/src/uscxml/debug/Benchmark.h index 82ef583..6548ff8 100644 --- a/src/uscxml/debug/Benchmark.h +++ b/src/uscxml/debug/Benchmark.h @@ -34,12 +34,12 @@ class USCXML_API Benchmark { public: Benchmark(const std::string& domain); ~Benchmark(); - - static std::ostream& report(std::ostream& stream); + + static std::ostream& report(std::ostream& stream); protected: - std::string domain; - std::chrono::time_point<std::chrono::system_clock> started; - + std::string domain; + std::chrono::time_point<std::chrono::system_clock> started; + static std::map<std::string, size_t> benchmarks; static std::mutex benchMutex; }; diff --git a/src/uscxml/debug/DebugSession.cpp b/src/uscxml/debug/DebugSession.cpp index 802b355..42973fc 100644 --- a/src/uscxml/debug/DebugSession.cpp +++ b/src/uscxml/debug/DebugSession.cpp @@ -119,7 +119,7 @@ Data DebugSession::debugPrepare(const Data& data) { if (_interpreter) { // register ourself as a monitor _interpreter.addMonitor(_debugger); - _debugger->attachSession(_interpreter.getImpl().get(), shared_from_this()); + _debugger->attachSession(_interpreter.getImpl()->getSessionId(), shared_from_this()); replyData.compound["status"] = Data("success", Data::VERBATIM); } else { @@ -149,7 +149,7 @@ Data DebugSession::debugAttach(const Data& data) { std::shared_ptr<InterpreterImpl> instance = weakInstance.second.lock(); if (instance && instance->getSessionId() == interpreterId) { _interpreter = instance; - _debugger->attachSession(_interpreter.getImpl().get(), shared_from_this()); + _debugger->attachSession(_interpreter.getImpl()->getSessionId(), shared_from_this()); interpreterFound = true; break; } @@ -170,7 +170,7 @@ Data DebugSession::debugDetach(const Data& data) { Data replyData; _isAttached = false; - _debugger->detachSession(_interpreter.getImpl().get()); + _debugger->detachSession(_interpreter.getImpl()->getSessionId()); replyData.compound["status"] = Data("success", Data::VERBATIM); return replyData; } @@ -223,7 +223,7 @@ Data DebugSession::debugStop(const Data& data) { if (_interpreter) { // detach from old intepreter - _debugger->detachSession(_interpreter.getImpl().get()); + _debugger->detachSession(_interpreter.getImpl()->getSessionId()); } if (_isRunning && _interpreterThread != NULL) { diff --git a/src/uscxml/debug/Debugger.cpp b/src/uscxml/debug/Debugger.cpp index e1ff74b..cd7f0fe 100644 --- a/src/uscxml/debug/Debugger.cpp +++ b/src/uscxml/debug/Debugger.cpp @@ -24,9 +24,8 @@ namespace uscxml { -void Debugger::afterCompletion(Interpreter& interpreter) { - InterpreterImpl* impl = interpreter.getImpl().get(); - std::shared_ptr<DebugSession> session = getSession(impl); +void Debugger::afterCompletion(const std::string& sessionId) { + std::shared_ptr<DebugSession> session = getSession(sessionId); if (!session) return; @@ -35,9 +34,9 @@ void Debugger::afterCompletion(Interpreter& interpreter) { pushData(session, msg); } -void Debugger::beforeCompletion(Interpreter& interpreter) {} +void Debugger::beforeCompletion(const std::string& sessionId) {} -std::list<Breakpoint> Debugger::getQualifiedStateBreakpoints(InterpreterImpl* impl, const XERCESC_NS::DOMElement* state, Breakpoint breakpointTemplate) { +std::list<Breakpoint> Debugger::getQualifiedStateBreakpoints(const std::string& sessionId, const XERCESC_NS::DOMElement* state, Breakpoint breakpointTemplate) { std::list<Breakpoint> breakpoints; Breakpoint bp = breakpointTemplate; // copy base as template @@ -49,7 +48,7 @@ std::list<Breakpoint> Debugger::getQualifiedStateBreakpoints(InterpreterImpl* im return breakpoints; } -std::list<Breakpoint> Debugger::getQualifiedInvokeBreakpoints(InterpreterImpl* impl, const XERCESC_NS::DOMElement* invokeElem, const std::string invokeId, Breakpoint breakpointTemplate) { +std::list<Breakpoint> Debugger::getQualifiedInvokeBreakpoints(const std::string& sessionId, const XERCESC_NS::DOMElement* invokeElem, const std::string invokeId, Breakpoint breakpointTemplate) { std::list<Breakpoint> breakpoints; Breakpoint bp = breakpointTemplate; // copy base as template @@ -60,7 +59,8 @@ std::list<Breakpoint> Debugger::getQualifiedInvokeBreakpoints(InterpreterImpl* i if (HAS_ATTR(invokeElem, kXMLCharType)) { bp.invokeType = ATTR(invokeElem, kXMLCharType); } else if (HAS_ATTR(invokeElem, kXMLCharTypeExpr)) { - bp.invokeType = impl->evalAsData(ATTR(invokeElem, kXMLCharTypeExpr)).atom; + Interpreter intptr = Interpreter::fromSessionId(sessionId); + bp.invokeType = intptr.getImpl()->evalAsData(ATTR(invokeElem, kXMLCharTypeExpr)).atom; } breakpoints.push_back(bp); @@ -68,11 +68,13 @@ std::list<Breakpoint> Debugger::getQualifiedInvokeBreakpoints(InterpreterImpl* i return breakpoints; } -std::list<Breakpoint> Debugger::getQualifiedTransBreakpoints(InterpreterImpl* impl, const XERCESC_NS::DOMElement* transition, Breakpoint breakpointTemplate) { +std::list<Breakpoint> Debugger::getQualifiedTransBreakpoints(const std::string& sessionId, const XERCESC_NS::DOMElement* transition, Breakpoint breakpointTemplate) { std::list<Breakpoint> breakpoints; XERCESC_NS::DOMElement* source = getSourceState(transition); - std::list<XERCESC_NS::DOMElement*> targets = getTargetStates(transition, impl->_scxml); + Interpreter intptr = Interpreter::fromSessionId(sessionId); + + std::list<XERCESC_NS::DOMElement*> targets = getTargetStates(transition, intptr.getImpl()->_scxml); for (auto target : targets) { @@ -88,59 +90,59 @@ std::list<Breakpoint> Debugger::getQualifiedTransBreakpoints(InterpreterImpl* im return breakpoints; } -void Debugger::beforeTakingTransition(Interpreter& interpreter, const XERCESC_NS::DOMElement* transition) { - handleTransition(interpreter, transition, Breakpoint::BEFORE); +void Debugger::beforeTakingTransition(const std::string& sessionId, const XERCESC_NS::DOMElement* transition) { + handleTransition(sessionId, transition, Breakpoint::BEFORE); } -void Debugger::afterTakingTransition(Interpreter& interpreter, const XERCESC_NS::DOMElement* transition) { - handleTransition(interpreter, transition, Breakpoint::AFTER); +void Debugger::afterTakingTransition(const std::string& sessionId, const XERCESC_NS::DOMElement* transition) { + handleTransition(sessionId, transition, Breakpoint::AFTER); } -void Debugger::beforeExecutingContent(Interpreter& interpreter, const XERCESC_NS::DOMElement* execContent) { - handleExecutable(interpreter, execContent, Breakpoint::BEFORE); +void Debugger::beforeExecutingContent(const std::string& sessionId, const XERCESC_NS::DOMElement* execContent) { + handleExecutable(sessionId, execContent, Breakpoint::BEFORE); } -void Debugger::afterExecutingContent(Interpreter& interpreter, const XERCESC_NS::DOMElement* execContent) { - handleExecutable(interpreter, execContent, Breakpoint::AFTER); +void Debugger::afterExecutingContent(const std::string& sessionId, const XERCESC_NS::DOMElement* execContent) { + handleExecutable(sessionId, execContent, Breakpoint::AFTER); } -void Debugger::beforeExitingState(Interpreter& interpreter, const XERCESC_NS::DOMElement* state) { - handleState(interpreter, state, Breakpoint::BEFORE, Breakpoint::EXIT); +void Debugger::beforeExitingState(const std::string& sessionId, const std::string& stateName, const XERCESC_NS::DOMElement* state) { + handleState(sessionId, state, Breakpoint::BEFORE, Breakpoint::EXIT); } -void Debugger::afterExitingState(Interpreter& interpreter, const XERCESC_NS::DOMElement* state) { - handleState(interpreter, state, Breakpoint::AFTER, Breakpoint::EXIT); +void Debugger::afterExitingState(const std::string& sessionId, const std::string& stateName, const XERCESC_NS::DOMElement* state) { + handleState(sessionId, state, Breakpoint::AFTER, Breakpoint::EXIT); } -void Debugger::beforeEnteringState(Interpreter& interpreter, const XERCESC_NS::DOMElement* state) { - handleState(interpreter, state, Breakpoint::BEFORE, Breakpoint::ENTER); +void Debugger::beforeEnteringState(const std::string& sessionId, const std::string& stateName, const XERCESC_NS::DOMElement* state) { + handleState(sessionId, state, Breakpoint::BEFORE, Breakpoint::ENTER); } -void Debugger::afterEnteringState(Interpreter& interpreter, const XERCESC_NS::DOMElement* state) { - handleState(interpreter, state, Breakpoint::AFTER, Breakpoint::ENTER); +void Debugger::afterEnteringState(const std::string& sessionId, const std::string& stateName, const XERCESC_NS::DOMElement* state) { + handleState(sessionId, state, Breakpoint::AFTER, Breakpoint::ENTER); } -void Debugger::beforeUninvoking(Interpreter& interpreter, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid) { - handleInvoke(interpreter, invokeElem, invokeid, Breakpoint::BEFORE, Breakpoint::UNINVOKE); +void Debugger::beforeUninvoking(const std::string& sessionId, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid) { + handleInvoke(sessionId, invokeElem, invokeid, Breakpoint::BEFORE, Breakpoint::UNINVOKE); } -void Debugger::afterUninvoking(Interpreter& interpreter, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid) { - handleInvoke(interpreter, invokeElem, invokeid, Breakpoint::AFTER, Breakpoint::UNINVOKE); +void Debugger::afterUninvoking(const std::string& sessionId, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid) { + handleInvoke(sessionId, invokeElem, invokeid, Breakpoint::AFTER, Breakpoint::UNINVOKE); } -void Debugger::beforeInvoking(Interpreter& interpreter, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid) { - handleInvoke(interpreter, invokeElem, invokeid, Breakpoint::BEFORE, Breakpoint::INVOKE); +void Debugger::beforeInvoking(const std::string& sessionId, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid) { + handleInvoke(sessionId, invokeElem, invokeid, Breakpoint::BEFORE, Breakpoint::INVOKE); } -void Debugger::afterInvoking(Interpreter& interpreter, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid) { - handleInvoke(interpreter, invokeElem, invokeid, Breakpoint::AFTER, Breakpoint::INVOKE); +void Debugger::afterInvoking(const std::string& sessionId, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid) { + handleInvoke(sessionId, invokeElem, invokeid, Breakpoint::AFTER, Breakpoint::INVOKE); } -void Debugger::onStableConfiguration(Interpreter& interpreter) { - handleStable(interpreter, Breakpoint::ON); +void Debugger::onStableConfiguration(const std::string& sessionId) { + handleStable(sessionId, Breakpoint::ON); } -void Debugger::beforeMicroStep(Interpreter& interpreter) { - handleMicrostep(interpreter, Breakpoint::BEFORE); +void Debugger::beforeMicroStep(const std::string& sessionId) { + handleMicrostep(sessionId, Breakpoint::BEFORE); } -void Debugger::afterMicroStep(Interpreter& interpreter) { - handleMicrostep(interpreter, Breakpoint::AFTER); +void Debugger::afterMicroStep(const std::string& sessionId) { + handleMicrostep(sessionId, Breakpoint::AFTER); } -void Debugger::beforeProcessingEvent(Interpreter& interpreter, const Event& event) { - handleEvent(interpreter, event, Breakpoint::BEFORE); +void Debugger::beforeProcessingEvent(const std::string& sessionId, const Event& event) { + handleEvent(sessionId, event, Breakpoint::BEFORE); } -void Debugger::handleExecutable(Interpreter& interpreter, +void Debugger::handleExecutable(const std::string& sessionId, const XERCESC_NS::DOMElement* execContentElem, Breakpoint::When when) { - std::shared_ptr<DebugSession> session = getSession(interpreter.getImpl().get()); + std::shared_ptr<DebugSession> session = getSession(sessionId); if (!session) return; if (!session->_isRunning) @@ -159,9 +161,8 @@ void Debugger::handleExecutable(Interpreter& interpreter, } -void Debugger::handleEvent(Interpreter& interpreter, const Event& event, Breakpoint::When when) { - InterpreterImpl* impl = interpreter.getImpl().get(); - std::shared_ptr<DebugSession> session = getSession(impl); +void Debugger::handleEvent(const std::string& sessionId, const Event& event, Breakpoint::When when) { + std::shared_ptr<DebugSession> session = getSession(sessionId); if (!session) return; if (!session->_isRunning) @@ -179,9 +180,8 @@ void Debugger::handleEvent(Interpreter& interpreter, const Event& event, Breakpo } -void Debugger::handleStable(Interpreter& interpreter, Breakpoint::When when) { - InterpreterImpl* impl = interpreter.getImpl().get(); - std::shared_ptr<DebugSession> session = getSession(impl); +void Debugger::handleStable(const std::string& sessionId, Breakpoint::When when) { + std::shared_ptr<DebugSession> session = getSession(sessionId); if (!session) return; if (!session->_isRunning) @@ -197,9 +197,8 @@ void Debugger::handleStable(Interpreter& interpreter, Breakpoint::When when) { session->checkBreakpoints(breakpoints); } -void Debugger::handleMicrostep(Interpreter& interpreter, Breakpoint::When when) { - InterpreterImpl* impl = interpreter.getImpl().get(); - std::shared_ptr<DebugSession> session = getSession(impl); +void Debugger::handleMicrostep(const std::string& sessionId, Breakpoint::When when) { + std::shared_ptr<DebugSession> session = getSession(sessionId); if (!session) return; if (!session->_isRunning) @@ -215,9 +214,8 @@ void Debugger::handleMicrostep(Interpreter& interpreter, Breakpoint::When when) session->checkBreakpoints(breakpoints); } -void Debugger::handleTransition(Interpreter& interpreter, const XERCESC_NS::DOMElement* transition, Breakpoint::When when) { - InterpreterImpl* impl = interpreter.getImpl().get(); - std::shared_ptr<DebugSession> session = getSession(impl); +void Debugger::handleTransition(const std::string& sessionId, const XERCESC_NS::DOMElement* transition, Breakpoint::When when) { + std::shared_ptr<DebugSession> session = getSession(sessionId); if (!session) return; if (!session->_isRunning) @@ -225,13 +223,12 @@ void Debugger::handleTransition(Interpreter& interpreter, const XERCESC_NS::DOME Breakpoint breakpointTemplate; breakpointTemplate.when = when; - std::list<Breakpoint> qualifiedBreakpoints = getQualifiedTransBreakpoints(impl, transition, breakpointTemplate); + std::list<Breakpoint> qualifiedBreakpoints = getQualifiedTransBreakpoints(sessionId, transition, breakpointTemplate); session->checkBreakpoints(qualifiedBreakpoints); } -void Debugger::handleState(Interpreter& interpreter, const XERCESC_NS::DOMElement* state, Breakpoint::When when, Breakpoint::Action action) { - InterpreterImpl* impl = interpreter.getImpl().get(); - std::shared_ptr<DebugSession> session = getSession(impl); +void Debugger::handleState(const std::string& sessionId, const XERCESC_NS::DOMElement* state, Breakpoint::When when, Breakpoint::Action action) { + std::shared_ptr<DebugSession> session = getSession(sessionId); if (!session) return; if (!session->_isRunning) @@ -240,14 +237,13 @@ void Debugger::handleState(Interpreter& interpreter, const XERCESC_NS::DOMElemen Breakpoint breakpointTemplate; breakpointTemplate.when = when; breakpointTemplate.action = action; - std::list<Breakpoint> qualifiedBreakpoints = getQualifiedStateBreakpoints(impl, state, breakpointTemplate); + std::list<Breakpoint> qualifiedBreakpoints = getQualifiedStateBreakpoints(sessionId, state, breakpointTemplate); session->checkBreakpoints(qualifiedBreakpoints); } -void Debugger::handleInvoke(Interpreter& interpreter, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeId, Breakpoint::When when, Breakpoint::Action action) { - InterpreterImpl* impl = interpreter.getImpl().get(); - std::shared_ptr<DebugSession> session = getSession(impl); +void Debugger::handleInvoke(const std::string& sessionId, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeId, Breakpoint::When when, Breakpoint::Action action) { + std::shared_ptr<DebugSession> session = getSession(sessionId); if (!session) return; if (!session->_isRunning) @@ -256,7 +252,7 @@ void Debugger::handleInvoke(Interpreter& interpreter, const XERCESC_NS::DOMEleme Breakpoint breakpointTemplate; breakpointTemplate.when = when; breakpointTemplate.action = action; - std::list<Breakpoint> qualifiedBreakpoints = getQualifiedInvokeBreakpoints(impl, invokeElem, invokeId, breakpointTemplate); + std::list<Breakpoint> qualifiedBreakpoints = getQualifiedInvokeBreakpoints(sessionId, invokeElem, invokeId, breakpointTemplate); session->checkBreakpoints(qualifiedBreakpoints); } diff --git a/src/uscxml/debug/Debugger.h b/src/uscxml/debug/Debugger.h index d69e6f6..ec00a95 100644 --- a/src/uscxml/debug/Debugger.h +++ b/src/uscxml/debug/Debugger.h @@ -35,80 +35,80 @@ public: } virtual ~Debugger() {} - virtual void attachSession(InterpreterImpl* impl, std::shared_ptr<DebugSession> session) { + virtual void attachSession(const std::string& sessionId, std::shared_ptr<DebugSession> session) { std::lock_guard<std::recursive_mutex> lock(_sessionMutex); - _sessionForInterpreter[impl] = session; + _sessionForInterpreter[sessionId] = session; } - virtual void detachSession(InterpreterImpl* impl) { + virtual void detachSession(const std::string& sessionId) { std::lock_guard<std::recursive_mutex> lock(_sessionMutex); - _sessionForInterpreter.erase(impl); + _sessionForInterpreter.erase(sessionId); } - virtual std::shared_ptr<DebugSession> getSession(InterpreterImpl* impl) { + virtual std::shared_ptr<DebugSession> getSession(const std::string& sessionId) { std::lock_guard<std::recursive_mutex> lock(_sessionMutex); - if (_sessionForInterpreter.find(impl) != _sessionForInterpreter.end()) - return _sessionForInterpreter[impl]; + if (_sessionForInterpreter.find(sessionId) != _sessionForInterpreter.end()) + return _sessionForInterpreter[sessionId]; return std::shared_ptr<DebugSession>(); } virtual void pushData(std::shared_ptr<DebugSession> session, Data pushData) = 0; // InterpreterMonitor - virtual void beforeProcessingEvent(Interpreter& interpreter, const Event& event); - virtual void beforeMicroStep(Interpreter& interpreter); - virtual void beforeExitingState(Interpreter& interpreter, const XERCESC_NS::DOMElement* state); - virtual void afterExitingState(Interpreter& interpreter, const XERCESC_NS::DOMElement* state); - virtual void beforeExecutingContent(Interpreter& interpreter, const XERCESC_NS::DOMElement* execContent); - virtual void afterExecutingContent(Interpreter& interpreter, const XERCESC_NS::DOMElement* execContent); - virtual void beforeUninvoking(Interpreter& interpreter, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid); - virtual void afterUninvoking(Interpreter& interpreter, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid); - virtual void beforeTakingTransition(Interpreter& interpreter, const XERCESC_NS::DOMElement* transition); - virtual void afterTakingTransition(Interpreter& interpreter, const XERCESC_NS::DOMElement* transition); - virtual void beforeEnteringState(Interpreter& interpreter, const XERCESC_NS::DOMElement* state); - virtual void afterEnteringState(Interpreter& interpreter, const XERCESC_NS::DOMElement* state); - virtual void beforeInvoking(Interpreter& interpreter, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid); - virtual void afterInvoking(Interpreter& interpreter, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid); - virtual void afterMicroStep(Interpreter& interpreter); - virtual void onStableConfiguration(Interpreter& interpreter); - virtual void beforeCompletion(Interpreter& interpreter); - virtual void afterCompletion(Interpreter& interpreter); + virtual void beforeProcessingEvent(const std::string& sessionId, const Event& event); + virtual void beforeMicroStep(const std::string& sessionId); + virtual void beforeExitingState(const std::string& sessionId, const std::string& stateName, const XERCESC_NS::DOMElement* state); + virtual void afterExitingState(const std::string& sessionId, const std::string& stateName, const XERCESC_NS::DOMElement* state); + virtual void beforeExecutingContent(const std::string& sessionId, const XERCESC_NS::DOMElement* execContent); + virtual void afterExecutingContent(const std::string& sessionId, const XERCESC_NS::DOMElement* execContent); + virtual void beforeUninvoking(const std::string& sessionId, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid); + virtual void afterUninvoking(const std::string& sessionId, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid); + virtual void beforeTakingTransition(const std::string& sessionId, const XERCESC_NS::DOMElement* transition); + virtual void afterTakingTransition(const std::string& sessionId, const XERCESC_NS::DOMElement* transition); + virtual void beforeEnteringState(const std::string& sessionId, const std::string& stateName, const XERCESC_NS::DOMElement* state); + virtual void afterEnteringState(const std::string& sessionId, const std::string& stateName, const XERCESC_NS::DOMElement* state); + virtual void beforeInvoking(const std::string& sessionId, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid); + virtual void afterInvoking(const std::string& sessionId, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeid); + virtual void afterMicroStep(const std::string& sessionId); + virtual void onStableConfiguration(const std::string& sessionId); + virtual void beforeCompletion(const std::string& sessionId); + virtual void afterCompletion(const std::string& sessionId); protected: - void handleTransition(Interpreter& interpreter, + void handleTransition(const std::string& sessionId, const XERCESC_NS::DOMElement* transition, Breakpoint::When when); - void handleState(Interpreter& interpreter, + void handleState(const std::string& sessionId, const XERCESC_NS::DOMElement* state, Breakpoint::When when, Breakpoint::Action action); - void handleInvoke(Interpreter& interpreter, + void handleInvoke(const std::string& sessionId, const XERCESC_NS::DOMElement* invokeElem, const std::string& invokeId, Breakpoint::When when, Breakpoint::Action action); - void handleExecutable(Interpreter& interpreter, + void handleExecutable(const std::string& sessionId, const XERCESC_NS::DOMElement* execContentElem, Breakpoint::When when); - void handleStable(Interpreter& interpreter, Breakpoint::When when); - void handleMicrostep(Interpreter& interpreter, Breakpoint::When when); - void handleEvent(Interpreter& interpreter, const Event& event, Breakpoint::When when); + void handleStable(const std::string& sessionId, Breakpoint::When when); + void handleMicrostep(const std::string& sessionId, Breakpoint::When when); + void handleEvent(const std::string& sessionId, const Event& event, Breakpoint::When when); - std::list<Breakpoint> getQualifiedTransBreakpoints(InterpreterImpl* impl, + std::list<Breakpoint> getQualifiedTransBreakpoints(const std::string& sessionId, const XERCESC_NS::DOMElement* transition, Breakpoint breakpointTemplate); - std::list<Breakpoint> getQualifiedStateBreakpoints(InterpreterImpl* impl, + std::list<Breakpoint> getQualifiedStateBreakpoints(const std::string& sessionId, const XERCESC_NS::DOMElement* state, Breakpoint breakpointTemplate); - std::list<Breakpoint> getQualifiedInvokeBreakpoints(InterpreterImpl* impl, + std::list<Breakpoint> getQualifiedInvokeBreakpoints(const std::string& sessionId, const XERCESC_NS::DOMElement* invokeElem, const std::string invokeId, Breakpoint breakpointTemplate); std::recursive_mutex _sessionMutex; /// @todo: We ought to change form InterpreterImpl to Interpreter everywhere - std::map<InterpreterImpl*, std::shared_ptr<DebugSession> > _sessionForInterpreter; + std::map<std::string, std::shared_ptr<DebugSession> > _sessionForInterpreter; }; } diff --git a/src/uscxml/debug/DebuggerServlet.cpp b/src/uscxml/debug/DebuggerServlet.cpp index 1d2df6e..74853f4 100644 --- a/src/uscxml/debug/DebuggerServlet.cpp +++ b/src/uscxml/debug/DebuggerServlet.cpp @@ -210,7 +210,7 @@ void DebuggerServlet::processDisconnect(const HTTPServer::Request& request) { replyData.compound["reason"] = Data("No such session", Data::VERBATIM); } else { replyData.compound["status"] = Data("success", Data::VERBATIM); - detachSession(_sessionForId[sessionId]->getInterpreter().getImpl().get()); + detachSession(sessionId); _sessionForId[sessionId]->debugStop(request.data["content"]); _clientConns.erase(_sessionForId[sessionId]); _sendQueues.erase(_sessionForId[sessionId]); |