Repository navigation
--di: a debugger stops once at each statement, leaves at the closing brace, steps over compiler glue - #1126
Merged
Conversation
…brace, and steps over compiler glue Every op had the place of the expression it was made for, so the line table had a row for each expression and, under CodeView, a column for each (the Visual Studio debugger and cppvsdbg step through those), went back and forth over a statement on several lines, back to a variable's declaration to release it at the end of its scope, returned through the function's first line, and stepped into the compiler's glue shown at the user's lines. - MLIRGen records the statements it generates (ts.debug_statements, only nodes of the file being generated: other files' trees are generated under its name too). - DebugStepLocationsPass, ahead of DIScopeForLLVMFuncOpPass: an op's place becomes the start of the innermost statement it is in; no columns under CodeView (as clang); a function with no statement (a thunk marked LocalToUnit, `.new`, `.instanceOf`, the rc/own routines) gets line 0 throughout, so it has no source; calls into such glue and code that goes back to an earlier statement in the same block get line 0; without --opt `callsite(a at b)` becomes `b` (a fake inline frame). - A function's way out is its closing brace: the exit and its return block (made with the entry). - debug-info-steps.cmake checks the rows of each function under all four models; jit-native's cdb check takes any line of `greeting` (line 3 now under --opt, the only code left is the return). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ly lines already stopped at
- A field's initializer is a step of its own (recorded where the field is typed): `class B { v = make() }`
had its constructor hidden, and initializers before or after an explicit constructor lost their row
or folded the constructor's statements away.
- A function's body is a barrier in the statement table: a callback written in a call keeps its own
closing brace instead of the call's line.
- Code going back in a block, or a call into glue, folds only onto a line already stopped at (the
function's own line counts): `noop();` of an empty function keeps its row, and a constructor steps
through initializers written after it, then its statements. Inlined ops (--opt) are left alone.
- 00debug_steps.ts covers these shapes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s too; the compiler's own TypeScript is at no line of the program's; functions stepped over have no first line A lexical block took the compile unit's file, so the rows of a default library's generic made in the program (Array.sort's mergeSort) were shown at lines of the program past its end. Code parsed from the compiler's own TypeScript (helper sources, Math.max, inspect) took the program's file and line map; its nodes are now located in a pseudo-file `<tslang>` that DebugStepLocationsPass gives line 0. A hidden function's subprogram (or the one made for a lowering routine) is at line 0, so CodeView gives it no row at its first line for a step into it to stop at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nippet leaves no address for another Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… T elements `Array(3)` called the default library's static class Array, so `a[0] = 1` failed with "can't resolve property '.index' of class 'Array'". A program's own Array function is still called. `const c: string[] = new Array(2)` made s32[] (the length's type) and failed to cast. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stepping through a
--dibuild stopped at nearly every operation. Every op kept the place of the expression it was made for, so the line table had a row for each expression and, under CodeView, a column for each (len()with onereturnhad 12 rows). It also went back and forth over multi-line statements, went back to a variable's declaration to release it at the end of a scope, returned through the function's first line, and stepped into compiler glue shown at the user's lines.What changes
ts.debug_statements. Only nodes of the file being generated are recorded: other files' trees are generated under its name too.DebugStepLocationsPassruns under--di, ahead ofDIScopeForLLVMFuncOpPass:.new,.instanceOf, rc/own routines) gets line 0 throughout, so it has no source and debuggers step over it;--opt,callsite(a at b)on calls becomesb, which removes fake inline frames.Rows before → after (CodeView PDB,
real.tswith the default library)Point.len: 12 rows, 3 3 4 4 4 4 4 4 4 4 4 3, each with a column → 3 4 5pthroughmain: 17 … 26, then};sum: 9 10 11 10 11 … 13}Tests
test-compile-debug-info-stepschecks each function's rows under gc/rc/none/own. It covers multi-line statements, loops, field initializers before and after a constructor, a callback, an empty callee, and rc release routines.jit-native.cmake: cdb's frame check takes any line ofgreeting. Under--optonly the return is left, now at}(line 3).lib.ts,lib.win32.ts) compiles with--di --opt_level=0under all four models. A--dicompile of the test corpus shows only failures that the Dec 2 compiler shows too.Not run: Visual Studio or VS Code's cppvsdbg (only WinDbg here), GDB, LLDB. A prebuilt default library keeps its columns until it is rebuilt.
🤖 Generated with Claude Code