Skip to content

Conversation

@st0012
Copy link
Member

@st0012 st0012 commented Nov 17, 2021

I want to introduce a new concept called Debugger locals. The 2 I introduced in this PR are:

  • _raised_ - stores the last raised exception (after a catch breakpoint being triggered)
  • _returned_ - stores the last returned value (after a normal breakpoint being triggered on method return)

They're designed to help pass values between breakpoint and commands. For example:

  • catch Exception do: trace object _raised_ - pass caught exception to object tracer (super handy)
  • b FILE:line do: p _returned_ - evaluate a method's return value without stopping the program

They only exist in debugger's REPL and commands. And they won't affect user program's binding and are not accessible from user program.

Because it could be hard to correctly anticipate when those values are stored (especially _returned_), I think they should always exist with a default value nil instead of causing NameError when called unexpectedly.

Regarding the names, I think they can still be changed. But I don't want to use longer names like raised_exception, as it'll be too lengthy to type in the REPL. Also, since the variables have underscore for both prefix and postfix, I think the chance of this to happen is extremely low.

@st0012 st0012 force-pushed the repl-locals branch 2 times, most recently from 3760a86 to fd49954 Compare November 17, 2021 23:04
@st0012 st0012 force-pushed the repl-locals branch 3 times, most recently from 5c86103 to 08cd956 Compare November 25, 2021 13:48
@st0012 st0012 requested a review from ko1 November 26, 2021 10:04
@st0012
Copy link
Member Author

st0012 commented Dec 1, 2021

@ko1 I've rebased the PR.

@ko1 ko1 merged commit 648c80f into ruby:master Dec 1, 2021
@st0012 st0012 deleted the repl-locals branch December 1, 2021 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants