Skip to content

Stop at CheckBreakpoint only for once #406

@st0012

Description

@st0012

Currently, we can add a CheckBreakpoint with break if: <expression>. I personally haven't used it before but it looks like it's not practical in most cases because: once the expression is fulfilled, the breakpoint will stop at every single line afterward.

❯ ruby -Ilib -rdebug check_bp_issue.rb
[1, 6] in check_bp_issue.rb
=>   1| binding.b(do: "break if: a == 1")
     2|
     3| a = 1
     4| b = 2
     5| c = 3
     6| d = 4
=>#0    <main> at check_bp_issue.rb:1
(rdbg:binding.break) break if: a == 1
#0  BP - Check  a == 1
[1, 6] in check_bp_issue.rb
     1| binding.b(do: "break if: a == 1")
     2|
     3| a = 1
=>   4| b = 2
     5| c = 3
     6| d = 4
=>#0    <main> at check_bp_issue.rb:4

Stop by #0  BP - Check  a == 1
(rdbg) c    # continue command
[1, 6] in check_bp_issue.rb
     1| binding.b(do: "break if: a == 1")
     2|
     3| a = 1
     4| b = 2
=>   5| c = 3
     6| d = 4
=>#0    <main> at check_bp_issue.rb:5

Stop by #0  BP - Check  a == 1
(rdbg) c    # continue command
[1, 6] in check_bp_issue.rb
     1| binding.b(do: "break if: a == 1")
     2|
     3| a = 1
     4| b = 2
     5| c = 3
=>   6| d = 4
=>#0    <main> at check_bp_issue.rb:6

Stop by #0  BP - Check  a == 1
(rdbg) c    # continue command

So perhaps we should make this a one-off breakpoint?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions