`break /foo/` for matched method

Open
#683 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
ruby
Domain
cli, devtools

Research direction

No files, tests, or implementation entry points are named. Start by tracing how the debugger parses and installs the existing break command, then determine how pending breakpoints and future method definitions are handled. Done means an agreed regexp notation and behavior for matching method names, including tests for existing and future definitions.

Written by the indexing model from the issue text.

Description

enhancement

gdb has rbreak regexp (https://sourceware.org/gdb/onlinedocs/gdb/Set-Breaks.html) and maybe debug.gem can provide similar feature.

related to: https://github.com/ruby/debug/issues/655

Questions:

  • Notation:
    • break /foo/ all methods which names contains foo.
      • C1#foo, C2#foobar, C3#bazfoo, ...
    • break C#/foo/: C's methods which contains foo.
      • C#foo, C#foobar, ...
      • Seem's ugly...
    • break /C/#foo: Method foo of classes which names contain C.
      • C1#foo C2#foo, ...
      • Seems ugly too.
    • Only allow break /C#foo/ or break /C\.foo/ and so on?
    • Only allow to match method name?
      • It seems simple. We can extend it later.
  • Behavior:
    • Set breakpoints for existing matched methods (no problem)
    • Set breakpoints for future defined matched methods?
      • break /initialize/ means all initialize methods (and defined in future) can be trapped.
      • maybe it is convenient to support it.
    • Can we support break /obj.foo/ style?
      • maybe no if we allow future defined methods.

So current idea is:

  • break /regexp/ set method breakpoints where the method name matched with Class/Module/method name.
    • break /foo/ should be matched with:
      • C#foo
      • D.foo
      • E.bazfooboo
      • We can not match on class/module names (at least now).
  • It leaves as a pending breakpoint and set breakpoint in future definitions. User needs to del it if you don't need more.
Dominant language
Ruby
Stars
1.3k
Forks
146
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

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.

More from ruby/debug

All issues in ruby/debug

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.