Skip to content

Commit fbe26dd

Browse files
authored
Debugger (#1410)
* Add debugger backend. This adds on a debugger to the evaluation loop, that allows for pausing, saving state, then resuming from saved state. * DAP debug server, multi-thread debugging, and iterative interpreter debug support - Add MSDebugServer implementing the Debug Adapter Protocol over TCP, with launch/attach modes, breakpoints, step-over/step-in/step-out, variable inspection, exception breakpoints, and watch expressions - Add multi-thread DAP support: register/unregister threads, per-thread pause states, sync and async stepping modes (sync blocks in place, async snapshots state and resumes on a new thread) - Refactor DebugContext into a full thread-aware debug state manager with per-thread StepMode, ThreadDebugState, and a thread registry for DAP - Add DaemonManager lifecycle listeners and thread-aware waitForThreads, so the debug session stays alive while background threads run - Extract spawnExecutionThread() to centralize execution thread lifecycle (run, await daemons, signal completion) in one place - Fix StackTraceManager thread affinity: remove isDebugAdopted flag so background threads (x_new_thread) get their own STM instead of sharing the main thread's, which was corrupting call depth for step-over - Fix skippingResume flag: clear unconditionally on source line change rather than requiring shouldStop=true, which blocked step-over returns - Add StackTraceFrame.getTarget() for debugger source mapping - Add Breakpoint condition/hitCount/logMessage support - Wire up cmdline interpreter (--debug flag) and lang server for DAP - Add DAPTestHarness and dual sync/async integration tests for step-over and multi-thread step-over scenarios - Add debugger dependency (lsp4j.debug) to pom.xml * Add logpoint support * Add attach mode and KEYPAIR security * Add docs and final touches * Debug infrastructure: managed mode, hit-count dedup, and comprehensive tests - Enable managed execution mode in CommandHelperPlugin so the debug session survives script completion on embedded (Minecraft) servers - Fix hit-count breakpoint deduplication: multiple AST nodes on the same source line no longer increment the hit counter more than once per visit. Uses column-based caching in ThreadDebugState to distinguish "same line, different node" from "new loop iteration, same first node" - Add evaluateBreakpointCondition() to DebugContext with per-thread cache-aware hit-count and condition evaluation - Add Breakpoint.getHitCount() getter - Add MSDebugServer managed mode support: setManagedExecution(), startedOnHostMainThread capture, resumeOnHostMainThread() for resuming on the server main thread, dynamic scripting mode flag in evaluate handler - Add 21 new DAP integration tests (39 total) covering: managed mode step-over, thread events, disconnect; variables/scopes; CArray expansion (indexed, associative, nested); evaluate expressions; exception breakpoints; conditional and hit-count breakpoints; step-in, step-out, step-in targets; disconnect resumes execution * Fix flakey test
1 parent 1eb61de commit fbe26dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+6144
-445
lines changed

pom.xml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@
133133
<properties>
134134
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
135135
<maven.test.failure.ignore>true</maven.test.failure.ignore>
136-
<maven.compiler.source>16</maven.compiler.source>
137-
<maven.compiler.target>16</maven.compiler.target>
136+
<maven.compiler.source>21</maven.compiler.source>
137+
<maven.compiler.target>21</maven.compiler.target>
138138
</properties>
139139
<repositories>
140140
<repository>
@@ -376,6 +376,11 @@
376376
<artifactId>org.eclipse.lsp4j</artifactId>
377377
<version>0.22.0</version>
378378
</dependency>
379+
<dependency>
380+
<groupId>org.eclipse.lsp4j</groupId>
381+
<artifactId>org.eclipse.lsp4j.debug</artifactId>
382+
<version>0.22.0</version>
383+
</dependency>
379384
<dependency>
380385
<groupId>io.swagger.core.v3</groupId>
381386
<artifactId>swagger-annotations</artifactId>
@@ -489,7 +494,7 @@
489494
<version>3.12.1</version>
490495
<configuration>
491496
<showDeprecation>true</showDeprecation>
492-
<release>16</release>
497+
<release>21</release>
493498
<compilerArgs>
494499
<arg>-XDignore.symbol.file</arg>
495500
<arg>-parameters</arg>
@@ -569,6 +574,8 @@
569574
<include>org.brotli:dec:jar:*</include>
570575
<include>org.eclipse.lsp4j:org.eclipse.lsp4j:jar:*</include>
571576
<include>org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc:jar:*</include>
577+
<include>org.eclipse.lsp4j:org.eclipse.lsp4j.debug:jar:*</include>
578+
<include>org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc.debug:jar:*</include>
572579
<!-- We don't currently actually depend on these 2, but lsp4j does, so we
573580
need to shade it in. In the future, we may rip out org.json:json,
574581
and replace it with this, however, in which case we only need to
@@ -842,6 +849,24 @@
842849
<exclude>META-INF/**</exclude>
843850
</excludes>
844851
</filter>
852+
<filter>
853+
<artifact>org.eclipse.lsp4j:org.eclipse.lsp4j.debug:jar:*</artifact>
854+
<includes>
855+
<include>**</include>
856+
</includes>
857+
<excludes>
858+
<exclude>META-INF/**</exclude>
859+
</excludes>
860+
</filter>
861+
<filter>
862+
<artifact>org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc.debug:jar:*</artifact>
863+
<includes>
864+
<include>**</include>
865+
</includes>
866+
<excludes>
867+
<exclude>META-INF/**</exclude>
868+
</excludes>
869+
</filter>
845870
<filter>
846871
<artifact>com.google.code.gson:gson:jar:*</artifact>
847872
<includes>

0 commit comments

Comments
 (0)