![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Singleton that manages runtime debugging of VS graphs. More...
#include <DebugController.h>
Collaboration diagram for Olympe::DebugController:Public Member Functions | |
| void | SetBreakpoint (int graphID, int nodeID, const std::string &graphName="", const std::string &nodeName="") |
| Registers a breakpoint at (graphID, nodeID). | |
| void | ClearBreakpoint (int graphID, int nodeID) |
| Removes the breakpoint at (graphID, nodeID) if it exists. | |
| void | ToggleBreakpoint (int graphID, int nodeID, const std::string &graphName="", const std::string &nodeName="") |
| Toggles the breakpoint at (graphID, nodeID). | |
| bool | HasBreakpoint (int graphID, int nodeID) const |
| Returns true if an enabled breakpoint exists at (graphID, nodeID). | |
| void | SetBreakpointEnabled (int graphID, int nodeID, bool enabled) |
| Enables or disables an existing breakpoint. | |
| std::vector< BreakpointInfo > | GetBreakpoints (int graphID) const |
Returns all registered breakpoints for graphID. | |
| std::vector< BreakpointInfo > | GetAllBreakpoints () const |
| Returns all registered breakpoints across all graphs. | |
| void | ClearAllBreakpoints () |
| Removes all breakpoints. | |
| void | StartDebugging (int graphID) |
| Starts a debug session for the given graph. | |
| void | StopDebugging () |
| Stops the current debug session. | |
| void | Continue () |
| Resumes execution from Paused state. | |
| void | Pause () |
| Pauses execution. | |
| void | StepNext () |
| Executes the next node then pauses. | |
| void | StepInto () |
| Steps into a SubGraph if the next node is a SubGraph node. | |
| void | StepOut () |
| Runs until the current SubGraph returns. | |
| DebugState | GetState () const |
| Returns the current debug state. | |
| bool | IsDebugging () const |
| Returns true when a debug session is active. | |
| int | GetCurrentGraphID () const |
| Returns the currently debugged graphID (-1 if none). | |
| int | GetCurrentNodeID () const |
| Returns the node being executed (-1 if none). | |
| LocalBlackboard | GetCurrentBlackboard () const |
| Returns a copy of the blackboard snapshot from the last OnNodeExecuting() call. | |
| std::vector< SubGraphStackFrame > | GetCallStack () const |
| Returns the current SubGraph call stack (most recent at front). | |
| void | OnNodeExecuting (int graphID, int nodeID, const LocalBlackboard *bb) |
| Called by VSGraphExecutor before executing a node. | |
| void | PushCallFrame (int graphID, int nodeID, const std::string &graphName="", const std::string &nodeName="") |
| Push a SubGraph frame onto the call stack. | |
| void | PopCallFrame () |
| Pop the top SubGraph frame from the call stack. | |
| void | SetHeadlessMode (bool headless) |
| When true, OnNodeExecuting() never busy-waits on Paused. | |
Static Public Member Functions | |
| static DebugController & | Get () |
| Returns the singleton instance (Meyers pattern). | |
Private Member Functions | |
| DebugController () | |
| ~DebugController () | |
| DebugController (const DebugController &)=delete | |
| DebugController & | operator= (const DebugController &)=delete |
| int | MakeBreakpointKey (int graphID, int nodeID) const |
| bool | HasBreakpointLocked (int graphID, int nodeID) const |
Private Attributes | |
| std::mutex | m_mutex |
| DebugState | m_state = DebugState::NotDebugging |
| int | m_currentGraphID = -1 |
| int | m_currentNodeID = -1 |
| bool | m_headlessMode = false |
| LocalBlackboard | m_bbSnapshot |
| std::unordered_map< int, BreakpointInfo > | m_breakpoints |
| Breakpoints keyed by (graphID * 100000 + nodeID) | |
| std::vector< SubGraphStackFrame > | m_callStack |
| Call stack (index 0 = bottom / entry, back = current) | |
Singleton that manages runtime debugging of VS graphs.
Usage:
Meyers singleton pattern (local static in Get()). Thread-safe via std::mutex.
Definition at line 109 of file DebugController.h.
|
private |
Definition at line 28 of file DebugController.cpp.
|
private |
Definition at line 32 of file DebugController.cpp.
|
privatedelete |
| void Olympe::DebugController::ClearAllBreakpoints | ( | ) |
Removes all breakpoints.
Definition at line 145 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_breakpoints, and m_mutex.
Here is the call graph for this function:Removes the breakpoint at (graphID, nodeID) if it exists.
Definition at line 75 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_breakpoints, m_mutex, and MakeBreakpointKey().
Here is the call graph for this function:| void Olympe::DebugController::Continue | ( | ) |
Resumes execution from Paused state.
Transitions Paused -> Running.
Definition at line 173 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_mutex, m_state, Olympe::Paused, and Olympe::Running.
Here is the call graph for this function:
|
static |
Returns the singleton instance (Meyers pattern).
Definition at line 22 of file DebugController.cpp.
References GetComponentTypeID_Static().
Referenced by Olympe::DebugPanel::RenderBreakpointsList(), Olympe::DebugPanel::RenderCallStack(), Olympe::VisualScriptEditorPanel::RenderNodePropertiesPanelContent(), Olympe::VisualScriptEditorPanel::RenderSwitchNodeProperties(), Olympe::DebugPanel::RenderToolbar(), and Olympe::DebugPanel::RenderWatchVariables().
Here is the call graph for this function:
Here is the caller graph for this function:| std::vector< BreakpointInfo > Olympe::DebugController::GetAllBreakpoints | ( | ) | const |
Returns all registered breakpoints across all graphs.
Definition at line 134 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_breakpoints, and m_mutex.
Here is the call graph for this function:| std::vector< BreakpointInfo > Olympe::DebugController::GetBreakpoints | ( | int | graphID | ) | const |
Returns all registered breakpoints for graphID.
Definition at line 122 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_breakpoints, and m_mutex.
Here is the call graph for this function:| std::vector< SubGraphStackFrame > Olympe::DebugController::GetCallStack | ( | ) | const |
Returns the current SubGraph call stack (most recent at front).
Definition at line 252 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_callStack, and m_mutex.
Here is the call graph for this function:| LocalBlackboard Olympe::DebugController::GetCurrentBlackboard | ( | ) | const |
Returns a copy of the blackboard snapshot from the last OnNodeExecuting() call.
Definition at line 246 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_bbSnapshot, and m_mutex.
Here is the call graph for this function:| int Olympe::DebugController::GetCurrentGraphID | ( | ) | const |
Returns the currently debugged graphID (-1 if none).
Definition at line 234 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_currentGraphID, and m_mutex.
Here is the call graph for this function:| int Olympe::DebugController::GetCurrentNodeID | ( | ) | const |
Returns the node being executed (-1 if none).
Definition at line 240 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_currentNodeID, and m_mutex.
Here is the call graph for this function:| DebugState Olympe::DebugController::GetState | ( | ) | const |
Returns the current debug state.
Definition at line 222 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_mutex, and m_state.
Here is the call graph for this function:Returns true if an enabled breakpoint exists at (graphID, nodeID).
Definition at line 105 of file DebugController.cpp.
References GetComponentTypeID_Static(), HasBreakpointLocked(), and m_mutex.
Referenced by Olympe::VisualScriptEditorPanel::RenderNodePropertiesPanelContent(), and Olympe::VisualScriptEditorPanel::RenderSwitchNodeProperties().
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 47 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_breakpoints, and MakeBreakpointKey().
Referenced by HasBreakpoint(), and OnNodeExecuting().
Here is the call graph for this function:
Here is the caller graph for this function:| bool Olympe::DebugController::IsDebugging | ( | ) | const |
Returns true when a debug session is active.
Definition at line 228 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_mutex, m_state, and Olympe::NotDebugging.
Here is the call graph for this function:Definition at line 40 of file DebugController.cpp.
Referenced by ClearBreakpoint(), HasBreakpointLocked(), SetBreakpoint(), SetBreakpointEnabled(), and ToggleBreakpoint().
Here is the caller graph for this function:| void Olympe::DebugController::OnNodeExecuting | ( | int | graphID, |
| int | nodeID, | ||
| const LocalBlackboard * | bb | ||
| ) |
Called by VSGraphExecutor before executing a node.
Updates the current node/graph and blackboard snapshot. If a breakpoint is hit and state is Running, transitions to Paused. If state is StepNext, transitions to Paused after the first call.
| graphID | Graph being executed. |
| nodeID | Node about to be executed. |
| bb | Live blackboard pointer (snapshot is copied). |
Definition at line 262 of file DebugController.cpp.
References GetComponentTypeID_Static(), HasBreakpointLocked(), m_bbSnapshot, m_currentGraphID, m_currentNodeID, m_headlessMode, m_mutex, m_state, Olympe::NotDebugging, Olympe::Paused, Olympe::Running, Olympe::StepInto, and Olympe::StepNext.
Here is the call graph for this function:
|
privatedelete |
| void Olympe::DebugController::Pause | ( | ) |
Pauses execution.
Transitions Running -> Paused.
Definition at line 182 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_mutex, m_state, Olympe::Paused, and Olympe::Running.
Here is the call graph for this function:| void Olympe::DebugController::PopCallFrame | ( | ) |
Pop the top SubGraph frame from the call stack.
Called by VSGraphExecutor when returning from a SubGraph.
Definition at line 341 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_callStack, m_mutex, m_state, Olympe::Paused, and Olympe::StepOut.
Here is the call graph for this function:| void Olympe::DebugController::PushCallFrame | ( | int | graphID, |
| int | nodeID, | ||
| const std::string & | graphName = "", |
||
| const std::string & | nodeName = "" |
||
| ) |
Push a SubGraph frame onto the call stack.
Called by VSGraphExecutor when entering a SubGraph.
Definition at line 322 of file DebugController.cpp.
References GetComponentTypeID_Static(), Olympe::SubGraphStackFrame::graphID, Olympe::SubGraphStackFrame::graphName, Olympe::SubGraphStackFrame::isCurrent, m_callStack, m_mutex, Olympe::SubGraphStackFrame::nodeID, and Olympe::SubGraphStackFrame::nodeName.
Here is the call graph for this function:| void Olympe::DebugController::SetBreakpoint | ( | int | graphID, |
| int | nodeID, | ||
| const std::string & | graphName = "", |
||
| const std::string & | nodeName = "" |
||
| ) |
Registers a breakpoint at (graphID, nodeID).
Safe to call multiple times — idempotent.
Definition at line 60 of file DebugController.cpp.
References GetComponentTypeID_Static(), Olympe::BreakpointInfo::graphID, m_breakpoints, m_mutex, and MakeBreakpointKey().
Here is the call graph for this function:Enables or disables an existing breakpoint.
Definition at line 111 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_breakpoints, m_mutex, and MakeBreakpointKey().
Here is the call graph for this function:When true, OnNodeExecuting() never busy-waits on Paused.
Useful for unit tests where there is no UI thread to call Continue().
Definition at line 362 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_headlessMode, and m_mutex.
Here is the call graph for this function:Starts a debug session for the given graph.
Transitions from NotDebugging -> Running.
Definition at line 155 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_callStack, m_currentGraphID, m_currentNodeID, m_mutex, m_state, and Olympe::Running.
Here is the call graph for this function:| void Olympe::DebugController::StepInto | ( | ) |
Steps into a SubGraph if the next node is a SubGraph node.
Transitions Paused -> StepInto.
Definition at line 200 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_mutex, m_state, Olympe::Paused, and Olympe::StepInto.
Here is the call graph for this function:| void Olympe::DebugController::StepNext | ( | ) |
Executes the next node then pauses.
Transitions Paused -> StepNext.
Definition at line 191 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_mutex, m_state, Olympe::Paused, and Olympe::StepNext.
Here is the call graph for this function:| void Olympe::DebugController::StepOut | ( | ) |
Runs until the current SubGraph returns.
Transitions Paused -> StepOut.
Definition at line 209 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_mutex, m_state, Olympe::Paused, and Olympe::StepOut.
Here is the call graph for this function:| void Olympe::DebugController::StopDebugging | ( | ) |
Stops the current debug session.
Transitions to NotDebugging from any state.
Definition at line 164 of file DebugController.cpp.
References GetComponentTypeID_Static(), m_callStack, m_currentGraphID, m_currentNodeID, m_mutex, m_state, and Olympe::NotDebugging.
Here is the call graph for this function:| void Olympe::DebugController::ToggleBreakpoint | ( | int | graphID, |
| int | nodeID, | ||
| const std::string & | graphName = "", |
||
| const std::string & | nodeName = "" |
||
| ) |
Toggles the breakpoint at (graphID, nodeID).
Adds it if absent, removes it if present.
Definition at line 82 of file DebugController.cpp.
References GetComponentTypeID_Static(), Olympe::BreakpointInfo::graphID, m_breakpoints, m_mutex, and MakeBreakpointKey().
Referenced by Olympe::VisualScriptEditorPanel::RenderNodePropertiesPanelContent(), and Olympe::VisualScriptEditorPanel::RenderSwitchNodeProperties().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 312 of file DebugController.h.
Referenced by GetCurrentBlackboard(), and OnNodeExecuting().
|
private |
Breakpoints keyed by (graphID * 100000 + nodeID)
Definition at line 315 of file DebugController.h.
Referenced by ClearAllBreakpoints(), ClearBreakpoint(), GetAllBreakpoints(), GetBreakpoints(), HasBreakpointLocked(), SetBreakpoint(), SetBreakpointEnabled(), and ToggleBreakpoint().
|
private |
Call stack (index 0 = bottom / entry, back = current)
Definition at line 318 of file DebugController.h.
Referenced by GetCallStack(), PopCallFrame(), PushCallFrame(), StartDebugging(), and StopDebugging().
|
private |
Definition at line 308 of file DebugController.h.
Referenced by GetCurrentGraphID(), OnNodeExecuting(), StartDebugging(), and StopDebugging().
|
private |
Definition at line 309 of file DebugController.h.
Referenced by GetCurrentNodeID(), OnNodeExecuting(), StartDebugging(), and StopDebugging().
Definition at line 310 of file DebugController.h.
Referenced by OnNodeExecuting(), and SetHeadlessMode().
|
mutableprivate |
Definition at line 305 of file DebugController.h.
Referenced by ClearAllBreakpoints(), ClearBreakpoint(), Continue(), GetAllBreakpoints(), GetBreakpoints(), GetCallStack(), GetCurrentBlackboard(), GetCurrentGraphID(), GetCurrentNodeID(), GetState(), HasBreakpoint(), IsDebugging(), OnNodeExecuting(), Pause(), PopCallFrame(), PushCallFrame(), SetBreakpoint(), SetBreakpointEnabled(), SetHeadlessMode(), StartDebugging(), StepInto(), StepNext(), StepOut(), StopDebugging(), and ToggleBreakpoint().
|
private |
Definition at line 307 of file DebugController.h.
Referenced by Continue(), GetState(), IsDebugging(), OnNodeExecuting(), Pause(), PopCallFrame(), StartDebugging(), StepInto(), StepNext(), StepOut(), and StopDebugging().