-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more APIs to compiler/debugutils; re-export it (#18243)
- Loading branch information
1 parent
a250481
commit 87cd9b2
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
discard """ | ||
joinable: false | ||
disabled: true | ||
""" | ||
|
||
#[ | ||
This test illustrates some features of `debugutils` to debug the compiler. | ||
## example | ||
this shows how to enable compiler logging just for a section of user code, | ||
without generating tons of unrelated log messages for code you're not interested | ||
in debugging. | ||
```sh | ||
# enable some debugging code, e.g. the `when false:` block in `semExpr` | ||
nim c -o:bin/nim_temp --stacktrace -d:debug -d:nimDebugUtils compiler/nim | ||
bin/nim_temp c tests/compiler/tdebugutils.nim | ||
``` | ||
(use --filenames:abs for abs files) | ||
## result | ||
("<", "tdebugutils.nim(16, 3)", {.define(nimCompilerDebug).}, nil) | ||
(">", "tdebugutils.nim(17, 3)", let a = 2.5 * 3, {}, nkLetSection) | ||
(">", "tdebugutils.nim(17, 15)", 2.5 * 3, {efAllowDestructor, efWantValue}, nkInfix) | ||
(">", "tdebugutils.nim(17, 11)", 2.5, {efAllowStmt, efDetermineType, efOperand}, nkFloatLit) | ||
("<", "tdebugutils.nim(17, 11)", 2.5, float64) | ||
(">", "tdebugutils.nim(17, 17)", 3, {efAllowStmt, efDetermineType, efOperand}, nkIntLit) | ||
("<", "tdebugutils.nim(17, 17)", 3, int literal(3)) | ||
("<", "tdebugutils.nim(17, 15)", 2.5 * 3, float) | ||
("<", "tdebugutils.nim(17, 3)", let a = 2.5 * 3, nil) | ||
(">", "tdebugutils.nim(18, 3)", {.undef(nimCompilerDebug).}, {}, nkPragma) | ||
]# | ||
|
||
proc main = | ||
{.define(nimCompilerDebug).} | ||
let a = 2.5 * 3 | ||
{.undef(nimCompilerDebug).} |