Skip to content

Commit 4b16729

Browse files
committed
updated the code for 0.6.0 version
1 parent 160b258 commit 4b16729

4 files changed

Lines changed: 86 additions & 57 deletions

File tree

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22

33
All notable changes to the XSLT Debugger extension will be documented in this file.
44

5+
## [0.6.0] - 2025
6+
7+
### Added
8+
9+
- Paired `template-entry`/`template-exit` instrumentation in both engines so call depth is tracked reliably.
10+
- Interactive console `StepIntoTest` highlights template markers while stepping through call-template scenarios.
11+
- Dedicated `StepIntoTests` suite covering step-into, step-over, and step-out flows for compiled and Saxon engines (115 tests total).
12+
13+
### Changed
14+
15+
- Step mode controller records the originating stop location to decide when `Step Over` and `Step Out` should halt.
16+
- Saxon instrumentation always emits probes for `xsl:call-template`, even when sibling probes exist, ensuring the line after the call is reachable.
17+
- Documentation references the 0.6.0 VSIX packages and explains the new stepping behaviour.
18+
19+
### Fixed
20+
21+
- `Step Over` no longer runs the Saxon engine to completion after an `xsl:call-template`; execution now pauses on the next statement.
22+
- `Step Out` consistently returns to the caller template thanks to call-depth unwinding and exit probes.
23+
524
## [0.0.3] - 2025
625

726
### Fixed

README.md

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ These tradeoffs ensure reliable, cross-platform debugging without slowing down t
106106

107107
```bash
108108
# macOS
109-
code --install-extension xsltdebugger-darwin-darwin-arm64-0.5.0.vsix
109+
code --install-extension xsltdebugger-darwin-darwin-arm64-0.6.0.vsix
110110

111111
# Windows
112-
code --install-extension xsltdebugger-windows-win32-x64-0.5.0.vsix
112+
code --install-extension xsltdebugger-windows-win32-x64-0.6.0.vsix
113113
```
114114

115115
2. **Create a debug configuration** in [.vscode/launch.json](#setting-up-a-debug-configuration)
@@ -138,19 +138,19 @@ These tradeoffs ensure reliable, cross-platform debugging without slowing down t
138138

139139
```bash
140140
./package-all.sh
141-
code --install-extension xsltdebugger-darwin-darwin-arm64-0.5.0.vsix
141+
code --install-extension xsltdebugger-darwin-darwin-arm64-0.6.0.vsix
142142
```
143143

144144
**Platform-specific packaging** (build individually):
145145

146146
```bash
147147
# For macOS only
148148
./package-darwin.sh
149-
code --install-extension xsltdebugger-darwin-darwin-arm64-0.5.0.vsix
149+
code --install-extension xsltdebugger-darwin-darwin-arm64-0.6.0.vsix
150150

151151
# For Windows only
152152
./package-win.sh
153-
code --install-extension xsltdebugger-windows-win32-x64-0.5.0.vsix
153+
code --install-extension xsltdebugger-windows-win32-x64-0.6.0.vsix
154154
```
155155

156156
## Usage
@@ -417,47 +417,31 @@ The workflow is split between a lightweight VS Code entry point and a .NET debu
417417

418418
See the [CHANGELOG](CHANGELOG.md) for detailed version history.
419419

420-
### Latest Release: v0.5.0
420+
### Latest Release: v0.6.0
421421

422-
**Step-Into Debugging Enhancement**
422+
**Reliable Stepping Across Engines**
423423

424-
- Full support for stepping into named templates with `xsl:call-template`
425-
- F11 (Step Into) now correctly enters named templates with parameters
426-
- F10 (Step Over) executes template calls without stepping into them
427-
- Shift+F11 (Step Out) returns from the current template to the caller
428-
- Fixed template-entry breakpoint placement to respect XSLT 1.0 param ordering
429-
- Works with both Compiled engine (XSLT 1.0) and Saxon engine (XSLT 2.0/3.0)
430-
- Enhanced test coverage with 111 passing tests including step-into scenarios
424+
- Step Over (F10) now stops on the statement after `xsl:call-template` for both compiled and Saxon engines.
425+
- Step Out (Shift+F11) returns to the caller template using call-depth tracking and template exit probes.
426+
- Step Into (F11) continues to enter named templates with parameter handling intact.
427+
- Template entry/exit markers are emitted consistently so the debugger never “falls through” a nested call.
431428

432-
**Test Infrastructure & Code Quality Improvements**
429+
**Instrumentation Fixes**
433430

434-
- Centralized test data to `TestData/Integration/` folder at repository root for better organization
435-
- All test projects now reference common test data location
436-
- Enhanced test coverage with 111 passing integration and unit tests
437-
- Improved ConsoleTest project with unified engine support (both Compiled and Saxon)
431+
- Saxon instrumentation always plants probes for `xsl:call-template`, even when a sibling probe already exists.
432+
- Named templates receive paired `template-entry`/`template-exit` instrumentation to keep call depth accurate.
433+
- Guardrails ensure synthetic exit hits do not trigger user breakpoints.
438434

439-
**Variable Debugging Enhancements**
435+
**Console & Test Coverage**
440436

441-
- Enhanced variable instrumentation for both Compiled and Saxon engines
442-
- Improved variable capture and display in VS Code Variables panel
443-
- Better support for XSLT 2.0/3.0 variable debugging with Saxon engine
444-
- Added `CompiledMessageHandler` for enhanced compiled engine debugging
445-
- Fixed variable instrumentation to properly handle templates with parameters
437+
- Interactive console harness (`XsltDebugger.ConsoleTest/StepIntoTest.cs`) highlights template entry/exit markers while you step.
438+
- Added dedicated `StepIntoTests` verifying step-in/over/out scenarios for both engines.
439+
- Test suite now covers 115 scenarios (all green with `dotnet test`).
446440

447-
**Engine Improvements**
441+
**Packaging**
448442

449-
- Unified console testing with `ProgramUsingEngineType.cs` supporting both engines
450-
- Better breakpoint context information and handling
451-
- Enhanced xsl:message support for debugging output
452-
- Improved XSLT 2.0/3.0 features support including accumulators
453-
- Call depth tracking for proper step mode handling
454-
455-
**Developer Experience**
456-
457-
- Platform-specific packaging with optimized binary sizes
458-
- Updated build scripts for both macOS (darwin-arm64) and Windows (win32-x64)
459-
- Comprehensive integration tests for both engines
460-
- Better documentation and code organization
443+
- Updated docs/scripts for the 0.6.0 VSIX names on macOS and Windows.
444+
- `package-darwin.sh`/`package-win.sh` continue to run tests before producing platform-specific bundles.
461445

462446
## Contributing
463447

@@ -523,8 +507,8 @@ Each packaging script:
523507
./package-all.sh
524508

525509
# Publish each as a separate extension
526-
vsce publish -p YOUR_TOKEN --packagePath xsltdebugger-darwin-darwin-arm64-0.5.0.vsix
527-
vsce publish -p YOUR_TOKEN --packagePath xsltdebugger-windows-win32-x64-0.5.0.vsix
510+
vsce publish -p YOUR_TOKEN --packagePath xsltdebugger-darwin-darwin-arm64-0.6.0.vsix
511+
vsce publish -p YOUR_TOKEN --packagePath xsltdebugger-windows-win32-x64-0.6.0.vsix
528512
```
529513

530514
**Benefits:**
@@ -550,7 +534,7 @@ XsltDebugger/
550534
│ ├── CompiledMessageHandler.cs # Message handling for compiled engine
551535
│ ├── SaxonDebugExtension.cs # Debug extension for Saxon
552536
│ └── XsltEngineManager.cs # Engine state management
553-
├── XsltDebugger.Tests/ # C# integration & unit tests (105 tests)
537+
├── XsltDebugger.Tests/ # C# integration & unit tests (115 tests)
554538
│ ├── CompiledEngineIntegrationTests.cs
555539
│ ├── SaxonEngineIntegrationTests.cs
556540
│ └── [other test files]

XsltDebugger.DebugAdapter/SaxonEngine.cs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ public class SaxonEngine : IXsltEngine
2222
private StepMode _stepMode = StepMode.Continue;
2323
private int _callDepth = 0;
2424
private int _targetDepth = 0;
25+
private string _currentStopFile = string.Empty;
26+
private int _currentStopLine = -1;
27+
private string _stepOriginFile = string.Empty;
28+
private int _stepOriginLine = -1;
2529
private Processor? _processor;
2630
private XsltTransformer? _transformer;
2731

@@ -304,6 +308,8 @@ public Task StepOverAsync()
304308
_nextStepRequested = true;
305309
_stepMode = StepMode.Over;
306310
_targetDepth = _callDepth;
311+
_stepOriginFile = _currentStopFile;
312+
_stepOriginLine = _currentStopLine;
307313
_pauseTcs?.TrySetResult(true);
308314
_pauseTcs = null;
309315
}
@@ -317,6 +323,8 @@ public Task StepInAsync()
317323
_nextStepRequested = true;
318324
_stepMode = StepMode.Into;
319325
_targetDepth = _callDepth;
326+
_stepOriginFile = string.Empty;
327+
_stepOriginLine = -1;
320328
_pauseTcs?.TrySetResult(true);
321329
_pauseTcs = null;
322330
}
@@ -330,6 +338,8 @@ public Task StepOutAsync()
330338
_nextStepRequested = true;
331339
_stepMode = StepMode.Out;
332340
_targetDepth = _callDepth - 1; // Stop when we return to parent depth
341+
_stepOriginFile = _currentStopFile;
342+
_stepOriginLine = _currentStopLine;
333343
_pauseTcs?.TrySetResult(true);
334344
_pauseTcs = null;
335345
}
@@ -380,13 +390,13 @@ internal void RegisterBreakpointHit(string file, int line, XdmNode? contextNode
380390
}
381391

382392
// Check if we should stop based on step mode
383-
if (ShouldStopForStep(isTemplateExit))
393+
if (ShouldStopForStep(normalized, line, isTemplateExit))
384394
{
385395
PauseForBreakpoint(normalized, line, DebugStopReason.Step, contextNode);
386396
}
387397
}
388398

389-
private bool ShouldStopForStep(bool isTemplateExit)
399+
private bool ShouldStopForStep(string file, int line, bool isTemplateExit)
390400
{
391401
lock (_sync)
392402
{
@@ -409,8 +419,9 @@ private bool ShouldStopForStep(bool isTemplateExit)
409419
break;
410420

411421
case StepMode.Over:
412-
// Stop once we return to the original depth (allow template exit to count)
413-
shouldStop = _callDepth <= _targetDepth;
422+
// Stop once we return to the original depth, but skip synthetic template exits
423+
shouldStop = !isTemplateExit && _callDepth <= _targetDepth &&
424+
(!string.Equals(file, _stepOriginFile, StringComparison.OrdinalIgnoreCase) || line != _stepOriginLine);
414425
break;
415426

416427
case StepMode.Out:
@@ -625,6 +636,12 @@ private void PauseForBreakpoint(string file, int line, DebugStopReason reason, X
625636

626637
XsltEngineManager.NotifyStopped(file, line, reason, navigator);
627638

639+
lock (_sync)
640+
{
641+
_currentStopFile = file;
642+
_currentStopLine = line;
643+
}
644+
628645
try
629646
{
630647
localTcs?.Task.Wait();
@@ -786,14 +803,6 @@ private void InstrumentStylesheet(XDocument doc)
786803
}
787804
else
788805
{
789-
var isCallTemplate = isXsltElement &&
790-
string.Equals(element.Name.LocalName, "call-template", StringComparison.OrdinalIgnoreCase);
791-
792-
if (!isCallTemplate && HasSiblingProbeBefore(element, debugNamespace))
793-
{
794-
continue;
795-
}
796-
797806
var siblingProbes = BuildProbesForElement(element, lineNumber, xsltNamespace, debugNamespace);
798807
if (siblingProbes.Count == 0)
799808
{

XsltDebugger.DebugAdapter/XsltCompiledEngine.cs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ public class XsltCompiledEngine : IXsltEngine
7575
private StepMode _stepMode = StepMode.Continue;
7676
private int _callDepth = 0;
7777
private int _targetDepth = 0;
78+
private string _currentStopFile = string.Empty;
79+
private int _currentStopLine = -1;
80+
private string _stepOriginFile = string.Empty;
81+
private int _stepOriginLine = -1;
7882

7983
public async Task StartAsync(string stylesheet, string xml, bool stopOnEntry)
8084
{
@@ -255,6 +259,8 @@ public Task StepOverAsync()
255259
_nextStepRequested = true;
256260
_stepMode = StepMode.Over;
257261
_targetDepth = _callDepth;
262+
_stepOriginFile = _currentStopFile;
263+
_stepOriginLine = _currentStopLine;
258264
_pauseTcs?.TrySetResult(true);
259265
_pauseTcs = null;
260266
}
@@ -268,6 +274,8 @@ public Task StepInAsync()
268274
_nextStepRequested = true;
269275
_stepMode = StepMode.Into;
270276
_targetDepth = _callDepth;
277+
_stepOriginFile = string.Empty;
278+
_stepOriginLine = -1;
271279
_pauseTcs?.TrySetResult(true);
272280
_pauseTcs = null;
273281
}
@@ -281,6 +289,8 @@ public Task StepOutAsync()
281289
_nextStepRequested = true;
282290
_stepMode = StepMode.Out;
283291
_targetDepth = _callDepth - 1; // Stop when we return to parent depth
292+
_stepOriginFile = _currentStopFile;
293+
_stepOriginLine = _currentStopLine;
284294
_pauseTcs?.TrySetResult(true);
285295
_pauseTcs = null;
286296
}
@@ -331,13 +341,13 @@ internal void RegisterBreakpointHit(string file, int line, XPathNavigator? conte
331341
}
332342

333343
// Check if we should stop based on step mode
334-
if (ShouldStopForStep(isTemplateExit))
344+
if (ShouldStopForStep(normalized, line, isTemplateExit))
335345
{
336346
PauseForBreakpoint(normalized, line, DebugStopReason.Step, contextNode);
337347
}
338348
}
339349

340-
private bool ShouldStopForStep(bool isTemplateExit)
350+
private bool ShouldStopForStep(string file, int line, bool isTemplateExit)
341351
{
342352
lock (_sync)
343353
{
@@ -360,8 +370,9 @@ private bool ShouldStopForStep(bool isTemplateExit)
360370
break;
361371

362372
case StepMode.Over:
363-
// Stop once we return to the original depth (allow template exit to count)
364-
shouldStop = _callDepth <= _targetDepth;
373+
// Stop once we return to the original depth, but skip synthetic template exits
374+
shouldStop = !isTemplateExit && _callDepth <= _targetDepth &&
375+
(!string.Equals(file, _stepOriginFile, StringComparison.OrdinalIgnoreCase) || line != _stepOriginLine);
365376
break;
366377

367378
case StepMode.Out:
@@ -411,6 +422,12 @@ private void PauseForBreakpoint(string file, int line, DebugStopReason reason, X
411422

412423
XsltEngineManager.NotifyStopped(file, line, reason, context);
413424

425+
lock (_sync)
426+
{
427+
_currentStopFile = file;
428+
_currentStopLine = line;
429+
}
430+
414431
try
415432
{
416433
localTcs?.Task.Wait();

0 commit comments

Comments
 (0)