Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The Language

Whamm enables tool implementers to express their instrumentation in terms of program events and corresponding predicated actions; "When this event occurs during program execution, do these actions if this predicate (or conditional) evaluates to true." This abstraction provides a high-level and intuitive syntax that can target events at various granularities in the target program.

Read on for an overview of the syntax and semantics of the language.

Language Concepts

  • Variables are used to store data.
  • Logical operations can be used to combine boolean expressions.
  • Ternary Expressions can be used for succinct conditional variable assignments.
  • Primitive types are numbers, booleans, and strings.
  • Various arithmetic operations can be used with numbers.
  • Strings are key for dealing with text, etc.
  • Tuples allow using multiple values where one value is expected.
  • Maps are key for storing large amounts of data, but they're implemented quite differently in Whamm.
  • Function definitions can be used to reuse code snippets.
  • Conditionals are if/else/elif statements used for simple control flow.
  • Type Bounds are for dealing with polymorphic opcodes.
  • Whamm also provides helpful features to enable instrumentation expressiveness.
    • Report variables are key for flushing the dynamic data collected by instrumentation during an application's run.
    • Unshared variables are used to create an instance of a variable per probe match-site whose value is retained across site visits.
    • Shared variables are used to create an instance of a variable that is shared by every probe match-site.
    • Frame variables are used to create an instance of a variable that is stored on a function's active frame.
  • And finally, probes are used to express instrumentation.
  • All of this syntax is used to write Whamm scripts.