Skip to content

[#405] Fix breakpoints from different files

Description

Problem: Let a, b be two contract files. Suppose a was launched by the debugger and breakpoints were set in different lines in both files. In some cases, a would hit only the breakpoints set by b. If some breakpoint in b was in a line greater than the number of the lines in a, then the debugger would continue without stopping in a.

Solution: Store in DebuggerState what contract is currently being executed, and also track which contract a breakpoint belongs to. A breakpoint may now only be hit if it belongs to the contract currently being debugged.

During the fix, another bug presented itself: if the contracts happen to have their instructions in different column positions, for example, a is indented by 4 spaces and b is indented by 2 spaces, then a breakpoint of b may be displayed at column 5, because the same column was being shown to all breakpoints. DAP specification says line and column informations are optional, but haskell-dap doesn't comply. We remade Breakpoint and some requests so that these fields are now optional to fix this bug.

Related issue(s)

Resolves #405 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Heitor Toledo Lassarote de Paula

Merge request reports