debug
debug copied to clipboard
`break /foo/` for matched method
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 containsfoo.C1#foo,C2#foobar,C3#bazfoo, ...
break C#/foo/: C's methods which containsfoo.C#foo,C#foobar, ...- Seem's ugly...
break /C/#foo: Method foo of classes which names containC.C1#fooC2#foo, ...- Seems ugly too.
- Only allow
break /C#foo/orbreak /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 allinitializemethods (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#fooD.fooE.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.
For the dynamic typing language, pending feature is important I think but I'm not sure how to handle it on the other debuggers.
On the lldb:
(lldb) breakpoint set --func-regex regular-expression
(lldb) br s -r regular-expression
What happens on method_missing and so on...
step into name checks all method invocation and it is slow.
Maybe break /xxx/ users don't expect it, I think.