JuliaDebug / Gallium.jl

The Julia debugger
Other
174 stars 23 forks source link

Stepping is still confusing #116

Closed timholy closed 6 years ago

timholy commented 8 years ago

Let's try to find out how something is printed:

v = rand(3)
@enter display(v)

If you play with this, you pretty quickly get to the point of realizing that the proper choice of n, s, and nc is not that obvious; for example, to dive down into display I have to step into a call that claims to be about getindex; at other points I get

1|debug > nc
In REPL.jl:117
116   end
117   display(d::REPLDisplay, x) = display(d, MIME("text/plain"), x)
118   
119   function print_response(repl::AbstractREPL, val::ANY, bt, show_value::Bool, have_color::Bool)

About to run: x

and "running x" does not sound like you want to step into it (but what's actually about to be run is display, and I'd better step into it).

Keno commented 8 years ago

About to run shows you what it'll run if you use se. Generally nc is a pretty good level of granularity. Can you tell me how you go into the running x state above? That shouldn't be possible coming from an nc.

Keno commented 8 years ago

I've been thinking about better navigation and what I think could be good is to display a tree of calls that are coming up and allow you to select which one you want to step into.

timholy commented 8 years ago

I just checked out master, rebuilt, and with v = rand(3) I get this (apologies for the long post):

julia> @enter display(v)
In multimedia.jl:164
163   function display(x)
164       for i = length(displays):-1:1
165           xdisplayable(displays[i], x) &&
166               @try_display return display(displays[i], x)

About to run: Base.Multimedia.colon
1|debug > n
In multimedia.jl:164
163   function display(x)
164       for i = length(displays):-1:1
165           xdisplayable(displays[i], x) &&
166               @try_display return display(displays[i], x)
167       end

About to run: (getindex)(<suppressed 47701 bytes of output>,2)

1|debug > s
In array.jl:308
307   # This is more complicated than it needs to be in order to get Win64 through bootstrap
308   getindex(A::Array, i1::Real) = arrayref(A, to_index(i1))
309   getindex(A::Array, i1::Real, i2::Real, I::Real...) = arrayref(A, to_index(i1), to_index(i2), to_indexes(I...)...) # TODO: REMOVE FOR #14770
310   

About to run: Base.arrayref

1|debug > nc
In array.jl:308
307   # This is more complicated than it needs to be in order to get Win64 through bootstrap
308   getindex(A::Array, i1::Real) = arrayref(A, to_index(i1))
309   getindex(A::Array, i1::Real, i2::Real, I::Real...) = arrayref(A, to_index(i1), to_index(i2), to_indexes(I...)...) # TODO: REMOVE FOR #14770
310   

About to run: (Base.to_index)(2)

1|debug > nc
In array.jl:308
307   # This is more complicated than it needs to be in order to get Win64 through bootstrap
308   getindex(A::Array, i1::Real) = arrayref(A, to_index(i1))
309   getindex(A::Array, i1::Real, i2::Real, I::Real...) = arrayref(A, to_index(i1), to_index(i2), to_indexes(I...)...) # TODO: REMOVE FOR #14770
310   

About to run: (Core.arrayref)(<suppressed 47701 bytes of output>,2)

1|debug > nc
In array.jl:308
307   # This is more complicated than it needs to be in order to get Win64 through bootstrap
308   getindex(A::Array, i1::Real) = arrayref(A, to_index(i1))
309   getindex(A::Array, i1::Real, i2::Real, I::Real...) = arrayref(A, to_index(i1), to_index(i2), to_indexes(I...)...) # TODO: REMOVE FOR #14770
310   

About to run: return <suppressed 47647 bytes of output>

1|debug > nc
In multimedia.jl:164
163   function display(x)
164       for i = length(displays):-1:1
165           xdisplayable(displays[i], x) &&
166               @try_display return display(displays[i], x)
167       end

About to run: x

1|debug > s
In multimedia.jl:161
160   
161   xdisplayable(D::Display, args...) = applicable(display, D, args...)
162   
163   function display(x)

About to run: Core._apply

1|debug > nc
In multimedia.jl:161
160   
161   xdisplayable(D::Display, args...) = applicable(display, D, args...)
162   
163   function display(x)

About to run: (tuple)(display,<suppressed 47647 bytes of output>)

1|debug > nc
In multimedia.jl:161
160   
161   xdisplayable(D::Display, args...) = applicable(display, D, args...)
162   
163   function display(x)

About to run: (Core._apply)(applicable,<suppressed 47657 bytes of output>,([0.0307428,0.0324675,0.134247],))

1|debug > nc
In multimedia.jl:161
160   
161   xdisplayable(D::Display, args...) = applicable(display, D, args...)
162   
163   function display(x)

About to run: return true

1|debug > nc
In multimedia.jl:164
163   function display(x)
164       for i = length(displays):-1:1
165           xdisplayable(displays[i], x) &&
166               @try_display return display(displays[i], x)
167       end

About to run: unless true goto 36

1|debug > nc
In multimedia.jl:164

About to run: (getindex)(<suppressed 47701 bytes of output>,2)

1|debug > s
In array.jl:308
307   # This is more complicated than it needs to be in order to get Win64 through bootstrap
308   getindex(A::Array, i1::Real) = arrayref(A, to_index(i1))
309   getindex(A::Array, i1::Real, i2::Real, I::Real...) = arrayref(A, to_index(i1), to_index(i2), to_indexes(I...)...) # TODO: REMOVE FOR #14770
310   

About to run: Base.arrayref

1|debug > nc
In array.jl:308
307   # This is more complicated than it needs to be in order to get Win64 through bootstrap
308   getindex(A::Array, i1::Real) = arrayref(A, to_index(i1))
309   getindex(A::Array, i1::Real, i2::Real, I::Real...) = arrayref(A, to_index(i1), to_index(i2), to_indexes(I...)...) # TODO: REMOVE FOR #14770
310   

About to run: (Base.to_index)(2)

1|debug > nc
In array.jl:308
307   # This is more complicated than it needs to be in order to get Win64 through bootstrap
308   getindex(A::Array, i1::Real) = arrayref(A, to_index(i1))
309   getindex(A::Array, i1::Real, i2::Real, I::Real...) = arrayref(A, to_index(i1), to_index(i2), to_indexes(I...)...) # TODO: REMOVE FOR #14770
310   

About to run: (Core.arrayref)(<suppressed 47701 bytes of output>,2)

1|debug > nc
In array.jl:308
307   # This is more complicated than it needs to be in order to get Win64 through bootstrap
308   getindex(A::Array, i1::Real) = arrayref(A, to_index(i1))
309   getindex(A::Array, i1::Real, i2::Real, I::Real...) = arrayref(A, to_index(i1), to_index(i2), to_indexes(I...)...) # TODO: REMOVE FOR #14770
310   

About to run: return <suppressed 47647 bytes of output>

1|debug > nc
In multimedia.jl:164

About to run: x

1|debug > s
In REPL.jl:117
116   end
117   display(d::REPLDisplay, x) = display(d, MIME("text/plain"), x)
118   
119   function print_response(repl::AbstractREPL, val::ANY, bt, show_value::Bool, have_color::Bool)

About to run: Base.REPL.display

1|debug > s
In multimedia.jl:17
16  import Base: show, print, string, convert
17  MIME(s) = MIME{Symbol(s)}()
18  show{mime}(io::IO, ::MIME{mime}) = print(io, "MIME type ", string(mime))
19  print{mime}(io::IO, ::MIME{mime}) = print(io, mime)

About to run: Core.apply_type

1|debug > nc
In multimedia.jl:17
16  import Base: show, print, string, convert
17  MIME(s) = MIME{Symbol(s)}()
18  show{mime}(io::IO, ::MIME{mime}) = print(io, "MIME type ", string(mime))
19  print{mime}(io::IO, ::MIME{mime}) = print(io, mime)

About to run: (Symbol)("text/plain")

1|debug > nc
In multimedia.jl:17
16  import Base: show, print, string, convert
17  MIME(s) = MIME{Symbol(s)}()
18  show{mime}(io::IO, ::MIME{mime}) = print(io, "MIME type ", string(mime))
19  print{mime}(io::IO, ::MIME{mime}) = print(io, mime)

About to run: (Core.apply_type)(MIME{mime},text/plain)

1|debug > nc
In multimedia.jl:17
16  import Base: show, print, string, convert
17  MIME(s) = MIME{Symbol(s)}()
18  show{mime}(io::IO, ::MIME{mime}) = print(io, "MIME type ", string(mime))
19  print{mime}(io::IO, ::MIME{mime}) = print(io, mime)

About to run: (MIME{Symbol("text/plain")})()

1|debug > nc
In multimedia.jl:17
16  import Base: show, print, string, convert
17  MIME(s) = MIME{Symbol(s)}()
18  show{mime}(io::IO, ::MIME{mime}) = print(io, "MIME type ", string(mime))
19  print{mime}(io::IO, ::MIME{mime}) = print(io, mime)

About to run: return MIME type text/plain

1|debug > nc
In REPL.jl:117
116   end
117   display(d::REPLDisplay, x) = display(d, MIME("text/plain"), x)
118   
119   function print_response(repl::AbstractREPL, val::ANY, bt, show_value::Bool, have_color::Bool)

About to run: x

1|debug > s
In REPL.jl:112
111   function display(d::REPLDisplay, ::MIME"text/plain", x)
112       io = outstream(d.repl)
113       Base.have_color && write(io, answer_color(d.repl))
114       show(IOContext(io, multiline=true, limit=true), MIME("text/plain"), x)

About to run: Base.REPL.outstream

1|debug > n
In REPL.jl:112
111   function display(d::REPLDisplay, ::MIME"text/plain", x)
112       io = outstream(d.repl)
113       Base.have_color && write(io, answer_color(d.repl))
114       show(IOContext(io, multiline=true, limit=true), MIME("text/plain"), x)
115       println(io)

About to run: (getfield)(Base,have_color)

1|debug > 

Here's Pkg.status():

julia> Pkg.status()
24 required packages:
 - BenchmarkTools                0.0.1+             master
 - CRC                           1.1.1
 - Cairo                         0.2.31
 - Compat                        0.7.20
 - DataArrays                    0.3.2
 - Distributions                 0.9.0
 - FactCheck                     0.4.3
 - GR                            0.10.0
 - Gallium                       0.0.2+             master
 - HDF5                          0.6.1+             master
 - HttpParser                    0.1.1+             master
 - ImageMagick                   0.1.6
 - ImageView                     0.1.20
 - Images                        0.5.5+             master
 - Interact                      0.3.1
 - Ipopt                         0.2.2
 - JLD                           0.6.0+             master
 - MAT                           0.2.14
 - PkgDev                        0.1.0+             master
 - PlotlyJS                      0.2.0
 - Plots                         0.6.2+             master
 - ProfileView                   0.1.2
 - SnoopCompile                  0.1.0
 - TestImages                    0.1.1
95 additional packages:
 - ASTInterpreter                0.0.2+             master
 - AbstractTrees                 0.0.2
 - ArgParse                      0.3.0
 - ArrayIteration                0.0.0-             teh/stored2 (unregistered)
 - ArrayViews                    0.6.4
 - BaseBenchmarks                0.0.0-             master (unregistered)
 - BinDeps                       0.3.21+            teh/compat
 - BinDepsNative                 0.0.0-             9fd47f29 (unregistered)
 - Blink                         0.3.4+             master
 - Blosc                         0.1.5
 - BufferedStreams               0.1.3
 - COFF                          0.0.0-             master (unregistered)
 - Calculus                      0.1.14
 - Codecs                        0.1.5
 - ColorTypes                    0.2.2
 - ColorVectorSpace              0.1.4+             master
 - Colors                        0.6.4
 - Compose                       0.4.2
 - Contour                       0.1.0
 - DWARF                         0.0.2+             master
 - DataFrames                    0.7.3
 - DataStructures                0.4.4
 - Dates                         0.4.4
 - DebuggingUtilities            0.0.0-             master (unregistered)
 - Distances                     0.3.1
 - Docile                        0.5.23
 - DualNumbers                   0.2.2
 - ELF                           0.0.2+             master
 - FileIO                        0.0.6
 - FixedPointNumbers             0.1.3
 - FixedSizeArrays               0.1.2
 - GZip                          0.2.18
 - Gadfly                        0.4.2
 - Graphics                      0.1.3
 - Grid                          0.4.0
 - Gtk                           0.9.3+             teh/blank_event_key
 - GtkUtilities                  0.0.9+             master
 - HackThatBase                  0.0.0-             teh/ffmc (unregistered)
 - Hexagons                      0.0.4
 - Hiccup                        0.0.2
 - HttpCommon                    0.2.6
 - HttpServer                    0.1.5+             master
 - ImagePlayer                   0.0.0-             master (unregistered, dirty)
 - Immerse                       0.0.11
 - IniFile                       0.2.5
 - Iterators                     0.1.9
 - JLDArchives                   0.0.7+             master
 - JSON                          0.5.1
 - JuliaParser                   0.7.2+             master
 - KernelDensity                 0.1.2
 - Lazy                          0.10.1
 - Libz                          0.1.1
 - Loess                         0.0.6
 - Lumberjack                    2.0.1
 - MachO                         0.0.2
 - MacroTools                    0.3.0
 - MathProgBase                  0.5.1
 - MbedTLS                       0.2.2
 - Measures                      0.0.2
 - Memoize                       0.0.1
 - MetadataTools                 0.3.1
 - Mustache                      0.0.15
 - Mux                           0.2.0              master
 - NaNMath                       0.2.1
 - Nettle                        0.2.3
 - ObjFileBase                   0.0.2+             master
 - Optim                         0.5.0
 - PDMats                        0.4.1
 - PkgSearch                     0.0.0-             master (unregistered)
 - PositiveFactorizations        0.0.1
 - Reactive                      0.3.3+             master
 - RecipesBase                   0.0.1
 - Reexport                      0.0.3
 - Requests                      0.3.7
 - Requires                      0.2.2+             master
 - SHA                           0.1.2
 - SIUnits                       0.0.6
 - Showoff                       0.0.7
 - SortingAlgorithms             0.0.6
 - Sparklines                    0.1.0
 - StackTraces                   0.1.1
 - StatsBase                     0.8.1
 - StatsFuns                     0.2.2
 - StructIO                      0.0.2
 - TerminalUI                    0.0.1+             master
 - TexExtensions                 0.0.3
 - TextWrap                      0.1.5
 - Tk                            0.3.8
 - URIParser                     0.1.3+             master
 - VT100                         0.0.1+             master
 - WebSockets                    0.1.2
 - Winston                       0.11.13
 - WoodburyMatrices              0.1.5
 - ZipFile                       0.2.6
 - Zlib                          0.1.12
Keno commented 8 years ago

Ah, it's by using nc to step out of a call. Thanks, I may have omitted nc from the list of macro-step operations. Will fix.

timholy commented 6 years ago

Appears to be fixed in the new release.