# Juno debugger stops at \`@unpack\` from Parameters

**URL:** https://discourse.julialang.org/t/juno-debugger-stops-at-unpack-from-parameters/39904
**Category:** General Usage
**Tags:** package, juno, debug
**Created:** [May 21, 2020, 6:30pm UTC](https://discourse.julialang.org/t/juno-debugger-stops-at-unpack-from-parameters/39904 "2020-05-21T18:30:05Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![human\_bomb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/human_bomb/32/15057_2.png) [@human\_bomb](https://discourse.julialang.org/u/human_bomb)
#### Post date: [May 21, 2020, 6:30pm UTC](https://discourse.julialang.org/t/juno-debugger-stops-at-unpack-from-parameters/39904/1 "2020-05-21T18:30:05Z")

</div>

I am using the [Parameters](https://github.com/mauro3/Parameters.jl) package v0.12.0 by @mauro3 in my numerical simulations. While using the Juno debugger in JuliaPro, I noticed that the debugger stops when reaching a call to Parameters’ `@unpack`. Below is a MWE:

```julia
# MWE.jl
using Parameters

@with_kw struct A
    a::Int = 6
end

function testA(varA::A)
    @unpack a = varA
    # a = varA.a
    print(a, '\n')
end

```

Everything is working fine when running

```julia
julia> include("MWE.jl")
julia> testA(A())
julia> Juno.@enter testA(A())

```

up to the last line. This debugging statement opens `@unpack` in debug mode (Parameters.jl, stopping at line 751: `$kdblock`), which becomes annoying when debugging a big code with several such calls. Note that the same MWE where `@unpack a = varA` is replaced by `a = varA.a` behaves fine (but it’s less convenient).

**Question:** is there a way to avoid that the debugger stops at `@unpack`?

I am using JuliaPro 1.4.1-1 (Julia 1.4.1, Atom 1.45.0, julia-client 0.12.4) on Windows 10, but observed the same behavior on previous versions too.

* * *

**Edit:** Similar behavior with the `@unpack` macro from [UnPack.jl](https://github.com/mauro3/UnPack.jl), by writing `using UnPack` and

```julia
# MWE.jl [...]
    UnPack.@unpack a = varA

```

**Edit:** Also same behavior with a breakpoint located at `print(a, '\n')`, and with the command

```julia
julia> Juno.@run testA(A())

```

---

<div class="post-metadata">

### Author: ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)
#### Post date: [May 22, 2020, 6:01am UTC](https://discourse.julialang.org/t/juno-debugger-stops-at-unpack-from-parameters/39904/2 "2020-05-22T06:01:56Z")

</div>

That is odd. But I’m not using Juno, so I cannot easily help here. One thing you should try is whether this also happens when using `@unpack` directly from `UnPack.jl`.

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [May 22, 2020, 8:58am UTC](https://discourse.julialang.org/t/juno-debugger-stops-at-unpack-from-parameters/39904/3 "2020-05-22T08:58:33Z")

</div>

The Juno debugger does step into the expanded macro, yes. This is by design.

I’d suggest setting breakpoints at wherever you want to actually stop and start stepping through the code from there (also need to use `Juno.@run testA(A())` or the `Debug: Run Block` command).

---

<div class="post-metadata">

### Author: ![human\_bomb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/human_bomb/32/15057_2.png) [@human\_bomb](https://discourse.julialang.org/u/human_bomb)
#### Post date: [May 22, 2020, 9:38am UTC](https://discourse.julialang.org/t/juno-debugger-stops-at-unpack-from-parameters/39904/4 "2020-05-22T09:38:04Z")

</div>

Thanks for support. The MWE

```julia
# MWE.jl
using Parameters
using UnPack

@with_kw struct A
    a::Int = 6
end

function testA(varA::A)
    UnPack.@unpack a = varA
    # a = varA.a
    print(a, '\n')
end

```

has the same behavior (Juno debugger steps into the macro `@unpack` from UnPack.jl and stops at the same line). Might be a Juno feature.

---

<div class="post-metadata">

### Author: ![human\_bomb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/human_bomb/32/15057_2.png) [@human\_bomb](https://discourse.julialang.org/u/human_bomb)
#### Post date: [May 22, 2020, 9:56am UTC](https://discourse.julialang.org/t/juno-debugger-stops-at-unpack-from-parameters/39904/5 "2020-05-22T09:56:17Z")

</div>

Thanks for support. I tried `Juno.@run testA(A())` with a breakpoint at the line `print(a, '\n')`, but the behavior is the same. Juno debugger steps into Parameters.jl, and is stuck in that source file. Continuing debug session works, but then breakpoints in MWE.jl are ignored. (Everything is still working fine when `@unpack a = varA` is replaced by `a = varA.a` – which are supposed to behave in a similar way).

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [May 22, 2020, 10:38am UTC](https://discourse.julialang.org/t/juno-debugger-stops-at-unpack-from-parameters/39904/6 "2020-05-22T10:38:45Z")

</div>

Ah, true. The problem is that the `@unpack` macro expands to ~12 lines of code, so breakpoints on the next few lines actually stop you in `@unpack`.

The best solution right now is probably to use `JuliaInterpreter`s `@bp` macro like

```julia
function testA(varA::A)
    @unpack a = varA
    @bp
    println(a)
end

Juno.@run testA(A())

```

---

<div class="post-metadata">

### Author: ![human\_bomb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/human_bomb/32/15057_2.png) [@human\_bomb](https://discourse.julialang.org/u/human_bomb)
#### Post date: [May 22, 2020, 12:20pm UTC](https://discourse.julialang.org/t/juno-debugger-stops-at-unpack-from-parameters/39904/7 "2020-05-22T12:20:19Z")

</div>

Yes, using `@bp` allows to continue debugging after Juno’s debugger stepped into `@unpack`. Thanks!

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [May 22, 2020, 12:20pm UTC](https://discourse.julialang.org/t/juno-debugger-stops-at-unpack-from-parameters/39904/8 "2020-05-22T12:20:57Z")

</div>

You can continue debugging even when you are in `@unpack` by doing a few (or more) `Step Expr` steps.
