Skip to content
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] Existing processes break after a breakpoint is removed #7336

Closed
robertoaloi opened this issue May 31, 2023 · 1 comment · Fixed by #7395
Closed

[debugger] Existing processes break after a breakpoint is removed #7336

robertoaloi opened this issue May 31, 2023 · 1 comment · Fixed by #7395
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@robertoaloi
Copy link
Contributor

Describe the bug

The debugger which comes with Erlang LS uses the Erlang interpreter behind the scenes.

If the user removes a breakpoint via the UI, existing processes will still break at the removed breakpoint, creating confusion for the user.

To Reproduce

Given:

-module(fact).

-compile(export_all).

fact(0) ->
    1;
fact(N) when N > 0 ->
    N * fact(N-1).

And:

-module(test).
-compile(export_all).
test() ->
    {module, fact} = int:i(fact),
    int:break(fact, 8),
    spawn(fun() -> fact:fact(5) end),
    timer:sleep(100),
    [{Pid, _, _, _}] = int:snapshot(),
    int:no_break(fact),
    %% int:no_break(),
    int:continue(Pid),
    timer:sleep(100),
    is_process_alive(Pid).

Using the following commands:

➜  /tmp erl
Erlang/OTP 25 [erts-13.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Eshell V13.2  (abort with ^G)
1>  c(fact, [debug_info]).
{ok,fact}
2> c(test).
{ok,test}
3> test:test().

This produces:

true

By replacing the int_no_break(fact) with the commented line, instead:

false

Expected behavior
Once a breakpoint is removed and the continue command is issued, existing processes should not break.

Affected versions
OTP 25 (at least).

Additional context
This seems related to the way breakpoints are stored and updated in the process dictionary in idbg_eval.

@robertoaloi robertoaloi added the bug Issue is reported as a bug label May 31, 2023
@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Jun 5, 2023
@bjorng bjorng self-assigned this Jun 7, 2023
@bjorng bjorng linked a pull request Jun 13, 2023 that will close this issue
@bjorng
Copy link
Contributor

bjorng commented Jun 13, 2023

This bug seems to have existed for a very long time. I have fixed it for OTP 24 and forward in the linked pull request.

bjorng added a commit that referenced this issue Jun 16, 2023
…H-7336/OTP-18644

debugger: Fix broken `int:no_break(Mod)`
@bjorng bjorng closed this as completed in 883adc9 Jun 16, 2023
bjorng pushed a commit that referenced this issue Jun 29, 2023
…maint-25

* bjorn/debugger/fix-breakpoints/GH-7336/OTP-18644:
  debugger: Fix broken `int:no_break(Mod)`
bjorng pushed a commit that referenced this issue Jun 29, 2023
…maint-24

* bjorn/debugger/fix-breakpoints/GH-7336/OTP-18644:
  debugger: Fix broken `int:no_break(Mod)`
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants