normalize_verifier_line

Function normalize_verifier_line 

Source
pub fn normalize_verifier_line(line: &str) -> &str
Expand description

Normalize a BPF verifier log line by stripping variable register-state annotations so that lines from different loop iterations compare equal.

Handles:

  • Instruction with ; frame annotation: 3006: (07) r9 += 1 ; frame1: R9_w=2
  • Instruction with ; R + digit annotation: 9: (15) if r7 == 0x0 goto pc+1 ; R7=scalar(...)
  • Branch with inline target state: 3026: (b5) if r6 <= 0x11dc0 goto pc+2 3029: frame1: R0=1
  • Standalone register dump with frame: 3041: frame1: R0_w=scalar()
  • Standalone register dump without frame: 3029: R0=1 R6=scalar()

Preserves source comments (; for (int j = 0; ...)) and non-annotation semicolons (; Return value) – these serve as cycle anchors.