Skip to content

Commit

Permalink
Merge pull request #15 from ejrgilbert/task/reorganize_code
Browse files Browse the repository at this point in the history
Change to using a behavior tree for specifying the instrumentation behavior
  • Loading branch information
ejrgilbert authored May 14, 2024
2 parents 2fc8c13 + 77987f4 commit 05720c6
Show file tree
Hide file tree
Showing 27 changed files with 3,885 additions and 1,157 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ Cargo.lock
# Ignore the huge test files
tests/apps/*.wat
output/

# Ignore mac files
.DS_Store
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ log = "0.4.20"
pest = "2.7.7"
pest_derive = "2.7.7"

# Visualization
graphviz-rust = "0.9.0"
project-root = "0.2.2"
opener = { version = "0.7.0", default-features = false }

[dependencies.clap]
optional = true
version = "3.2.23"
Expand Down
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

`whamm!` is a tool for "Wasm Application Monitoring and Manipulation"[^1], a DSL inspired by the D language.

[^1]: The 'h' is silent.
[^1] The 'h' is silent.

## Tutorials ##

Expand All @@ -27,10 +27,36 @@ cargo test -- --nocapture # With stdout tracing

To run project (there are example Whammys in `tests/whammys` folder):
```shell
cargo run -- --app <path_to_app_wasm> --whammy <path_to_whammy> <path_for_compiled_output>
cargo run -- instr --app <path_to_app_wasm> --whammy <path_to_whammy> <path_for_compiled_output>
```

To specify log level:
```shell
RUST_LOG={ error | warn | info | debug | trace | off } cargo run -- --app <path_to_app_wasm> --whammy <path_to_whammy> <path_for_compiled_output>
```

To visually debug the decision tree used during Wasm bytecode emission:
```shell
cargo run -- vis-tree --whammy <path_to_whammy>
```

## Available Packages ##

Currently available:
- `wasm:bytecode`

To be added:
- `thread` operation events
- `gc` operation events
- `function` enter/exit/unwind events
- `memory` access (read/write) events
- `table` access (read/write) events
- `component` operation events
- `BEGIN`/`END` events
- `traps`
- `exception` throw/rethrow/catch events

Example:
`wasi:http:send_req:alt`
`wasm:bytecode:call:alt`
`wasm:fn:enter:before`
6 changes: 6 additions & 0 deletions src/behavior.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pub mod tree;
pub mod builder_visitor;
pub mod visualize;

#[cfg(test)]
pub mod tests;
Loading

0 comments on commit 05720c6

Please sign in to comment.