# How to debug the compiler with Debugger.jl

**URL:** <https://discourse.julialang.org/t/how-to-debug-the-compiler-with-debugger-jl/124229>\
**Category:** Internals & Design\
**Tags:** debug, debugging, compilation, debugger, compiler\
**Created:** [December 28, 2024, 12:57pm UTC](https://discourse.julialang.org/t/how-to-debug-the-compiler-with-debugger-jl/124229 "2024-12-28T12:57:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [December 28, 2024, 12:57pm UTC](https://discourse.julialang.org/t/how-to-debug-the-compiler-with-debugger-jl/124229/1 "2024-12-28T12:57:40Z")

</div>

For Debugger.jl, I assume compiled mode is enabled by default for `@run`? How do I disable it? I want to disable it to be able to step through the type inference code in the compiler. Can’t use VS Code’s debugger because it doesn’t work on nightly Julia.

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [December 28, 2024, 1:19pm UTC](https://discourse.julialang.org/t/how-to-debug-the-compiler-with-debugger-jl/124229/2 "2024-12-28T13:19:15Z")

</div>

> [@nsajko](#):
>
> be able to step through the type inference code in the compiler

Ah, I can just do that on Compiler.jl now. Remember to `dev` it in the Pkg.jl REPL if necessary.

Example:

```julia
using Compiler: Compiler
f = Base.promote_typeof
atypes = Tuple{UnitRange{Int64}, UnitRange{Int64}, Vector{Any}, Vararg{UnitRange{Int64}}}
m = methods(f, atypes)[2]
interp = Compiler.NativeInterpreter()
sparams = Core.svec()
types = Tuple{typeof(f), atypes.parameters...}
Compiler.typeinf_type(interp, m, types, sparams)

using Debugger: Debugger
Debugger.break_on(:error)
Debugger.@run Compiler.typeinf_type(interp, m, types, sparams)

```
