Skip to content

VSCode debugger stops in a macro without breakpoint #1667

@ghost

Description

Hello,

I'm using @einsum from the Tullio package, https://github.com/mcabbott/Tullio.jl, and I get an unexpected behavior when debugging a Julia program in VSCode. The debugger always stops at the same line in macro.jl, a file from Tullio, without having set a break point there.

Say, I have a program like

using Tullio: @einsum

v = [1; 2; 3];
w = [4; 5; 6];       # <== 1st breakpoint
@einsum a[i,j] := v[i] * w[j]; 
println("a=", a); 
b  = 4 * a;          # <== 2nd breakpoint 
println("b=", b);

After I start the debugger with F5, VSCode shows correct behavior at the 1st breakpoint, see first snapshot.
When I continue with F5 the debugger stops in line 826 of macro.jl, a file of Tullio, see 2nd snapshot.
Another continue with F5 leads me to the 2nd BP, see 3rd snapshot.
In case I have several @einsum statements the debugger stops several times always in macro.jl at line 826. That can be disturbing if I want to debug code after many @einsum statements.

I discussed this behavior with the author of Tullio, @mcabbott, and we think that it is a problem of VSCode.
With Base.remove_linenums!(@macroexpand1 @einsum a[i,j] := v[i] * w[j]) one can check the code generated by @einsum.
See mcabbott/Tullio.jl#33.

Any hints?

Ralf

After starting the debugger with F5 at the 1st breakpoint (as expected)

2_debugger_at_1st_BP

Continue F5 and the debugger stops in macro.jl (unexpected behavior)

3_debugger_stops_in_macro_jl

Another Continue F5 and the debugger stops at the 2nd break point (as expected)

4_debugger_at_2nd_BP

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions