Script + frame debugger: pause/step, breakpoints, watches. 更多...
#include <Debugger.hpp>
Public 类型 | |
| using | BreakpointEventFn = std::function< void(int id, const std::string &source, int line, bool verified)> |
| Called once when a breakpoint line is first observed by the line hook. | |
| using | PumpFn = std::function< void()> |
Public 成员函数 | |
| Debugger (const Debugger &)=delete | |
| Debugger & | operator= (const Debugger &)=delete |
| void | attach (HSQUIRRELVM vm) |
| void | detach () |
| bool | isAttached () const |
| HSQUIRRELVM | vm () const |
| void | pause (PauseReason reason=PauseReason::PauseKey) |
| void | resume () |
| void | stepFrame () |
| void | stepInto () |
| Enter calls: stop on the next script line at any depth. | |
| void | stepOver () |
| Skip calls: stop on the next line at ≤ current stack depth. | |
| void | stepOut () |
| Finish current function: stop when stack depth drops. | |
| void | stepLine () |
| Alias for stepInto (historical name). | |
| void | step () |
| Convenience: script stepOver when mid-hook; otherwise one game frame. Prefer stepInto/stepOver/stepOut from DAP / UI. | |
| bool | isPaused () const |
| RunMode | mode () const |
| PauseReason | lastPauseReason () const |
| const SourceLoc & | pauseLocation () const |
| int | scriptStackDepth () const |
| Current Squirrel call depth (1 = topmost script frame). 0 if none. | |
| bool | shouldRunUpdate () |
| Frame loop: true ⇒ call eve_update this frame. Consumes StepFrame. | |
| void | notifyFrameDone () |
| After a frame when StepFrame was active → return to Paused. | |
| bool | onScriptLine (const SourceLoc &loc) |
| Called from Squirrel line debug hook. Returns true if execution should block (breakpoint / step). | |
| void | waitWhilePaused (const std::function< void()> &pump={}) |
| Block until resume/step/detach (processes external poll callbacks). | |
| int | setBreakpoint (std::string source, int line, bool enabled=true, std::string condition={}) |
| bool | clearBreakpoint (std::string source, int line) |
| void | clearBreakpoints (const std::string &source={}) |
| std::vector< Breakpoint > | breakpoints () const |
| bool | hasBreakpoint (const std::string &source, int line) const |
| void | addWatch (std::string expression) |
| bool | removeWatch (const std::string &expression) |
| void | clearWatches () |
| std::vector< WatchEntry > | watches () const |
| void | refreshWatches () |
| Re-evaluate all watches against current VM (paused preferred). | |
| VariableInfo | evaluate (const std::string &expression, int frameLevel=0) const |
Evaluate an expression in the given frame's scope. Understands plain names, a.b paths, and full Squirrel expressions (arithmetic / calls / indexing) compiled against a locals+roottable env. | |
| std::vector< VariableInfo > | locals (int stackLevel=0) const |
| Locals of the given call-stack level (0 = current script frame). | |
| std::vector< VariableInfo > | globals () const |
| Root-table slots (globals). | |
| std::vector< VariableInfo > | containerChildren (VarKind kind, int frame, const std::vector< std::string > &path) const |
Children of a container variable. path is the key chain that locates the container from its root (locals frame / roottable / upvalues). Empty path lists the root entries themselves. | |
| std::vector< StackFrameInfo > | stackTrace (int maxFrames=32) const |
| void | setBreakOnError (bool on) |
| Break on script errors (Godot "Break on Error"). Default off. | |
| bool | breakOnError () const |
| void | setBreakpointsEnabled (bool on) |
| Master switch for all breakpoints ("skip all breakpoints"). | |
| bool | breakpointsEnabled () const |
| void | setBreakpointEventFn (BreakpointEventFn fn) |
| void | setPump (PumpFn pump) |
静态 Public 成员函数 | |
| static Debugger & | instance () |
| static std::string | normalizeSource (std::string source) |
| Normalize source paths for breakpoint matching (basename fallback). | |
| static std::string | sourceBasename (const std::string &source) |
| Basename of a normalized path (empty-safe). | |
| static bool | sourcesMatch (const std::string &a, const std::string &b) |
| True when two source paths refer to the same script file. Matches exact path, basename, or one path as a suffix of the other. | |
详细描述
Script + frame debugger: pause/step, breakpoints, watches.
Frame pause: game loop skips eve_update (see load.nut + shouldRunUpdate). Script pause: Squirrel line hook blocks until resume/step (waitWhilePaused).
Stepping (script, when stopped on a line):
- stepInto — stop on the next line event (enter calls)
- stepOver — stop on the next line at the same / outer stack depth
- stepOut — stop after returning to the caller
在文件 Debugger.hpp 第 83 行定义.
成员类型定义说明
◆ BreakpointEventFn
| using eve::dev::Debugger::BreakpointEventFn = std::function<void(int id, const std::string& source, int line, bool verified)> |
Called once when a breakpoint line is first observed by the line hook.
在文件 Debugger.hpp 第 174 行定义.
◆ PumpFn
| using eve::dev::Debugger::PumpFn = std::function<void()> |
在文件 Debugger.hpp 第 178 行定义.
构造及析构函数说明
◆ Debugger()
|
delete |
成员函数说明
◆ addWatch()
| void eve::dev::Debugger::addWatch | ( | std::string | expression | ) |
在文件 Debugger.cpp 第 635 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ attach()
| void eve::dev::Debugger::attach | ( | HSQUIRRELVM | vm | ) |
在文件 Debugger.cpp 第 351 行定义.
引用了 eve::dev::None, eve::dev::Running , 以及 vm().
被这些函数引用 eve::dev::DevTool::attach().
◆ breakOnError()
|
inline |
在文件 Debugger.hpp 第 169 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ breakpoints()
| std::vector< Breakpoint > eve::dev::Debugger::breakpoints | ( | ) | const |
在文件 Debugger.cpp 第 625 行定义.
◆ breakpointsEnabled()
|
inline |
在文件 Debugger.hpp 第 172 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ clearBreakpoint()
| bool eve::dev::Debugger::clearBreakpoint | ( | std::string | source, |
| int | line | ||
| ) |
在文件 Debugger.cpp 第 603 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ clearBreakpoints()
| void eve::dev::Debugger::clearBreakpoints | ( | const std::string & | source = {} | ) |
在文件 Debugger.cpp 第 614 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ clearWatches()
| void eve::dev::Debugger::clearWatches | ( | ) |
在文件 Debugger.cpp 第 652 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ containerChildren()
| std::vector< VariableInfo > eve::dev::Debugger::containerChildren | ( | VarKind | kind, |
| int | frame, | ||
| const std::vector< std::string > & | path | ||
| ) | const |
Children of a container variable. path is the key chain that locates the container from its root (locals frame / roottable / upvalues). Empty path lists the root entries themselves.
在文件 Debugger.cpp 第 853 行定义.
引用了 eve::dev::Globals, globals(), kind, eve::dev::Locals, locals() , 以及 vm().
◆ detach()
| void eve::dev::Debugger::detach | ( | ) |
在文件 Debugger.cpp 第 360 行定义.
引用了 eve::dev::None , 以及 eve::dev::Running.
被这些函数引用 eve::dev::DevTool::detach().
◆ evaluate()
| VariableInfo eve::dev::Debugger::evaluate | ( | const std::string & | expression, |
| int | frameLevel = 0 |
||
| ) | const |
Evaluate an expression in the given frame's scope. Understands plain names, a.b paths, and full Squirrel expressions (arithmetic / calls / indexing) compiled against a locals+roottable env.
在文件 Debugger.cpp 第 872 行定义.
引用了 eve::script::captureCompileError(), eve::script::ScriptErrorContext::empty(), eve::script::formatScriptError(), n, eve::dev::VariableInfo::name, eve::script::takeLastScriptError(), eve::dev::VariableInfo::type, eve::dev::VariableInfo::value , 以及 vm().
被这些函数引用 eve::dev::DevTool::exposeScriptApi() , 以及 refreshWatches().
◆ globals()
| std::vector< VariableInfo > eve::dev::Debugger::globals | ( | ) | const |
◆ hasBreakpoint()
| bool eve::dev::Debugger::hasBreakpoint | ( | const std::string & | source, |
| int | line | ||
| ) | const |
在文件 Debugger.cpp 第 630 行定义.
引用了 line.
◆ instance()
|
static |
◆ isAttached()
|
inline |
在文件 Debugger.hpp 第 92 行定义.
◆ isPaused()
|
inline |
在文件 Debugger.hpp 第 112 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ lastPauseReason()
|
inline |
在文件 Debugger.hpp 第 114 行定义.
◆ locals()
| std::vector< VariableInfo > eve::dev::Debugger::locals | ( | int | stackLevel = 0 | ) | const |
Locals of the given call-stack level (0 = current script frame).
在文件 Debugger.cpp 第 781 行定义.
引用了 n, eve::dev::VariableInfo::name, name , 以及 vm().
被这些函数引用 containerChildren().
◆ mode()
|
inline |
在文件 Debugger.hpp 第 113 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ normalizeSource()
|
static |
Normalize source paths for breakpoint matching (basename fallback).
在文件 Debugger.cpp 第 309 行定义.
引用了 c.
被这些函数引用 eve::dev::DebugAdapter::registerSource(), setBreakpoint(), sourceBasename() , 以及 sourcesMatch().
◆ notifyFrameDone()
| void eve::dev::Debugger::notifyFrameDone | ( | ) |
After a frame when StepFrame was active → return to Paused.
在文件 Debugger.cpp 第 453 行定义.
引用了 eve::dev::Paused, eve::dev::Step , 以及 eve::dev::StepFrame.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ onScriptLine()
| bool eve::dev::Debugger::onScriptLine | ( | const SourceLoc & | loc | ) |
Called from Squirrel line debug hook. Returns true if execution should block (breakpoint / step).
在文件 Debugger.cpp 第 488 行定义.
引用了 eve::dev::Breakpoint, depth, eve::dev::SourceLoc::empty(), eve::dev::RenderVision::instance(), eve::dev::SourceLoc::line, m, eve::dev::RenderVision::notifyPending(), eve::dev::Paused, scriptStackDepth(), eve::dev::SourceLoc::source, sourcesMatch(), eve::dev::Step, eve::dev::StepInto, eve::dev::StepOut , 以及 eve::dev::StepOver.
◆ operator=()
◆ pause()
| void eve::dev::Debugger::pause | ( | PauseReason | reason = PauseReason::PauseKey | ) |
在文件 Debugger.cpp 第 368 行定义.
引用了 eve::dev::Paused , 以及 eve::dev::PauseKey.
被这些函数引用 eve::dev::DevTool::exposeScriptApi() , 以及 eve::dev::DevTool::notifyError().
◆ pauseLocation()
|
inline |
在文件 Debugger.hpp 第 115 行定义.
◆ refreshWatches()
| void eve::dev::Debugger::refreshWatches | ( | ) |
Re-evaluate all watches against current VM (paused preferred).
在文件 Debugger.cpp 第 663 行定义.
引用了 evaluate(), eve::dev::WatchEntry::expression , 以及 w.
◆ removeWatch()
| bool eve::dev::Debugger::removeWatch | ( | const std::string & | expression | ) |
在文件 Debugger.cpp 第 644 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ resume()
| void eve::dev::Debugger::resume | ( | ) |
在文件 Debugger.cpp 第 376 行定义.
引用了 eve::dev::None , 以及 eve::dev::Running.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ scriptStackDepth()
| int eve::dev::Debugger::scriptStackDepth | ( | ) | const |
Current Squirrel call depth (1 = topmost script frame). 0 if none.
在文件 Debugger.cpp 第 391 行定义.
被这些函数引用 onScriptLine() , 以及 stepOut().
◆ setBreakOnError()
|
inline |
Break on script errors (Godot "Break on Error"). Default off.
在文件 Debugger.hpp 第 168 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ setBreakpoint()
| int eve::dev::Debugger::setBreakpoint | ( | std::string | source, |
| int | line, | ||
| bool | enabled = true, |
||
| std::string | condition = {} |
||
| ) |
◆ setBreakpointEventFn()
|
inline |
在文件 Debugger.hpp 第 176 行定义.
引用了 fn.
被这些函数引用 eve::dev::DebugAdapter::listen() , 以及 eve::dev::DebugAdapter::stop().
◆ setBreakpointsEnabled()
|
inline |
Master switch for all breakpoints ("skip all breakpoints").
在文件 Debugger.hpp 第 171 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ setPump()
|
inline |
在文件 Debugger.hpp 第 179 行定义.
被这些函数引用 eve::dev::DevTool::attach().
◆ shouldRunUpdate()
| bool eve::dev::Debugger::shouldRunUpdate | ( | ) |
Frame loop: true ⇒ call eve_update this frame. Consumes StepFrame.
在文件 Debugger.cpp 第 443 行定义.
引用了 m, eve::dev::Running, eve::dev::StepFrame, eve::dev::StepInto, eve::dev::StepOut , 以及 eve::dev::StepOver.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ sourceBasename()
|
static |
Basename of a normalized path (empty-safe).
在文件 Debugger.cpp 第 326 行定义.
引用了 normalizeSource().
被这些函数引用 sourcesMatch().
◆ sourcesMatch()
|
static |
True when two source paths refer to the same script file. Matches exact path, basename, or one path as a suffix of the other.
在文件 Debugger.cpp 第 332 行定义.
引用了 a, b, idx, normalizeSource() , 以及 sourceBasename().
被这些函数引用 onScriptLine().
◆ stackTrace()
| std::vector< StackFrameInfo > eve::dev::Debugger::stackTrace | ( | int | maxFrames = 32 | ) | const |
在文件 Debugger.cpp 第 934 行定义.
引用了 f, eve::dev::StackFrameInfo::id , 以及 vm().
◆ step()
| void eve::dev::Debugger::step | ( | ) |
Convenience: script stepOver when mid-hook; otherwise one game frame. Prefer stepInto/stepOver/stepOut from DAP / UI.
在文件 Debugger.cpp 第 432 行定义.
引用了 eve::dev::Breakpoint, eve::dev::SourceLoc::empty(), eve::dev::Exception, eve::dev::Step, stepFrame() , 以及 stepOver().
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ stepFrame()
| void eve::dev::Debugger::stepFrame | ( | ) |
在文件 Debugger.cpp 第 385 行定义.
引用了 eve::dev::Step , 以及 eve::dev::StepFrame.
被这些函数引用 eve::dev::DevTool::exposeScriptApi() , 以及 step().
◆ stepInto()
| void eve::dev::Debugger::stepInto | ( | ) |
Enter calls: stop on the next script line at any depth.
在文件 Debugger.cpp 第 419 行定义.
引用了 eve::dev::StepInto.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ stepLine()
|
inline |
Alias for stepInto (historical name).
在文件 Debugger.hpp 第 106 行定义.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ stepOut()
| void eve::dev::Debugger::stepOut | ( | ) |
Finish current function: stop when stack depth drops.
在文件 Debugger.cpp 第 423 行定义.
引用了 scriptStackDepth(), eve::dev::StepOut , 以及 eve::dev::StepOver.
被这些函数引用 eve::dev::DevTool::exposeScriptApi().
◆ stepOver()
| void eve::dev::Debugger::stepOver | ( | ) |
Skip calls: stop on the next line at ≤ current stack depth.
在文件 Debugger.cpp 第 421 行定义.
引用了 eve::dev::StepOver.
被这些函数引用 eve::dev::DevTool::exposeScriptApi() , 以及 step().
◆ vm()
|
inline |
在文件 Debugger.hpp 第 93 行定义.
被这些函数引用 attach(), containerChildren(), evaluate(), globals(), locals(), scriptStackDepth() , 以及 stackTrace().
◆ waitWhilePaused()
| void eve::dev::Debugger::waitWhilePaused | ( | const std::function< void()> & | pump = {} | ) |
Block until resume/step/detach (processes external poll callbacks).
在文件 Debugger.cpp 第 572 行定义.
引用了 eve::dev::Paused.
被这些函数引用 eve::dev::DevTool::handleDebugEvent() , 以及 eve::dev::DevTool::notifyError().
◆ watches()
| std::vector< WatchEntry > eve::dev::Debugger::watches | ( | ) | const |
在文件 Debugger.cpp 第 658 行定义.
该类的文档由以下文件生成:
- src/engine/devtools/Debugger.hpp
- src/engine/devtools/Debugger.cpp