载入中...
搜索中...
未找到
DevTool.cpp
浏览该文件的文档.
398 return script::projectResult(handle, liveGameWorldSnapshot(), [](Value value) { return value; });
556 consoleTbl.addFunc("eval", [this](std::string expr) { return console().eval(std::move(expr)); });
594 statsTbl.addFunc("hasEntityCount", []() { return FrameStatsPanel::instance().hasEntityCount(); });
686 auto* ev = eve::ModuleManager::getInstance<eve::platform_event::PlatformEvent>("PlatformEvent");
877 ScenarioRecorder::instance().setErrorInfo(report, site.source + ":" + std::to_string(site.line));
905void mcpRecordSnippetError(std::string report) { DevTool::instance().recordMcpSnippetError(std::move(report)); }
Stable, structured diagnostics shared by engine modules.
Runtime game-world Discover snapshot for MCP / Play Host.
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.
The single Squirrel projection for common Result, Status and Value.
Structured operation status used by the common Result foundation.
Share string attribute map operations through the Windows Foundation DLL.
Owning, renderer-independent dynamic values.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
void setErrorHandler(ErrorHandler handler)
Replaces the handler invoked for script errors at the Runtime boundary.
Definition Runtime.h:412
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
static Status failure(StatusCode code, Diagnostic diagnostic)
Construct a failed status with one diagnostic.
Definition Status.cpp:28
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:176
int startDap(uint16_t port)
Start DAP server; returns bound port (0 on failure).
Definition DevTool.cpp:247
void handleDebugEvent(HSQUIRRELVM vm, int type, const char *source, int line, const char *funcname)
Definition DevTool.cpp:613
void attach(ssq::VM &vm, bool sampleLocals=true)
Attach script tracer to VM and enable render tracing.
Definition DevTool.cpp:143
void exposeScriptApi(ssq::VM &vm)
Expose eve.dev script API (pause/breakpoint/watch/snapshot/AI).
Definition DevTool.cpp:274
void drawFrameStatsPanel()
Draw FPS / frame-time overlay when visible (call from UI/frame loop).
Definition DevTool.cpp:272
int startMcp(uint16_t port)
Start MCP server for AI tooling; returns bound port (0 on failure).
Definition DevTool.cpp:251
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:834
void recordMcpSnippetError(std::string report)
Replace the latest diagnostic with an owning MCP snippet report. Main/VM thread only; synchronous,...
Definition DevTool.cpp:899
void drawConsolePanel()
Draw DevTools console ImGui panel when visible (call from UI/frame loop).
Definition DevTool.cpp:270
std::string formatProfileReport() const
Definition DevTool.cpp:938
std::string formatError(const std::string &errorMessage, const std::vector< std::string > &hintVars={}) const
Definition DevTool.cpp:772
void drawAiPanel()
Draw DevTools AI ImGui panel when visible (call from UI/frame loop).
Definition DevTool.cpp:268
SliceResult analyzeError(const std::string &errorMessage, const std::vector< std::string > &hintVars={}) const
Definition DevTool.cpp:740
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:1914
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
Definition ActionGuideExport.cpp:13
std::size_t resourceCacheCount()
Current ResourceManager cache entry count (for restart telemetry).
Definition SoftRestart.cpp:145
@ StepFrame
void clearScriptTools(HSQUIRRELVM owner)
Drop registry entries owned by owner.
Definition McpScriptTools.cpp:327
std::uint32_t resetNativeStateProviders()
Reset every registered IStateProvider to its defaults.
Definition SoftRestart.cpp:134
std::string mcpFormatError(const std::string &message)
Definition DevTool.cpp:909
Result< Value > liveGameWorldSnapshot()
Build the Discover snapshot against the live engine.
Definition GameWorldContext.cpp:292
Result< SoftRestartReport > executeSoftRestart(HSQUIRRELVM vm, SoftRestartRequest request)
Soft-restart the game attached to vm.
Definition SoftRestart.cpp:147
bool mcpDevAttached()
Thin hooks so McpServer.cpp need not include DevTool.hpp (avoids a cycle).
Definition DevTool.cpp:891
void clearWorldContext()
Drop the runtime world brief (soft restart with script reload).
Definition GameWorldContext.cpp:168
void mcpRecordSnippetError(std::string report)
VM-thread-only owning diagnostic publication; clears stale slicing data.
Definition DevTool.cpp:905
void exposeMcpScriptApi(ssq::VM &vm)
Expose eve.mcp.tool/remove/tools/clear/attachEditor/detachEditor on a VM.
Definition McpScriptTools.cpp:336
const Value * runtimeWorldContext() noexcept
Current runtime brief, or null when none is published. @ownership Borrowed; valid until the next publ...
Definition GameWorldContext.cpp:175
Result< void > publishWorldContext(Value world)
Replace the runtime world brief published by the live game script.
Definition GameWorldContext.cpp:160
@ PauseKey
@ Exception
@ Snapshot
Script state was restored while the debugger was already paused.
bool hasWorldContext() noexcept
Whether a runtime brief is currently published.
Definition GameWorldContext.cpp:173
std::string formatScriptError(const ScriptErrorContext &ctx)
Formats a context into a human-readable multi-line report.
Definition ScriptError.cpp:200
ssq::Table projectStatusResult(HSQUIRRELVM vm, const Status &status)
Project a checked native status that carries no payload.
Definition SquirrelBinding.cpp:524
const ScriptErrorContext * peekLastScriptError(HSQUIRRELVM vm)
Peeks at the last recorded error for a VM without clearing it.
Definition ScriptError.cpp:231
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:540
void setLastScriptError(HSQUIRRELVM vm, ScriptErrorContext ctx)
Records the last error for a VM (thread-local, synchronous consumers).
Definition ScriptError.cpp:217
Result< Value > valueFromSquirrel(HSQUIRRELVM vm, SQInteger index, const SquirrelValueOptions &options)
Convert one Squirrel value into the canonical owning Value tree.
Definition SquirrelBinding.cpp:412
ScriptErrorContext captureScriptError(HSQUIRRELVM vm)
Captures the pending runtime error from inside the Squirrel error handler.
Definition ScriptError.cpp:80
@ NotFound
Result< std::string > executeGameplayControlJson(std::string_view requestJson)
Parse, execute and serialize one gameplay-control JSON request.
Definition GameplayControlJson.cpp:378
constexpr std::string_view statusCodeName(StatusCode code) noexcept
Return the stable protocol spelling of a status code.
Definition Status.h:46
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:46