Skip to content

Commit

Permalink
fixup issues with no nodebug
Browse files Browse the repository at this point in the history
  • Loading branch information
oxinabox committed Apr 22, 2019
1 parent 1d1fc54 commit 5875d3b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/breakpoints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ end

function set_nodebug!(the_rules::BreakpointRules, arg::T) where T
T !== Method || throw(ArgumentError("Disabling instrumentation per method, is not supported."))
return push!(the_rules.breakon_rules, Rule(arg))
return push!(the_rules.no_instrument_rules, Rule(arg))
end

for (name, list) in ((:breakpoint, :breakon_rules), (:nodebug, :no_instrument_rules))
Expand Down
5 changes: 4 additions & 1 deletion src/method_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Returns the module associated with a method.
Note: this is not the module where it was defined (m.module)
but rather the module for which it's function was defined.
"""
moduleof(m) = functiontypeof(m).name.module
moduleof(m::Method) = moduleof(functiontypeof(m))
moduleof(sig::DataType) = sig.name.module
moduleof(sig::UnionAll) = moduleof(sig.body)

functiontypeof(m::Method) = parameter_typeof(m.sig)[1]
parameter_typeof(sig::UnionAll) = parameter_typeof(sig.body)
parameter_typeof(sig::DataType) = sig.parameters
5 changes: 5 additions & 0 deletions test/test_method_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Base.eps(::typeof(moduleof)) = "dummy"
for meth in methods(eps)
@test moduleof(meth) == Base
end


for meth in methods(Vector) # this is a UnionAll
@test moduleof(meth) == Core
end
end


Expand Down
9 changes: 9 additions & 0 deletions test/test_ui.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ clear_breakpoints!(); clear_nodebugs!()
end

###################################################
clear_breakpoints!(); clear_nodebugs!()
@testset "No breakpoints, With no instrumenting of Base" begin
make_readline_patch([])
record = make_recording_breakpoint_hit_patch()
set_nodebug!(Base)
@iron_debug eg1()
@test record == []
end
###########################

clear_breakpoints!(); clear_nodebugs!()
@testset "breakpoint by file and linenum" begin
Expand Down

0 comments on commit 5875d3b

Please sign in to comment.