Motivated by Extremely slow debugging in VS Code, I have become invested in understanding the VSCode debugger.
Is it possible to effectively treat particular functions in my package as compiled?
For example, consider my package with function F that calls f1 and f2. I want to debug function F, but treat f2 as compiled.
Here is the module:
Note I have a breakpoint on every line for now.
Attempt 1:
If I add ALL_MODULES_EXCEPT_MAIN, -testpkg.F, and -testpkg.f1, my “Julia: Compiled Code” looks like this:
But this is the result:
@run F() #stops only at breakpoints in F
@run f1(1.0) #stops at breakpoint
@run f2(1.0) #does not stop
I would expect the breakpoints in F and f1 to work because I’ve specified those as interpreted, but not the one in f2 (so we’re halfway there).
If I disable the breakpoints in function F, things work better:
@run F() #stops at breakpoint in f1 and NOT f2
@run f1(1.0) #stops at breakpoint
@run f2(1.0) #does not stop
Attempt 2:
If instead I set up my “Julia: Compiled Code” like this, by adding ALL_MODULES_EXCEPT_MAIN, -testpkg, testpkg.f2:
In my mind this is equivalent to before, but I get different behaviour:
@run F() #stops at every breakpoint
@run f1(1.0) #stops at breakpoint
@run f2(1.0) #does not stop
and then removing the breakpoints in F:
@run F() #stops at both breakpoints in f1 and f2
@run f1(1.0) #stops at breakpoint
@run f2(1.0) #does not stop
So it seems that whether f2 is compiled or not depends on the setup of “Julia: Compiled Code”, which breakpoints are set, and whether f2 is called directly or in the function F. Am I doing something wrong here? Am I using the correct approach to compile/interpret particular functions?


