Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use -d:nimCompilerStackraceHints in more places #16400

Merged

Conversation

timotheecour
Copy link
Member

@timotheecour timotheecour commented Dec 19, 2020

followup for #13351

this helped a lot when doing the code reduction in #14340 (comment)

before PR:

at devel 0b7847b:

git clone https://gitea.com/BarrOff/nimPoP.git
cd nimPoP
nim c src/nimPoP.nim
/Users/timothee/git_clone/nim/Nim_devel/lib/system/fatal.nim(49) sysFatal
Error: unhandled exception: 'sons' is not accessible using discriminant 'kind' of type 'TNode' [FieldDefect]

before PR, with debug nim

after recompiling nim with --stacktrace:on --stacktracemsgs -d:nimCompilerStackraceHints

/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(1020) genBracketExpr
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(911) genArrayElem
/Users/timothee/git_clone/nim/Nim_prs/compiler/cgen.nim(619) initLocExpr
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(2674) expr
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(2524) genComplexConst
/Users/timothee/git_clone/nim/Nim_prs/compiler/cgen.nim(1207) requestConstImpl
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(3111) genBracedInit
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(3013) genConstSimpleList
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(3092) genBracedInit
/Users/timothee/git_clone/nim/Nim_prs/compiler/ast.nim(1115) len
/Users/timothee/git_clone/nim/Nim_prs/lib/system/fatal.nim(49) sysFatal
Error: unhandled exception: 'sons' is not accessible using discriminant 'kind' of type 'TNode' [FieldDefect]

=> gives 0 indication of what part of the code being cgen'd causes the error

after PR

after recompiling nim with --stacktrace:on --stacktracemsgs -d:nimCompilerStackraceHints

=> now we know its' inside this: /Users/timothee/git_clone/nim/temp/nimPoP/src/nimPoP/opl3.nim(657, 16) nkSym, and also mroe this is called from, etc

/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgcalls.nim(401) genClosureCall
/Users/timothee/git_clone/nim/Nim_prs/compiler/cgen.nim(619) initLocExpr
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(2771) expr /Users/timothee/git_clone/nim/temp/nimPoP/src/nimPoP/opl3.nim(657, 27) nkBracketExpr
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(1023) genBracketExpr
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(914) genArrayElem
/Users/timothee/git_clone/nim/Nim_prs/compiler/cgen.nim(619) initLocExpr
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(2679) expr /Users/timothee/git_clone/nim/temp/nimPoP/src/nimPoP/opl3.nim(657, 16) nkSym
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(2527) genComplexConst
/Users/timothee/git_clone/nim/Nim_prs/compiler/cgen.nim(1207) requestConstImpl
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(3116) genBracedInit
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(3018) genConstSimpleList
/Users/timothee/git_clone/nim/Nim_prs/compiler/ccgexprs.nim(3097) genBracedInit
/Users/timothee/git_clone/nim/Nim_prs/compiler/ast.nim(1115) len
/Users/timothee/git_clone/nim/Nim_prs/lib/system/fatal.nim(49) sysFatal
Error: unhandled exception: 'sons' is not accessible using discriminant 'kind' of type 'TNode' [FieldDefect]

future work

  • extend -d:nimCompilerStackraceHints to a few more key strategic places
  • make compiler use conf.isDefined instead of defined so that we don't need to recompile nim just to get nimCompilerStackraceHints enabled (as long as nim was already compiled with --stacktrace:on --stacktracemsgs)

@timotheecour timotheecour merged commit c9886a4 into nim-lang:devel Dec 29, 2020
@timotheecour timotheecour deleted the pr_nimCompilerStackraceHints_more branch December 29, 2020 10:12
mildred pushed a commit to mildred/Nim that referenced this pull request Jan 11, 2021
ardek66 pushed a commit to ardek66/Nim that referenced this pull request Mar 26, 2021
timotheecour added a commit to timotheecour/Nim that referenced this pull request Jun 16, 2021
PMunch pushed a commit to PMunch/Nim that referenced this pull request Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants