The Wayback Machine - https://web.archive.org/web/20260202020837/https://github.com/timholy/Rebugger.jl/pull/61
Skip to content

Conversation

@timholy
Copy link
Owner

@timholy timholy commented Mar 5, 2019 •

This adds a new mode that's rather fun. Try entering a command at the REPL and then hit Meta-i (on the same line, don't hit Enter). Then, for an intro to what can be done type ?.

This requires timholy/Revise.jl#243, fully up-to-date JuliaInterpreter, and incorporates #60.

This also moves a lot of display code to its own file
It's unclear whether the displayed code should also change. Leaving it
unchanged helps indicate that execution will still proceed from the
lowest level of the stack. Showing it changed helps provide the context
of the call stack. This shows it changed.
@KristofferC
Copy link
Contributor

interpret> 1+1
┌ Error: Error in the keymap
│   exception =
│    UndefVarError: clear_nlines not defined
│    Stacktrace:
│     [1] getproperty at .\sysimg.jl:13 [inlined]
│     [2] interpret(::REPL.LineEdit.MIState) at C:\Users\Kristoffer\.julia\packages\Rebugger\6cJMB\src\ui.jl:336
│     [3] (::getfield(Rebugger, Symbol("##24#27")))(::REPL.LineEdit.MIState, ::REPL.LineEditREPL, ::Vararg{Any,N} where N) at C:\Users\Kristoffer\.julia\packages\Rebugger\6cJMB\src\ui.jl:484
│     [4] #invokelatest#1 at .\essentials.jl:742 [inlined]
│     [5] invokelatest at .\essentials.jl:741 [inlined]
@timholy
Copy link
Owner Author

timholy commented Mar 5, 2019

@KristofferC
Copy link
Contributor

Just pressing alt + i gives

interpret> ┌ Error: Error in the keymap
│   exception =
│    expression is not a function call or symbol
│    Stacktrace:
│     [1] error(::String) at .\error.jl:33
│     [2] extract_args(::Module, ::Nothing) at C:\Users\Kristoffer\Debugging\JuliaInterpreter\src\JuliaInterpreter.jl:1032
│     [3] interpret(::REPL.LineEdit.MIState) at C:\Users\Kristoffer\.julia\packages\Rebugger\6cJMB\src\ui.jl:199
│     [4] (::getfield(Rebugger, Symbol("##24#27")))(::REPL.LineEdit.MIState, ::REPL.LineEditREPL, ::Vararg{Any,N} where N) at C:\Users\Kristoffer\.julia\packages\Rebugger\6cJMB\src\ui.jl:484
│     [5] #invokelatest#1 at .\essentials.jl:742 [inlined]
│     [6] invokelatest at .\essentials.jl:741 [inlined]
@timholy
Copy link
Owner Author

timholy commented Mar 5, 2019

Not anymore 😄

@KristofferC
Copy link
Contributor

Entering rand(5) and pressing the right arrow key:

interpret> rand(5)[ Info: tracking Random

rand(dims::Integer...) in Random at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Random\src\Random.jl:243
  dims = (5,)
ERROR: AssertionError: issorted(linenos)
Stacktrace:
 [1] expression_lines(::Method) at C:\Users\Kristoffer\.julia\packages\Rebugger\6cJMB\src\printing.jl:52
 [2] reset_frame!(::Rebugger.InterpretHeader, ::Bool) at C:\Users\Kristoffer\.julia\packages\Rebugger\6cJMB\src\ui.jl:360 [3] interpret(::REPL.LineEdit.MIState) at C:\Users\Kristoffer\.julia\packages\Rebugger\6cJMB\src\ui.jl:288
 [4] (::getfield(Rebugger, Symbol("##24#27")))(::REPL.LineEdit.MIState, ::REPL.LineEditREPL, ::Vararg{Any,N} where N) at C:\Users\Kristoffer\.julia\packages\Rebugger\6cJMB\src\ui.jl:484
@timholy
Copy link
Owner Author

timholy commented Mar 5, 2019 •

Thanks! Should be better now? EDIT: argh, not yet...

@timholy
Copy link
Owner Author

timholy commented Mar 5, 2019

Should be better now. Thanks for trying it!

timholy added 8 commits March 5, 2019 05:04
It can be very confusing to see the full body of the method but actually
be in a method that does something like this:

    %1 = (#self#)(x, default_args...)
    return %1

because as soon as you step a line you discover you're done with the
call.
This takes a much stricter approach: any line number not observed is
missing. It then performs some analysis of missings and replaces them
with values when there is only one possible answer. For truly unknown
lines, no line number is printed. (And no breakpoint info.)
@timholy timholy force-pushed the teh/interpret branch 2 times, most recently from e914f76 to 1350c94 Compare March 17, 2019 23:36
timholy added 13 commits March 18, 2019 15:44
This came up in a method that had nested conditionals and/or loops
This is pretty complicated so it's worth testing & explaining.
Also generalizes the line number correction to allow any number of
skipped lines as long as they remain in register.
This has long been needed. Obviously this is just a stub, needs many
more tests (for edit mode as well as interpret mode)
This is more consistent with Debugger and probably easier to see.
@timholy timholy closed this Mar 20, 2019
@timholy timholy reopened this Mar 20, 2019
@timholy timholy merged commit 268ac7e into master Mar 20, 2019
@timholy timholy deleted the teh/interpret branch March 20, 2019 21:27
@KristofferC
Copy link
Contributor

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants