Breakpoint issues and best practices in VSCode

I have had trouble with this myself. (See this Issue and this Discourse post. 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 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.
.

2 Likes