# New debugger?

**URL:** <https://discourse.julialang.org/t/new-debugger/21974>\
**Category:** Tooling\
**Created:** [March 17, 2019, 9:16pm UTC](https://discourse.julialang.org/t/new-debugger/21974 "2019-03-17T21:16:15Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [April 26, 2019, 1:44pm UTC](https://discourse.julialang.org/t/new-debugger/21974/21 "2019-04-26T13:44:24Z")

</div>

Hello all, now that this has matured a little, I’m wondering if there is a best practice for handling Debugger.jl as a dependency. Currently, becuase `using Debugger` is needed to set breakpoints, it seems one needs to include Debugger as a dependency in just about every package to really use it. Is this really what I should be doing, or is there a better way?

---

<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:** [April 26, 2019, 2:07pm UTC](https://discourse.julialang.org/t/new-debugger/21974/22 "2019-04-26T14:07:31Z")

</div>

Don’t you just get a warning when you load it if it is not in `Project.toml`, but available in your general environment?

---

<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:** [April 26, 2019, 2:10pm UTC](https://discourse.julialang.org/t/new-debugger/21974/23 "2019-04-26T14:10:44Z")

</div>

I’d recommend setting breakpoints with `breakpoint` after loading `Debugger` in the REPL (or by using Juno, of course 😛 ) – that way you don’t have to use any `@bp` annotations.

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [April 26, 2019, 2:11pm UTC](https://discourse.julialang.org/t/new-debugger/21974/24 "2019-04-26T14:11:06Z")

</div>

> [@Tamas\_Papp](#):
>
> Don’t you just get a warning when you load it if it is not in `Project.toml` , but available in your general environment?

I actually forgot about that because lately I’ve been working in the environment of one of my packages. I also don’t want to live with that warning, because I’m afraid that I’ll build my docker image and it won’t run because it crashes when tyring to import the debugger somewhere.

So, if that’s what we’re doing, I’ll just include it as a dependency for now.

> [@pfitzseb](#):
>
> I’d recommend setting breakpoints with `breakpoint` after loading `Debugger` in the REPL

`breakpoint` is indeed very handy, but often I just want to set a breakpoint at a particular line.

---

<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:** [April 26, 2019, 2:13pm UTC](https://discourse.julialang.org/t/new-debugger/21974/25 "2019-04-26T14:13:26Z")

</div>

> `breakpoint` is indeed very handy, but often I just want to set a breakpoint at a particular line.

That’s supported though – there’s a `breakpoint(file, line)` method.

---

<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:** [April 26, 2019, 2:16pm UTC](https://discourse.julialang.org/t/new-debugger/21974/26 "2019-04-26T14:16:14Z")

</div>

> [@ExpandingMan](#):
>
> I’m afraid that I’ll build my docker image and it won’t run because it crashes when tyring to import the debugger somewhere.

If you want to debug using that image, I guess the best solution is to bake it in. But if it is just for CI, isn’t trying to use a debugger a wart that you would rather catch?

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [April 26, 2019, 2:28pm UTC](https://discourse.julialang.org/t/new-debugger/21974/27 "2019-04-26T14:28:49Z")

</div>

> [@pfitzseb](#):
>
> That’s supported though – there’s a `breakpoint(file, line)` method.

I know at this point I’m just being difficult, but nothing quite gives me the satisfaction of just putting in a breakpoint 😆

> [@Tamas\_Papp](#):
>
> If you want to debug using that image, I guess the best solution is to bake it in. But if it is just for CI, isn’t trying to use a debugger a wart that you would rather catch?

Yes, but I would have to remove all `using Debugger` statements before I build. I’m not currently aware of any good automated way of doing this.

It seems to me that in order to really solve this issue, breakpoints would need to be added to `Base`.

---

<div class="post-metadata">

**Author:** ![ssfrr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ssfrr/32/3736_2.png) [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Post date:** [April 26, 2019, 2:49pm UTC](https://discourse.julialang.org/t/new-debugger/21974/28 "2019-04-26T14:49:24Z")

</div>

What about this macro:

```julia
macro mybp()
    Main.eval(:(breakpoint, @ __FILE__ , @ __LINE__ ))
end

```

So then as long as you’ve done `using Debugger` in the REPL you could sprinkle the macro in your code.

Of course then you need the package code to be able to call that macro, but maybe you just copy-paste it into the package you’re working on.

edit: note I haven’t actually tested this and haven’t used Debugger.jl much, so it might not work.

[Previous page](https://discourse.julialang.org/t/new-debugger/21974.md?page=1)
