载入中...
搜索中...
未找到
DevTool.cpp
浏览该文件的文档.
529 consoleTbl.addFunc("eval", [this](std::string expr) { return console().eval(std::move(expr)); });
567 statsTbl.addFunc("hasEntityCount", []() { return FrameStatsPanel::instance().hasEntityCount(); });
659 auto* ev = eve::ModuleManager::getInstance<eve::platform_event::PlatformEvent>("PlatformEvent");
850 ScenarioRecorder::instance().setErrorInfo(report, site.source + ":" + std::to_string(site.line));
Versioned JSON facade shared by scripting, MCP and scenario tooling.
Project-script → MCP export registry.
Soft-restart a live game without unloading the resource cache.
void setErrorHandler(ErrorHandler handler)
Replaces the handler invoked for script errors at the Runtime boundary.
Definition Runtime.h:412
std::string statusLine() const
Compact status line for overlays / MCP resources.
Definition AiPanel.cpp:117
void drawImGui()
Optional ImGui draw hook. Default no-op: in-engine AI status is exposed via MCP / eve....
Definition AiPanel.cpp:140
SliceResult sliceBackward(const SliceCriterion &criterion) const
Dynamic backward slice from an error criterion. Follows data dependencies (Use←Def) and control prede...
Definition CallGraph.cpp:315
uint32_t onUse(const SourceLoc &loc, const std::string &var)
Definition CallGraph.cpp:154
std::string formatErrorReport(const std::string &errorMessage, const SliceCriterion &criterion) const
Human-readable report: message + call stack + data-flow + slice locs.
Definition CallGraph.cpp:396
uint32_t onDef(const SourceLoc &loc, const std::string &var)
Definition CallGraph.cpp:139
std::vector< CallFrame > currentStack() const
Definition CallGraph.cpp:211
In-engine runtime console / log ring buffer for DevTools.
Definition ConsolePanel.hpp:58
std::vector< ConsoleLine > recent(size_t max=128) const
Definition ConsolePanel.cpp:285
void addLog(std::string level, std::string text)
Append a leveled log line (thread-safe).
Definition ConsolePanel.cpp:183
std::string eval(const std::string &expression)
Evaluate a Squirrel expression against the root table and return a formatted result (or error message...
Definition ConsolePanel.cpp:332
void attach(HSQUIRRELVM vm)
Attach to a Squirrel VM: capture print/script errors into the log.
Definition ConsolePanel.cpp:303
std::string format(size_t max=128) const
Definition ConsolePanel.cpp:294
void drawImGui()
Optional ImGui draw hook. Default no-op: console UI is registered by the host (see setImGuiDrawer) so...
Definition ConsolePanel.cpp:369
void poll()
Accept clients + process one request batch (non-blocking).
Definition DebugAdapter.cpp:857
int listen(uint16_t port)
Bind TCP listen port (0 = ephemeral). Returns bound port or 0 on failure.
Definition DebugAdapter.cpp:228
void registerSource(std::string name, std::string content)
Register virtual source content for compiled buffers (compilestring).
Definition DebugAdapter.cpp:91
void notifyStopped(PauseReason reason, const SourceLoc &loc, const std::string &description={})
Emit stopped event to the connected client (if any).
Definition DebugAdapter.cpp:357
Script + frame debugger: pause/step, breakpoints, watches.
Definition Debugger.hpp:86
void waitWhilePaused(const std::function< void()> &pump={})
Block until resume/step/detach (processes external poll callbacks).
Definition Debugger.cpp:780
void setBreakOnError(bool on)
Break on script errors (Godot "Break on Error"). Default off.
Definition Debugger.hpp:226
void refreshWatches()
Re-evaluate all watches against current VM (paused preferred).
Definition Debugger.cpp:897
void notifyFrameDone()
After a frame when StepFrame was active → return to Paused.
Definition Debugger.cpp:655
std::string onCall(SourceLoc loc)
Squirrel call debug hook ('c'). Records a frame on the active CallGraph.
Definition Debugger.cpp:500
void pauseAt(PauseReason reason, SourceLoc loc)
Pause and record the script site (copied; Observed until the next pause/resume). Thread: VM / game lo...
Definition Debugger.cpp:564
bool removeWatch(const std::string &expression)
Definition Debugger.cpp:878
void setCallGraph(CallGraph *graph)
Use DevTool's CallGraph for stack names (same object the slicer sees). Pass nullptr to record calls o...
Definition Debugger.cpp:462
void stepOver()
Skip calls: stop on the next line at ≤ current stack depth.
Definition Debugger.cpp:622
bool shouldRunUpdate()
Frame loop: true ⇒ call eve_update this frame. Consumes StepFrame.
Definition Debugger.cpp:645
void pause(PauseReason reason=PauseReason::PauseKey)
Frame-level pause without a script site (PauseKey clears pauseLocation). For Exception / Snapshot,...
Definition Debugger.cpp:553
bool clearBreakpoint(std::string source, int line)
Definition Debugger.cpp:827
void setBreakpointsEnabled(bool on)
Master switch for all breakpoints ("skip all breakpoints").
Definition Debugger.hpp:229
int setBreakpoint(std::string source, int line, bool enabled=true, std::string condition={})
Add or update a line breakpoint. A later call with the same source+line replaces enabled and conditio...
Definition Debugger.cpp:805
void onReturn(const SourceLoc &loc)
Squirrel return debug hook ('r'). Pops the active CallGraph frame.
Definition Debugger.cpp:507
void step()
Convenience: script stepOver when mid-hook; otherwise one game frame. Prefer stepInto/stepOver/stepOu...
Definition Debugger.cpp:633
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,...
Definition Debugger.cpp:1106
void clearBreakpoints(const std::string &source={})
Definition Debugger.cpp:838
Platform-level script + render debugger / dynamic slicer front-end.
Definition DevTool.hpp:50
void enableRenderTrace(bool on=true)
Enable render-flow tracing without a Squirrel VM (C++ / unit tests).
Definition DevTool.cpp:170
int startDap(uint16_t port)
Start DAP server; returns bound port (0 on failure).
Definition DevTool.cpp:241
void handleDebugEvent(HSQUIRRELVM vm, int type, const char *source, int line, const char *funcname)
Definition DevTool.cpp:586
void attach(ssq::VM &vm, bool sampleLocals=true)
Attach script tracer to VM and enable render tracing.
Definition DevTool.cpp:137
void exposeScriptApi(ssq::VM &vm)
Expose eve.dev script API (pause/breakpoint/watch/snapshot/AI).
Definition DevTool.cpp:268
void drawFrameStatsPanel()
Draw FPS / frame-time overlay when visible (call from UI/frame loop).
Definition DevTool.cpp:266
int startMcp(uint16_t port)
Start MCP server for AI tooling; returns bound port (0 on failure).
Definition DevTool.cpp:245
std::string notifyError(const std::string &errorMessage, const std::vector< std::string > &hintVars={})
Record an error; includes script slice and render-pipeline slice when enabled.
Definition DevTool.cpp:807
void drawConsolePanel()
Draw DevTools console ImGui panel when visible (call from UI/frame loop).
Definition DevTool.cpp:264
std::string formatProfileReport() const
Definition DevTool.cpp:903
std::string formatError(const std::string &errorMessage, const std::vector< std::string > &hintVars={}) const
Definition DevTool.cpp:745
void drawAiPanel()
Draw DevTools AI ImGui panel when visible (call from UI/frame loop).
Definition DevTool.cpp:262
SliceResult analyzeError(const std::string &errorMessage, const std::vector< std::string > &hintVars={}) const
Definition DevTool.cpp:713
Lightweight FPS / frame-time overlay for DevTools (0.6 closeout).
Definition FrameStatsPanel.hpp:23
void setEntityCount(int count)
Optional entity / actor count shown in the overlay; negative clears.
Definition FrameStatsPanel.cpp:41
static FrameStatsPanel & instance()
Definition FrameStatsPanel.cpp:14
bool hasEntityCount() const
Definition FrameStatsPanel.cpp:66
void sample(float dtSeconds)
Feed one frame duration in seconds (must be finite and > 0). Updates EMA FPS and last frame milliseco...
Definition FrameStatsPanel.cpp:30
std::string format() const
One-line summary for logs / scripts, e.g. 60.1 fps | 16.6 ms | 128 entities.
Definition FrameStatsPanel.cpp:71
Embedded Model Context Protocol (MCP) server for AI-assisted game development.
Definition McpServer.hpp:35
int listen(uint16_t port)
Bind TCP listen port (0 = ephemeral). Returns bound port or 0 on failure.
Definition McpServer.cpp:2331
std::string formatErrorReport(const std::string &errorMessage, const RenderSliceCriterion &c={}) const
Definition RenderFlow.cpp:231
void notifyPending(const std::string &reason, const std::string &source, int line)
Record that a breakpoint / critical site wants a vision dump.
Definition RenderVision.cpp:146
void setErrorInfo(const std::string &report, const std::string &site)
Called by DevTool when a script error is dumped during recording.
Definition ScenarioRecorder.cpp:87
bool stageFrame()
Re-push the next recorded frame's events into the event queue.
Definition ScenarioRecorder.cpp:136
void cancel()
Abort recording and restore the previous event observer.
Definition ScenarioRecorder.cpp:74
bool begin(HSQUIRRELVM vm, std::string *err=nullptr)
Start recording: capture the baseline snapshot and observe the event queue.
Definition ScenarioRecorder.cpp:36
std::vector< std::string > rootsFor(HSQUIRRELVM vm) const
Marked roots, or heuristic roots when none marked (script-facing).
Definition Snapshot.hpp:62
bool restore(HSQUIRRELVM vm, const std::string &json, std::string *error=nullptr) const
Definition Snapshot.cpp:512
void unmarkTransientRoot(const std::string &name)
Remove an explicit transient-root declaration.
Definition Snapshot.cpp:319
std::string capture(HSQUIRRELVM vm, std::string *error=nullptr) const
Capture marked roots, or heuristic roots when none marked.
Definition Snapshot.cpp:438
bool loadFile(HSQUIRRELVM vm, const std::string &path, std::string *error=nullptr) const
Definition Snapshot.cpp:538
std::vector< std::string > transientRoots() const
Return the explicit transient roots.
Definition Snapshot.cpp:330
void markTransientRoot(std::string name)
Mark a root for reconstruction from new script definitions.
Definition Snapshot.cpp:310
void markRoot(std::string name)
Mark a root as persistent, replacing a transient declaration.
Definition Snapshot.cpp:297
bool saveFile(HSQUIRRELVM vm, const std::string &path, std::string *error=nullptr) const
Definition Snapshot.cpp:526
void unmarkRoot(const std::string &name)
Remove an explicit persistent-root declaration.
Definition Snapshot.cpp:306
void clearRoots()
Clear every explicit persistent and transient declaration.
Definition Snapshot.cpp:323
Definition AgentDevelopmentMcp.cpp:12
std::size_t resourceCacheCount()
Current ResourceManager cache entry count (for restart telemetry).
Definition SoftRestart.cpp:140
@ StepFrame
void clearScriptTools(HSQUIRRELVM owner)
Drop registry entries owned by owner.
Definition McpScriptTools.cpp:322
std::uint32_t resetNativeStateProviders()
Reset every registered IStateProvider to its defaults.
Definition SoftRestart.cpp:132
std::string mcpFormatError(const std::string &message)
Definition DevTool.cpp:874
Result< SoftRestartReport > executeSoftRestart(HSQUIRRELVM vm, SoftRestartRequest request)
Soft-restart the game attached to vm.
Definition SoftRestart.cpp:142
bool mcpDevAttached()
Thin hooks so McpServer.cpp need not include DevTool.hpp (avoids a cycle).
Definition DevTool.cpp:864
void exposeMcpScriptApi(ssq::VM &vm)
Expose eve.mcp.tool/remove/tools/clear on a VM.
Definition McpScriptTools.cpp:331
@ PauseKey
@ Exception
@ Snapshot
Script state was restored while the debugger was already paused.
std::string formatScriptError(const ScriptErrorContext &ctx)
Formats a context into a human-readable multi-line report.
Definition ScriptError.cpp:200
const ScriptErrorContext * peekLastScriptError(HSQUIRRELVM vm)
Peeks at the last recorded error for a VM without clearing it.
Definition ScriptError.cpp:231
void setLastScriptError(HSQUIRRELVM vm, ScriptErrorContext ctx)
Records the last error for a VM (thread-local, synchronous consumers).
Definition ScriptError.cpp:217
ScriptErrorContext captureScriptError(HSQUIRRELVM vm)
Captures the pending runtime error from inside the Squirrel error handler.
Definition ScriptError.cpp:80
Result< std::string > executeGameplayControlJson(std::string_view requestJson)
Parse, execute and serialize one gameplay-control JSON request.
Definition GameplayControlJson.cpp:376
constexpr std::string_view statusCodeName(StatusCode code) noexcept
Return the stable protocol spelling of a status code.
Definition Status.h:45
Definition Container.h:602
Criterion for a Weiser-style dynamic backward slice.
Definition CallGraph.hpp:57
Definition CallGraph.hpp:63
Outcome of a successful soft restart. @ownership Owning value; safe to keep across frames.
Definition SoftRestart.hpp:45
std::size_t resourceCountAfter
Cached resource entries after the restart.
Definition SoftRestart.hpp:49
Inputs for one soft restart. @thread Game / MCP poll thread only.
Definition SoftRestart.hpp:30
bool reloadScripts
When true (default), re-dofile tracked scripts after clearing persist/state roots so initializers run...
Definition SoftRestart.hpp:38
Structured snapshot of a script error: message, throw site and stack.
Definition ScriptError.h:25