debug icon indicating copy to clipboard operation
debug copied to clipboard

Allow multiple levels of breakpoint command with options

Open st0012 opened this issue 3 years ago • 3 comments

Your proposal

Allow nesting commands like this:

debugger(do: "break Foo#initialize do: (watch @ivar do: pp self)")

Or even:

debugger(do: {
  "break Foo#initialize" => {
    do: { "watch @ivar" => { do: "pp self" } }
  },
  "catch MyError" => { do: "bt 20" }
})

This will allow users to write a simple script, place it at one place (e.g. a Rails controller), and execute the entire debugging process without any automatically.

Right now it's not possible because the debugger assumes do: or pre: options only have 1 level of action.

st0012 avatar Apr 10 '22 11:04 st0012

This request is, allowing "break do:" with debug commands, not Ruby expression, right?

ko1 avatar Apr 17 '22 16:04 ko1

Sorry, I don't understand the question. I want to allow break do: in another break do: if that's what you're asking.

Currently this works:

debugger(do: "break Foo#initialize do: watch @ivar")

But this doesn't work because the debugger doesn't know how to parse the later do:.

debugger(do: "break Foo#initialize do: watch @ivar do: pp self")

st0012 avatar Apr 17 '22 16:04 st0012

Ah, I see. I misunderstood the current do: spec. To introduce parens we need to introduce parser to analyze the commands and we need to consider the syntax more.

ko1 avatar Apr 17 '22 17:04 ko1