Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
2c0295d
Implement CFG printer for bug repair research team
andersfischernielsen Sep 11, 2020
8bc1b3d
Implement monitor/state-based printing on specific effects
andersfischernielsen Sep 15, 2020
84e338d
Implement printing of variables encountered in a line along with stat…
andersfischernielsen Sep 22, 2020
adb42cf
Add inlining with inline-limit parameter to CFG printing
andersfischernielsen Oct 1, 2020
b2ea720
Fix EBA errors on inlining
andersfischernielsen Oct 1, 2020
f2efda8
Add IDs to reference printouts
andersfischernielsen Nov 25, 2020
9181375
Add _Generic test file
andersfischernielsen Nov 25, 2020
dd79cc4
Change output format to requested format
andersfischernielsen Nov 26, 2020
9189829
Fix mapping issue in effect region printing
andersfischernielsen Nov 30, 2020
da5b26a
Add test file
andersfischernielsen Dec 1, 2020
ba55ee1
Add unsupported test file for debugging purposes
andersfischernielsen Dec 7, 2020
e3ccbc2
Add variable name information to State printout
andersfischernielsen Dec 14, 2020
f8e98b8
Add call(s) leading to state change to printout
andersfischernielsen Dec 17, 2020
c57b078
Add CFGPrinter documentation
andersfischernielsen Dec 17, 2020
17f2e53
Add proper links to source files
andersfischernielsen Dec 17, 2020
d81b6a0
Changes to base version for compilation and correct CFG calculation
Mar 8, 2021
d1e548f
Get rid of colored output so txt files are clean
Mar 8, 2021
906faf4
Lock name first version. This version shows a lot of name collisions
Mar 8, 2021
2f72492
Names for locks added. Usign same discriminant :D as the cfg printer.
Mar 10, 2021
d466e98
Small changes + spin_lock_bh add
Mar 16, 2021
68a6caf
cfgPrinter: Remove an unused alias for LazyList
wasowski Mar 22, 2021
e5cbe10
cfgPrinter: remove unused get_* functions for accessing tuples
wasowski Mar 22, 2021
1836deb
cfgPrinter: resolve the most pressing whitespace issues to silence vim
wasowski Mar 22, 2021
ffe3160
cfgPrinter: Remove the apparently not needed open's
wasowski Mar 22, 2021
ecde5ae
Connect ounit2 test framework to the project and get one silly test t…
wasowski Mar 23, 2021
729808e
Forgot to include the test
wasowski Mar 23, 2021
39c4d08
Minor presentation changes
wasowski Mar 23, 2021
b09abf8
CfgPrinter: Minor presentation improvement (still learning syntax)
wasowski Mar 23, 2021
b69c4ca
cfgPrinterDoubleLock: remove unused open
wasowski Mar 23, 2021
c4d891a
cfgPrinter: Rename find_variable -> vrmap_iterate to capture meaning
wasowski Mar 23, 2021
4e83398
cfgPrinter: rename find_variable again (to vrmap_apply)
wasowski Mar 23, 2021
d4b5248
cfgPrinter: Extract region_id as a function
wasowski Mar 23, 2021
95bc954
cfgPrinter: Start refactoring region_state_string (unfinished but sta…
wasowski Mar 23, 2021
b0e0a5d
cfgPrinter: Refactor vrmap function for partial application and conti…
wasowski Mar 23, 2021
7f3a4ab
type_test: Demonstrate how zonk and =~ (unify) interact, also with un…
wasowski Mar 23, 2021
177f38e
type_test: A 4-part region unification test
wasowski Mar 23, 2021
66bc0f0
cfgPrinter: check (assert) if meta-regions are leaking
wasowski Mar 24, 2021
70751c0
A bit more of clean up
Mar 29, 2021
8988446
type_test: adjust the test for the modified implementation of region_id
wasowski Mar 30, 2021
503fccd
cfgPrinter: Make all the references to PathTree explicit
wasowski Mar 30, 2021
1f6a9f2
cfgPrinter: kill the append function
wasowski Mar 30, 2021
49b496e
cfgPrinterDoubleLock: make references to CfgPrinter explicit
wasowski Mar 30, 2021
53da97b
pP.ml: Add to_stdout as a convenience (I know ... useful for debugging)
wasowski Mar 30, 2021
58d6fdf
Refactor the main function print (ca. 50% shorter now)
wasowski Mar 30, 2021
328d3e2
cfgPrinter: Fix trailing white space issues
wasowski Mar 30, 2021
2b7b086
cfgPrinter: remove filter on -1, but replace with a check (assertion)
wasowski Mar 30, 2021
4bdf617
cfgPrinter: more concise assertions in print
wasowski Mar 30, 2021
4692181
cfgPrinter.print: More concise diagnostic output (for readability)
wasowski Mar 30, 2021
983a7a4
Import assert_bool for more concise error usage
wasowski Mar 30, 2021
505f04c
cfgPrinter: Semi-separate processing the graph from doing the step
wasowski Mar 31, 2021
e21cee3
cfgPrinter: Move lock_funs out of do_step
wasowski Mar 31, 2021
c1a9d93
cfgPrinter: lift is_locking to instructions
wasowski Mar 31, 2021
174b022
cfgPrinter: extract is_call
wasowski Mar 31, 2021
0a13ce9
pathTree: add exists_in_stmt
wasowski Mar 31, 2021
560642f
pathTree: Make exists_in_stmt public
wasowski Mar 31, 2021
8ce7033
cfgPrinter: Make do_step use PathTree.exists_in_stmt
wasowski Mar 31, 2021
49b0ee1
cfgPrinter: make the path the last argument of explore paths for easi…
wasowski Mar 31, 2021
c82dafb
cfgPrinter: A more monadic-style implementation of inline
wasowski Mar 31, 2021
3848a82
cfgPrinter: fail with an assertion if inlining fails
wasowski Mar 31, 2021
d845cf9
cfgPrinter: Organize the code around apply_transition a bit
wasowski Mar 31, 2021
cc4d4b1
cfgPrinter: rename P => Monitor
wasowski Mar 31, 2021
93e5918
cfgPrinter: Comment on apply_transition, but do not change it yet
wasowski Mar 31, 2021
3dffec9
More comments
wasowski Mar 31, 2021
da629c0
cfgPrinterDoubleLock: Change colors to red / black
wasowski Mar 31, 2021
8de56b6
cfgPrinterDoubleLock: Clean-up; also simplify the state space
wasowski Mar 31, 2021
e9adce4
cfgPrinter: Straighten apply_transitions
wasowski Mar 31, 2021
1f2a4c3
cfgPrinter: move getFAname out of do_step
wasowski Apr 1, 2021
ed4143a
cfgPrinter: temporarily comment out bcr code
wasowski Apr 1, 2021
e0d5053
cfgPrinter: make exploration total
wasowski Apr 1, 2021
560d6b4
cfgPrinter: remove do_step, ignore final and interesting monitors, at…
wasowski Apr 1, 2021
1aea8c5
cfgPrinter: Move bcr code to the bottom of the file so it is easier t…
wasowski Apr 1, 2021
a470c93
PP: Add concat delegation to SmartPrint
wasowski Apr 1, 2021
d758c25
CfgPrinterDoubleLock: Make a testable (transparent) version of the mo…
wasowski Apr 1, 2021
d705eab
CfgPrinter: Make color lists per region per line into sets and test t…
wasowski Apr 1, 2021
6596ede
cfgPrinter: A rudimentary YAML formatter
wasowski Apr 2, 2021
98fde2e
cfgPrinter: Try not using quotes in yaml, let's see if this has problems
wasowski Apr 2, 2021
98a0230
cfgPrinter: Expand the state space to a subset construction
wasowski Apr 2, 2021
0b2c9cb
cfgPrinter: Do not print colorings if no collected (to make files sma…
wasowski Apr 2, 2021
ea51d3d
cfgPrinter: Switch the state of printing to records and add visitted …
wasowski Apr 2, 2021
a238e41
Type: Add support for maps with regions as keys
wasowski Apr 3, 2021
97660a8
cfgPrinter: this printer seems to (finally!) only report each line once
wasowski Apr 3, 2021
625450e
cfgPrinter: Incorporate path into the progress type
wasowski Apr 3, 2021
5313147
CfgPrinter: Some clean up
wasowski Apr 3, 2021
16f9bcd
CfgPrinter: Introduce a short name for PathTree.step
wasowski Apr 3, 2021
ab9af12
CfgPrinter: Deactivate the aliasing assertion for the time being
wasowski Apr 3, 2021
38fa1d6
CfgPrinter: Eliminate code repetition in step_into
wasowski Apr 3, 2021
f8d9161
Realized that RegionMap is something created on spot in other modules…
wasowski Apr 8, 2021
79e0d0c
cfgPrinter: add stacktrace printer
wasowski Apr 8, 2021
838ff47
cfgPrinter: It appears the Out of memory crash in StepMap is eliminated
wasowski Apr 8, 2021
0f0ec9b
cfgPrinterDoubleLock: Add green and red, remove 'confused'
wasowski Apr 8, 2021
600702e
cfgPringer: fix the phase shift of coloring
wasowski Apr 9, 2021
226e63a
cfg: Switch coloring to use regions as keys in the output
wasowski Apr 9, 2021
8c52cf4
cfgPrinter: Switch to using official comparisons on effects (instead …
wasowski Apr 9, 2021
0288727
cfgPrinter: Dump regions and effects, rudimentary format
wasowski Apr 9, 2021
ad30690
cfgPrinter: Do not print step_kind
wasowski Apr 9, 2021
27df76e
cfgPrinter: More robust formatting of the source lines
wasowski Apr 9, 2021
235d706
cfgPrinter: Remove controling the visited states
wasowski Apr 10, 2021
3f98161
cfgPrinter: fix passing around states in branches
wasowski Apr 11, 2021
b9eb14f
cfgPrinter: print pure effect names as well
wasowski Apr 14, 2021
56293d4
cfgPrinter: Make all coloring maps total, so that monitors exist from…
wasowski Apr 15, 2021
10dcd83
cfgPrinter: print types
wasowski Apr 15, 2021
cf91b34
cfgPrinter: Remove bcr code
wasowski Apr 15, 2021
7def849
cfgPrinter: Remove some stale functions
wasowski Apr 15, 2021
3e5c666
cfgPrinter: front of the file cleanup
wasowski Apr 15, 2021
c4b7167
cfgPrinter: refactor StepMap
wasowski Apr 15, 2021
b088cec
cfgPrinter: 2More improvements in StepMap
wasowski Apr 15, 2021
cf3c1bf
cfgPrinter: change rvtmap to a 'string region_map' containing type na…
wasowski Apr 15, 2021
711eea0
cfgPrinter: refactor extract_region
wasowski Apr 15, 2021
997e605
cfgPrinter: eliminate region_id
wasowski Apr 15, 2021
b9fc726
cfgPrinter: Eliminate region_id from tests
wasowski Apr 15, 2021
95c6da6
cfgPrinter: Region.t -> region
wasowski Apr 15, 2021
552c5e3
cfgPrinter: switch the type map to work with the actual type values
wasowski Apr 15, 2021
ef76a4c
cfgPrinter: remove rvtmap_apply and rvtmap_get
wasowski Apr 15, 2021
2956403
cfgPrinter: all sorts of small changes
wasowski Apr 15, 2021
9a8f32c
cfgPrinter: further cleanup
wasowski Apr 15, 2021
de330a7
cfgPrinter: A slightly scary simplification (I hope monitors still mo…
wasowski Apr 15, 2021
9f6961e
cfgPrinter: cleanup
wasowski Apr 15, 2021
eae16f3
cfgPrinter: print lock type
wasowski Apr 21, 2021
ad1b685
cfgPrinter: change dashes to underscores in field names
wasowski Apr 21, 2021
583bd22
cfgPrinter: print lock names
wasowski Apr 21, 2021
d3192f7
cfgPrinter: spit out the variable names for regions on which we see e…
wasowski Apr 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/monitor-templates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Monitor templates

Monitor templates are used for keeping track of state changes within the printout of the `eba` CFG.

## Overview

All monitor templates must implement the following signature:

```ocaml
module type PrinterSpec = sig
(** The internal state of the printing monitor **)
type state
(** The transition function for the monitor. State changes happen here based on the previous state and the effects found in the input *)
val transition: state -> e list -> state
(** An indication of whether the printing monitor should be shown in the printout **)
val is_in_interesting_section: state -> bool
(** The initial state of the monitor **)
val initial_state: state
(* An indication of whether the monitor accepts an effect found in a CFG step *)
val is_in_transition_labels: e -> bool
(* An indication of whether the monitor is in its final state *)
val is_in_final_state: state -> bool
(* A string representation of the state of the monitor, displayed in the printout *)
val string_of_state: state -> string
end
```

For an example of a full implementation of this signature, see [checkAutomataDoubleUnlock.ml](../src/checkAutomataDoubleUnlock.ml)

The definition of when and how state changes should happen is implemented in the `transition` function. This can efficiently be implemented as a pattern match on what the previous state was, and what the incoming input is.

# The Printer [CFGPrinter](../src/cfgPrinter.ml)

Monitor template definitions are passed to the [CFGPrinter.ml](../src/cfgPrinter.ml). This printer takes an implementation of a monitor template, and the CFG `step`. This step is passed to the CFGPrinter by the outer `eba` analysis logic.

The CFGPrinter will explore the `eba` CFG and apply any effects found within a `step` in the CFG, provided that these effects are in the `is_in_transition_labels` of the monitor template implementation. The resulting state of applying the transition function of the monitor with the effects found in the `step` is preserved in the CFGPrinter as a mapping from the region a monitor template operates on to the current state of that monitor.

Whenever effects involving a previously untracked region are encountered, a new instance of the monitor template is instantiated in its initial state, and the transition function is then applied with these effects.

After the application of the transition function of the monitor template and the new state has been found, the CFGPrinter will filter the monitor template results to remove monitors in their final states.

Finally, if a monitor reports that `it is_in_interesting_section`, the state of the monitor will be added to the printout.

# Adding a new printing monitor template implementation to `eba`

Creating a new printing monitor template implementation _should_ be the only thing required in order to add more information to the CFG printout, but modifications or additions might be needed in [CFGPrinter.ml](../src/cfgPrinter.ml). This depends on the use case and complexity of the printout.
10 changes: 10 additions & 0 deletions src/abs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ module rec AFile : sig

val fprint : unit IO.output -> t -> unit

val global_variables_and_regions : t -> (Cil.varinfo, Regions.t) BatMap.t

end = struct

module VarMap = Hashtbl.Make(Utils.Varinfo)
Expand Down Expand Up @@ -172,6 +174,14 @@ end = struct

let eprint = fprint stderr

let global_variables_and_regions t =
VarMap.fold (fun varinfo entry acc ->
match entry with
| Var(sch, _) ->
Map.add varinfo Regions.(Scheme.regions_in sch) acc
| Fun _ -> acc
) t Map.empty

end

and AFun : sig
Expand Down
Loading