Macaulay2 / Macaulay2/M2

The debugger skips a calling function that declares no local variables, contrary to the documentation

Open
#4,560 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This issue was triaged from bugs/dan/1-debugger-and-empty-frames, one of the 857 files removed from the pre-GitHub bugs/ tree by d2c8d27826 and catalogued in #36. The commentary below was written by Claude (Claude Opus 5, via Claude Code), not by @d-torrance, whose account posted it -- please weigh it accordingly.

The original file, verbatim
-- -*- M2 -*- It's counter-intuitive that the debugger won't stop in g as we ascend the stack:

    f = () -> (
	 1/0;
	 4)
    g = () -> (
	 3;
	 if true then f();
	 5)


end
load "1-debugger-and-empty-frames"
g()



Macaulay2, version 1.2.99
with packages: ConwayPolynomials, Elimination, IntegralClosure, LLLBases, PrimaryDecomposition, ReesAlgebra, SchurRings, TangentCone

i1 : load "1-debugger-and-empty-frames"

i2 : g()
1-debugger-and-empty-frames:4:11:(1):[2]: error: division by zero
1-debugger-and-empty-frames:4:11:(1):[2]: --entering debugger (type help to see debugger commands)
1-debugger-and-empty-frames:4:10-4:12: --source code:
         1/0;

ii3 : end
Where it stands today

Reproduces — and it is not merely counter-intuitive, as the file says. It contradicts the
documentation
.

ov_debugging.m2:102-107 promises that after typing end, "the debugger will be entered again … at the
point inside the function g from which the function f was called"
, and that listLocalSymbols will
then show g's local variables.

Side by side on 1.26.06

With the file's own functions, which declare no local variables, end returns straight to the top-level
prompt and g is never entered:

f = () -> (1/0; 4)
g = () -> (3; if true then f(); 5)
g()
-- debugger stops in f; type end
-- back at the top level, g skipped

With the same call structure but a local variable in each function, end re-enters the debugger inside
the caller and listLocalSymbols shows it.

So the skip is specifically the empty-frame case: the documented walk up the stack silently does not
happen for any function that happens to declare no locals. Four lines reproduce it.

Related but distinct

1-debugger-and-tail-recursion is the case where frames are elided rather than empty.

open · disposition issue · source of truth: bug-triage/catalog.tsv

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

Start by reading ov_debugging.m2:102-107 and run the four-line f/g reproduction from the issue in Macaulay2. Compare the empty-frame case with functions that declare locals, then use the documented debugger flow to verify that typing end re-enters inside g and that listLocalSymbols can show its locals.

Written by the indexing model from the issue text.

Assessment

Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.