Time-Travel Debugging with AI

Record execution with Mozilla’s rr, replay backwards with AI-powered GDB commands.

Usage

# Record
memguard record /tmp/binary
memguard record /tmp/server --args "--port 8080"

# Launch at bug locations
memguard timewarp <scan-id> --launch
memguard timewarp <scan-id> --issue 4

# Inside the debugger
(rr) continue           # run to first bug
(rr) mg-ai              # AI analyzes current state
(rr) mg-why             # AI explains root cause
(rr) mg-suggest          # AI suggests next command
(rr) mg-fix              # AI generates code fix
(rr) reverse-continue   # travel backwards
(rr) reverse-step        # step backwards one line

# List recordings
memguard recordings

AI Commands

Command

Description

mg-ai

Captures frame, source (±20 lines), backtrace, locals, args, known bugs → LLM analysis

mg-why

Same context, prompts for ROOT CAUSE with specific line numbers

mg-suggest

Suggests the single best next GDB command with explanation

mg-fix

Generates exact BEFORE/AFTER code change

Falls back to GDB process record (with AVX2 disabled) when rr doesn’t support the CPU.