-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debugger fails to find location of calls to "error" in Core #3417
Comments
Other observation: if I comment out these lines: M2/M2/Macaulay2/m2/debugging.m2 Lines 15 to 18 in ec9e9ac
then everything works fine: i4 : blah 12
../../m2/debugging.m2:6:17:(1): error: debug me
../../m2/debugging.m2:6:17:(1): --entering debugger (type help to see debugger commands)
../../m2/debugging.m2:6:12-6:28: --source code:
blah = x -> error "debug me" So maybe a naive solution is to move that segment to the interpreter. Playing around with setting @pzinn my best guess is that the FilePosition of the error code is somehow involved, but I don't know where to look for more clues. |
In #3431 I'm adding a new keyword kernel Matrix := Module => opts -> (cacheValue symbol kernel) ((m) -> (
N := source m;
if m == 0 then return N;
P := target m;
if m.?RingMap then (
f := m.RingMap;
n := map(target m,f source m,raw m);
- p := pushNonLinear(options pushForward, f, coimage n);
+ p := breakpoint pushNonLinear(options pushForward, f, coimage n);
image p)
else (
m = matrix m;
if P.?generators then m = P.generators * m;
h := modulo(m, if P.?relations then P.relations);
if N.?generators then h = N.generators * h;
subquotient( h, if N.?relations then N.relations)))) |
definitely these lines should go at some point (and be moved to the interpreter). |
Interestingly, the same test you propose at the top produces a quite different result on Macaulay2Web, which incorporates some major changes I made to the error workflow. I'll try to analyse where the difference is. |
On the other hand, it used to work as late as version 1.21: Macaulay2, version 1.21
i1 : debug Core
i2 : errorDepth=1
o2 = 1
i3 : blah()
M2/Macaulay2/m2/debugging.m2:6:13:(1):[1]: error: debug me
M2/Macaulay2/m2/debugging.m2:6:13:(1):[1]: --entering debugger (type help to see debugger commands)
M2/Macaulay2/m2/debugging.m2:6:13-6:13: --source code:
blah = x -> error "debug me" So analyzing the differences since then could also work. |
Very exiting realization: the |
@pzinn this error was introduced after 1.24.05. Did you have any luck isolating when it started? |
Okay, found the commit that broke this: 94ac762. Going to submit a pull request to revert this for now. Later we can figure out how to fix error location in tail calls without breaking the debugger. |
All I can add (a bit late) is that I think I'd effectively solved the problem on my branch (without any need to revert #3544), see attached screenshot. But as I mentioned in the other thread, will need more time to investigate. |
@mikestillman pointed out something which I had also observed and noted on other issues here, which is that the debugger often doesn't end up in the right place in the Core.
Here is how to reproduce: insert
blah = x -> error "debug me"
somewhere in Core, then run it witherrorDepth
one or less. Here is the result for me:I don't seem to be able to get the original location in anyway.
One interesting factor is that avoiding tail-end optimization of
error
leads to the symbols remaining accessible. If I instead addblah = x -> (error "debug me";)
then I get:So far identical, but:
Note that if instead of
error "debug me"
I had put1/0
then location would have worked fine.Related to this, there are a number of tests for error messages here that weren't being tested manually. Perhaps they should be moved to a
manual
directory, with more documentation of expected behavior, or somehow made automatic.The text was updated successfully, but these errors were encountered: