Created Debugging the Nim compiler (markdown)

Mamy Ratsimbazafy 2019-04-25 16:54:04 +02:00
parent e050847a1a
commit 08e8f60713
1 changed files with 15 additions and 0 deletions

@ -0,0 +1,15 @@
Due to Nimbus sometimes using niche features of the Nim compiler, we might encounter compiler crashes or semantic check errors with no clue how to proceed forward and a lot of difficulty to create a minimal test case.
2 strategies to kickstart an investigation are available. The first one is to compile a Nim compiler with stack traces enabled.
## Nim compiler with stack traces
1. Clone Nim and build `koch` as in the Nim readme.
2. Create a temporary Nim compiler with stacktraces, for example to debug https://github.com/status-im/nimbus/issues/322, this is the command to reproduce the bug:
```sh
./koch temp c -r -o:build/gascosts ../../Status/nimbus/tests/all_tests.nim # Replace by your own path
```
## Bisecting
You can use git bisect to narrow down the offending commit. Usually only `koch boot -d:release` is needed to rebuild `bin/nim` but sometimes you need to re-bootstrap the `koch` and potentially the `csources`