Skip to content

Commit

Permalink
Merge pull request #47 from JuliaDebug/teh/debugging
Browse files Browse the repository at this point in the history
Make it easier to create useful bug reports from Julia tests
  • Loading branch information
timholy authored Feb 18, 2019
2 parents 7705307 + 488b7a8 commit 65f3c3d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ function run_test_by_eval(test, fullpath, nstmts)
stack = JuliaStackFrame[]
for (i, modex) in enumerate(modexs) # having the index can be useful for debugging
nstmtsleft = $nstmts
# mod, ex = modex
# @show mod ex
frame = JuliaInterpreter.prepare_thunk(modex)
while true
yield() # allow communication between processes
Expand All @@ -198,3 +200,17 @@ function run_test_by_eval(test, fullpath, nstmts)
return ts, aborts
end))
end

# To help debugging
function run_compiled(frame)
Core.eval(moduleof(frame), Expr(:toplevel, quote
let pc = $frame.pc[]
while true # This is finish!, except we need to run it at top level
new_pc = ($_step_expr!)($(Compiled()), $frame, pc, true)
new_pc == nothing && break
pc = new_pc
end
$frame.pc[] = pc
end
end))
end

0 comments on commit 65f3c3d

Please sign in to comment.