Skip to main content

Module happens_before

Module happens_before 

Source
Expand description

Debug-info resolution for happens-before anchors.

The anchor/edge model lives in detcore_model::happens_before; it leaves func/file:line code locations unresolved (a Position::Rip with addr: None). This module turns those human-legible locations into concrete instruction pointers by reading the target binary’s symbol table (for function entry addresses) and DWARF line program (for source lines), and provides the reverse mapping (address → function/file/line) used by introspection / --list-events.

It builds owned indices in a single pass and drops the mmap/DWARF context, so the resolver has no self-referential lifetimes and is cheap to keep around.

Structs§

DebugInfoResolver
Owned debug-info indices for one binary.
HbLaunch
How a run will execute the guest, as far as happens-before enforcement is concerned (refuse_unenforceable_anchors).
ResolvedLocation
A resolved source location for introspection output.

Functions§

describe_anchor
Render one anchor for --list-events-style introspection, showing the resolved address and source description when available.
load_program
Load a happens-before specification from a JSON file and normalize it into a HappensBeforeProgram. Code locations remain unresolved until resolve_program runs against a DebugInfoResolver.
refuse_hold_without_preemption
Refuse a version-2 program on a run without a preemption timer, saying why (reason). A version-2 spec bounds every hold by max_hold_ns, charged in committed virtual time; without the timer a thread that spins without syscalls never ends its turn, committed time stops, and a hold could never be charged, so the run would hang instead of ending in HERMIT_HB_HOLD_BUDGET_EXCEEDED. Called before launch twice: for an explicit --max-timeslice disabled, and after argument validation, when the timer can also be lost because the host cannot arm it. A version-1 program has no budget and is never refused here.
refuse_unenforceable_anchors
Refuse, before anything is launched or any input is read, a program the run cannot enforce as written:
resolve_program
Resolve every anchor in program whose position is an unresolved RIP carrying a code location. Returns the names of anchors that could not be resolved.