# Breakpoint issues and best practices in VSCode

**URL:** <https://discourse.julialang.org/t/breakpoint-issues-and-best-practices-in-vscode/122914>\
**Category:** VS Code\
**Created:** [November 21, 2024, 11:59pm UTC](https://discourse.julialang.org/t/breakpoint-issues-and-best-practices-in-vscode/122914 "2024-11-21T23:59:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevjzheng](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevjzheng/32/209967_2.png) [@kevjzheng](https://discourse.julialang.org/u/kevjzheng)\
**Post date:** [November 21, 2024, 11:59pm UTC](https://discourse.julialang.org/t/breakpoint-issues-and-best-practices-in-vscode/122914/1 "2024-11-21T23:59:10Z")

</div>

I have been advocating Julia to my colleagues to switch from MATLAB. One of the biggest roadblocks for us is the breakpoint debug feature in VSCode.

I personally have never gotten breakpoints to work. Below are the issues I have run into

1. My code base is relatively big and the main script includes other files (both modules and scripts). Breakpoints in included files never stops
2. I have GLMakie in my code, so speed things up I used the recommended settings with `ALL_MODULES_EXCEPT_MAIN` in the config file: [Debugging · Julia in VS Code](https://www.julia-vscode.org/docs/stable/userguide/debugging/#ALL_MODULES_EXCEPT_MAIN). None of the breakpoints in my own custom module functions work. I am guessing I need to explicit them put them interpretive mode with “-” prefix? I tried doing this for one module, and called a function at the main script level, the breakpoint I set in that function doesn’t work either.
3. Adding breakpoints dynamically at the main script level also doesn’t work for me.

I feel maybe there is something very obvious I am missing. Any suggestions or recommendations on how folks usually get around these issues would be helpful. I am very close to convince a wider adoption of Julia in my circle if I can show people a MATLAB like debug flow using breakpoints. Thanks!

---

<div class="post-metadata">

**Author:** ![notGiGi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/notgigi/32/213308_2.png) [@notGiGi](https://discourse.julialang.org/u/notGiGi)\
**Post date:** [November 22, 2024, 1:36am UTC](https://discourse.julialang.org/t/breakpoint-issues-and-best-practices-in-vscode/122914/2 "2024-11-22T01:36:43Z")

</div>

Hello, Kevjzheng.

In fact, there is something obvious and you are not missing at all. Debugging in Julia is some awful experience for a lot of people. So I’m really sorry if my response doesn’t give you a solution. I’m going to put here posts about debugging in julia so you can see that is a very hot topic and people coming from other languages that are used to debug are facing the same issue. In the first post you can find a discussion about some debugger Pkg

[What is the standard way to debug Julia?](https://discourse.julialang.org/t/what-is-the-standard-way-to-debug-julia/90436)

[Debugger status and future plans?](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638)

---

<div class="post-metadata">

**Author:** ![Nathan\_Boyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nathan_boyer/32/14825_2.png) [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Post date:** [November 22, 2024, 3:15pm UTC](https://discourse.julialang.org/t/breakpoint-issues-and-best-practices-in-vscode/122914/3 "2024-11-22T15:15:48Z")

</div>

I have had trouble with this myself. (See [this Issue](https://github.com/julia-vscode/julia-vscode/issues/3335) and [this Discourse post](https://discourse.julialang.org/t/how-to-use-vscode-and-repl-to-write-and-test-a-package/78818). I don’t think either are really resolved unfortunately.)

One obvious thing I was missing initially is that you need to run the debugger on code that **calls** your functions not on the code which **defines** your functions. The breakpoints are set in the source code files, but the debugger is usually run from a separate file. You can either create a file for testing your functions yourself and click the GUI button for “Julia: Debug File in New Process” on that file, or you can use [these macros](https://www.julia-vscode.org/docs/dev/userguide/debugging/#Debugging-code-from-the-REPL) to start debugging from the REPL e.g. `@run f(x)`.

Typically now, I will try the `@enter` macro first, and if that is too slow, I will switch to using Infiltrator.jl. Infiltrator works faster and more reliably, albeit with fewer features.  
.
