Debugging a module using VS code debugger

I’m attempting to debug a module by running my “runtests.jl” file with the run and debug button on the left ribbon. Everything runs alright, but it ignores any breakpoints I’ve put in the module.

Does the breakpoints work if you include the code through a using statement?

Am I using this type of debugger correctly?

I tried using Debugger.jl as well, and find that it passes over my breakpoints set in there as well. Do you need to have all code being debugged in a single file?

I want to run basically.

@enter include("my_script.jl")

Is this not a good way to run it?

Ok, figured it out. some reason it doesn’t really work if you don’t call the function explcitly. So just

@enter run_your_function(args...)

is the way to do it using Debugger.jl. Still not sure how to do it using VS Code.

include is special, so I’m not surprised that it can’t be the entrypoint. VSCode’s debugger supports @enter from the integrated REPL, give it a try!

Yeah, just spent a few hours wanting to.

@enter include("test/runtests.jl")

Then I started stepping into that function and I realize it might be not such a good idea.

Packages used via using/import should always work fine with Debugger.jl/VS Code when @enter/@runing a function defined in the package.

That said, VS Code should be able to simply step through your runtests.jl, but it’s possible something along the way is being compiled. Try clearing the list of compiled function/modules in the debugger pane.

1 Like

Related discussion:

1 Like