-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from oxinabox/ox/afinedebugger
A fine debugger
- Loading branch information
Showing
27 changed files
with
1,181 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
*.jl.cov | ||
*.jl.*.cov | ||
*.jl.mem | ||
/dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
name = "MagneticReadHead" | ||
uuid = "3f5657c2-1c21-11e9-2267-d379952df7a3" | ||
authors = ["Lyndon White <[email protected]>"] | ||
version = "0.1.0" | ||
|
||
[deps] | ||
Cassette = "7057c7e9-c182-5462-911a-8362d720325c" | ||
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2" | ||
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" | ||
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" | ||
Mocking = "78c3b35d-d492-501b-9361-3d52fe80e533" | ||
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" | ||
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" | ||
|
||
[compat] | ||
CodeTracking = "0.4.0" | ||
Revise = "2" | ||
# Revise 1.1 works, except for setting breakpoints on files outside of packages | ||
|
||
[extras] | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
struct Rule{V} | ||
v::V | ||
statement_ind::Int | ||
end | ||
# No matter if a Function or a Method, default to break at start | ||
Rule(v) = Rule(v, 0) | ||
|
||
############################################################################## | ||
# instrumenting rules | ||
match(rule::Rule{Method}, method) = method == rule.v | ||
match(rule::Rule{Module}, method) = moduleof(method) == rule.v | ||
function match(rule::Rule{F}, method) where F | ||
# This one is for functions | ||
return functiontypeof(method) <: F | ||
end | ||
|
||
#breakon rules | ||
function match(rule::Rule, method, statement_ind) | ||
return match(rule, method) && rule.statement_ind == statement_ind | ||
end | ||
|
||
|
||
## The overall rule object | ||
""" | ||
BreakpointRules | ||
Holds information about breakpoints, | ||
to allow the descision of which methods to instrument with potential breakpoints, | ||
and to decide which potential breakpoints in instrumented code to actually break on. | ||
(When not already in stepping mode) | ||
""" | ||
mutable struct BreakpointRules | ||
no_instrument_rules::Vector{Rule} | ||
breakon_rules::Vector{Rule} | ||
end | ||
BreakpointRules() = BreakpointRules(Rule[], Rule[]) | ||
|
||
|
||
""" | ||
should_instrument(rules, method) | ||
Returns true if according to the rules, this method should be instrumented | ||
with potential breakpoints. | ||
The default is to instrument everything. | ||
""" | ||
function should_instrument(rules::BreakpointRules, method) | ||
# If we are going to break on it, then definately instrument it | ||
for rule in rules.breakon_rules | ||
match(rule, method) && return true | ||
end | ||
# otherwise: | ||
# if we have a rule saying not to instrument it then don't | ||
for rule in rules.no_instrument_rules | ||
match(rule, method) && return false | ||
end | ||
# otherwise: no rules of relevence found, so we instrument it. | ||
return true | ||
end | ||
|
||
# This is a Core.Builtin, it has no methods, do not try and instrument it | ||
should_instrument(::BreakpointRules, ::Nothing) = false | ||
|
||
""" | ||
should_breakon(rules, method, statement_ind) | ||
Returns true if according to the rules, this IR statement index within this method | ||
should be broken on. | ||
I.e. if this point in the code has a breakpoint set. | ||
""" | ||
function should_breakon(rules::BreakpointRules, method, statement_ind) | ||
return any(rules.breakon_rules) do rule | ||
match(rule, method, statement_ind) | ||
end | ||
end |
Oops, something went wrong.