Skip to content

Breakpoint stop working on reload when changing Concrete Syntax pattern #2688

@jbdoderlein

Description

@jbdoderlein

Breakpoint stop working on reload when changing Concrete Syntax pattern

When a module contains breakpoint, if a change is made to concrete syntax pattern, the breakpoints already setup do not stop the execution.
The underlying problem is that the hash of source location in the interpreter change when reloading with concrete syntax pattern and the debugger internal Map match on ISourceLocation.

To Reproduce
Main.rsc :

module Main
import ParseTree;

lexical Ident =  [a-zA-Z][a-zA-Z0-9]* !>> [a-zA-Z0-9];
syntax As = Ident* a;

int testfunc(As aa){
    switch(aa){
        case (As)`aaa`: return 3;
        case (As)`aaaa`: return 4;
    }
    return 1;
}

void main() {
    As t = parse(#As, "aaaaa");
    testfunc(t);
}

If a breakpoint is on the return 1; line, a change in a case pattern disable all breakpoint after reload (until a breakpoint is set/unset)

Expected behavior
Breakpoint remains active on module reload.

Desktop (please complete the following information):

  • Context: VSCode Debugger

Fix possibility
There is multiple option to fix this issue :

  • match SourceLocation on file+position and not on hash. This would work but would certainly slow down the debugger (since check is made at every debugger step)
  • the debugger in fact reload the breakpoint on file save, maybe it's possible to detect a mismatch and update SourceLocation objects

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions