Macaulay2 / Macaulay2/M2

continue doesn't work when debugging with breakpoints

Open
#1,928 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Interpreter
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

I have a function that I want to debug, so I add error 0 as a rudimentary breakpoint:

f = x -> (
    print x;
    error 0;
    print x;
x)

Entering help in the debugger says:

           continue            -- leave the debugger, continuing execution
                               -- with current expression

Unless I'm misinterpreting this, it means if I enter continue, that means continue until the next breakpoint. But this has never worked for me:

i1 : load "test.m2"

i2 : errorDepth=1

o2 = 1

i3 : f(12)
12
test.m2:3:5:(3):[1]: error: 0
test.m2:3:5:(3):[1]: --entering debugger (type help to see debugger commands)
test.m2:3:5-3:11: --source code:
    error 0;

ii4 : continue
test.m2:3:5:(3):[1]: error: 0
test.m2:3:5:(3):[1]: --entering debugger (type help to see debugger commands)
test.m2:3:5-3:11: --source code:
    error 0;

ii5 : continue
test.m2:3:5:(3):[1]: error: 0
test.m2:3:5:(3):[1]: --entering debugger (type help to see debugger commands)
test.m2:3:5-3:11: --source code:
    error 0;

ii6 : return
test.m2:4:5:(3):[1]: --stepping limit reached
test.m2:4:5:(3):[1]: --entering debugger (type help to see debugger commands)
test.m2:4:5-4:11: --source code:
    print x;

ii7 : return
test.m2:5:1:(3):[1]: --stepping limit reached
test.m2:5:1:(3):[1]: --entering debugger (type help to see debugger commands)
test.m2:5:1-5:1: --source code:
x)

ii8 : return
stdio:3:1:(3): --done stepping, returning to top level

i9 : oo

o9 = 1

Note that if either continue or return had worked as I described, I should have got 12 as the output. Am I misunderstanding what continue does? At the very least, the documentation begins with "leave the debugger", and that didn't happen, so it should be clarified and a facility for what I described above should be added.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior by loading test.m2, setting errorDepth=1, and comparing the debugger's help, continue, and return commands around error 0. Trace the debugger command handling and clarify whether continue should leave the debugger or resume until a later breakpoint; done means the documented behavior and the reported 12 output are consistent.

Written by the indexing model from the issue text.

Assessment

Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.