src/debugger_utils.jl
changed.
Showing 1 of 1 files from the diff.
@@ -28,44 +28,58 @@
Loading
28 | 28 | line = loc[2] |
|
29 | 29 | end |
|
30 | 30 | ||
31 | + | src = frame.framecode.src |
|
32 | + | ||
31 | 33 | exprs = [] |
|
32 | - | for pc in frame.pc:length(frame.framecode.src.codelocs) |
|
34 | + | for pc in frame.pc:length(src.codelocs) |
|
33 | 35 | loc = JuliaInterpreter.whereis(frame, pc) |
|
34 | 36 | ||
35 | 37 | if loc === nothing || loc[2] > line |
|
36 | 38 | return exprs |
|
37 | 39 | end |
|
38 | 40 | ||
39 | - | expr = JuliaInterpreter.pc_expr(frame, pc) |
|
41 | + | expr = JuliaInterpreter.pc_expr(src, pc) |
|
40 | 42 | if Meta.isexpr(expr, :call) |
|
41 | 43 | for i in 1:length(expr.args) |
|
42 | - | val = try |
|
43 | - | JuliaInterpreter.@lookup(frame, expr.args[i]) |
|
44 | - | catch err |
|
45 | - | expr.args[i] |
|
46 | - | end |
|
47 | - | expr.args[i] = maybe_quote(val) |
|
44 | + | expr.args[i] = maybe_quote(expr.args[i]) |
|
48 | 45 | end |
|
49 | - | push!(exprs, (pc = pc, expr = prettify_expr(expr))) |
|
46 | + | push!(exprs, (pc = pc, expr = prettyprint_expr(expr, src))) |
|
50 | 47 | elseif Meta.isexpr(expr, :(=)) |
|
51 | 48 | expr = expr.args[2] |
|
52 | - | push!(exprs, (pc = pc, expr = prettify_expr(expr))) |
|
49 | + | push!(exprs, (pc = pc, expr = prettyprint_expr(expr, src))) |
|
53 | 50 | end |
|
54 | 51 | end |
|
55 | 52 | exprs |
|
56 | 53 | end |
|
57 | 54 | ||
58 | - | function prettify_expr(expr) |
|
59 | - | if Meta.isexpr(expr, :call) |
|
60 | - | fname = expr.args[1] |
|
55 | + | function prettyprint_expr(expr, src) |
|
56 | + | io = IOBuffer() |
|
57 | + | prettyprint_expr(io, expr, src) |
|
58 | + | return String(take!(io)) |
|
59 | + | end |
|
61 | 60 | ||
62 | - | if Base.isoperator(Symbol(fname)) |
|
63 | - | join(string.(expr.args[2:end]), " $(fname) ") |
|
64 | - | else |
|
65 | - | string(fname, '(', join(expr.args[2:end], ", "), ')') |
|
61 | + | function prettyprint_expr(io, expr, src) |
|
62 | + | if Meta.isexpr(expr, :call) |
|
63 | + | for (i, ex) in enumerate(expr.args) |
|
64 | + | if ex isa QuoteNode |
|
65 | + | print(io, ex.value) |
|
66 | + | elseif ex isa JuliaInterpreter.SlotNumber || ex isa Core.SlotNumber |
|
67 | + | print(io, src.slotnames[ex.id]) |
|
68 | + | elseif ex isa JuliaInterpreter.SSAValue || ex isa Core.SSAValue |
|
69 | + | print(io, '%', ex.id) |
|
70 | + | else |
|
71 | + | prettyprint_expr(io, ex, src) |
|
72 | + | end |
|
73 | + | if i == 1 |
|
74 | + | print(io, '(') |
|
75 | + | elseif i == length(expr.args) |
|
76 | + | print(io, ')') |
|
77 | + | else |
|
78 | + | print(io, ", ") |
|
79 | + | end |
|
66 | 80 | end |
|
67 | 81 | else |
|
68 | - | repr(expr) |
|
82 | + | show(io, expr) |
|
69 | 83 | end |
|
70 | 84 | end |
|
71 | 85 |
Files | Coverage |
---|---|
src | 0.18% |
Project Totals (6 files) | 0.18% |
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.