# Debugging code generation when testing with package manager

**URL:** <https://discourse.julialang.org/t/debugging-code-generation-when-testing-with-package-manager/20524>\
**Category:** General Usage\
**Tags:** debug\
**Created:** [February 6, 2019, 11:52pm UTC](https://discourse.julialang.org/t/debugging-code-generation-when-testing-with-package-manager/20524 "2019-02-06T23:52:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![m-j-w](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/m-j-w/32/4541_2.png) [@m-j-w](https://discourse.julialang.org/u/m-j-w)\
**Post date:** [February 6, 2019, 11:52pm UTC](https://discourse.julialang.org/t/debugging-code-generation-when-testing-with-package-manager/20524/1 "2019-02-06T23:52:14Z")

</div>

I’m the developer of the package [CpuId](https://github.com/m-j-w/CpuId.jl). I’m currently facing an issue which appears to only occur when testing the package through the package manager, viz. typing `]test CpuId`. In that case, the core functions containing an llvmcall are somehow differently inlined and yield a segfault. This does not seem to occur in, say, regular operations. I have theories on why this happens, but I can’t reproduce the issue outside the package manager testing environment.

My question: How do I get a view on the generated code when testing through the package manager? (eg. @testset, @test etc.).  
Thanks!

---

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [February 7, 2019, 2:41am UTC](https://discourse.julialang.org/t/debugging-code-generation-when-testing-with-package-manager/20524/2 "2019-02-07T02:41:40Z")

</div>

Not directly answering your question, but did you try to launch a Julia REPL with the same command line flags used in Pkg.jl?: [Pkg.jl/Operations.jl at 853b3f1fd9895db32b402d89e9dee153b66b2316 · JuliaLang/Pkg.jl · GitHub](https://github.com/JuliaLang/Pkg.jl/blob/853b3f1fd9895db32b402d89e9dee153b66b2316/src/Operations.jl#L1294-L1309)

Also, since `@test` wraps code into a `try` block, it may help if you do so when generating the code.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 7, 2019, 8:17am UTC](https://discourse.julialang.org/t/debugging-code-generation-when-testing-with-package-manager/20524/3 "2019-02-07T08:17:17Z")

</div>

`Pkg.test` just spawns a new Julia process and runs `test/runtests.jl`, so you should be able to reproduce everything that way.

---

<div class="post-metadata">

**Author:** ![m-j-w](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/m-j-w/32/4541_2.png) [@m-j-w](https://discourse.julialang.org/u/m-j-w)\
**Post date:** [February 7, 2019, 8:48am UTC](https://discourse.julialang.org/t/debugging-code-generation-when-testing-with-package-manager/20524/4 "2019-02-07T08:48:21Z")

</div>

Thanks, @tkf and @Tamas_Papp. Found the additional option `--check-bounds=yes` for julia when using `Pkg.test`. These additional bounds checks are in fact triggering the segfaults.
