This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: ebpf-frame-pointer-unwind-overhead-guardrail

eBPF Continuous Profiling DWARF-less Frame Pointer Unwind Standard

Enforces frame-pointer preservation across all compiled production binaries and runtime flags to enable zero-overhead kernel-level eBPF stack unwinding. Replaces heavy user-space DWARF/`.eh_frame` stack-walking algorithms with native BPF helper unwinding (`bpf_get_stackid`), guaranteeing continuous profiling CPU overhead remains strictly under 1%.

Prohibited Anti-Pattern: Omitted Frame Pointers Forcing Out-of-Band DWARF Stack Walks and High CPU Overhead

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: eBPF Continuous Profiling DWARF-less Frame Pointer Unwind Standard - Enforces frame-pointer preservation across all compiled production binaries and runtime flags to enable zero-overhead kernel-level eBPF stack unwinding. Replaces heavy user-space DWARF/`.eh_frame` stack-walking algorithms with native BPF helper unwinding (`bpf_get_stackid`), guaranteeing continuous profiling CPU overhead remains strictly under 1%.
globs: **/Dockerfile*, **/Makefile, **/CMakeLists.txt, **/*.bpf.c, **/*.bpf.h, deploy/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/ebpf-frame-pointer-unwind-overhead-guardrail"
---

# eBPF Continuous Profiling DWARF-less Frame Pointer Unwind Standard

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Omitted Frame Pointers Forcing Out-of-Band DWARF Stack Walks and High CPU Overhead

## System Constraints
You are a Principal Systems & SRE Architect enforcing zero-overhead continuous profiling via eBPF. Enforce strict preservation of frame pointers across all production compile chains and container runtime configurations. Mandate kernel-level unwinding via `bpf_get_stackid` with `BPF_F_USER_STACK` or compact frame traversals, strictly rejecting reliance on costly user-space DWARF unwinders (`libunwind`, high-frequency `bpf_probe_read_user` stack sweeps) that violate the <1% CPU ceiling.

## Strict Guidelines
- Engineers MUST ALWAYS compile native production binaries (C/C++, Rust, Go) with preserved frame pointers (e.g., `-fno-omit-frame-pointer`, `-mno-omit-leaf-frame-pointer` or equivalent compiler flags).
- Engineers MUST NOT rely on runtime user-space DWARF parsing (`.eh_frame`, `.debug_frame`) for continuous real-time fleet profiling due to excessive CPU cycle and memory paging overhead.
- Code SHOULD configure managed runtimes to retain frame pointers in compiled JIT segments (e.g., `-XX:+PreserveFramePointer` for JVM, Node.js `--perf-prof-unwinding-info`).
- Services MUST configure eBPF profiler kernel programs using `bpf_get_stackid(ctx, &stackmap, BPF_F_USER_STACK)` or optimized frame-pointer iterations with bound checks.
- Components NEVER drop eBPF ring buffers or stack maps due to blocking page-fault recovery loops caused by deep user-space stack unwinds.

## Bad vs Good Implementations
### C/eBPF & Build Config - Preserving Frame Pointers vs DWARF Scraping

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Omitting frame pointers strips the RBP chain. Profilers must dump raw memory and perform user-space DWARF unwind tables lookups, inducing page faults, cache churn, and spiking CPU usage far beyond the 1% target.
```makefile
# Anti-Pattern: Frame pointers omitted for minor register saving;
# Forces continuous profiler to copy full 64KB user stack pages to userland for DWARF traversal.
CFLAGS := -O3 -fomit-frame-pointer -g

# eBPF profiler fallback using expensive raw stack copying (Causes >5% CPU overhead):
# SEC("perf_event")
# int record_stack(struct bpf_perf_event_data *ctx) {
#     bpf_probe_read_user(raw_stack_buf, sizeof(raw_stack_buf), (void *)ctx->regs.sp);
#     bpf_ringbuf_output(&events, raw_stack_buf, sizeof(raw_stack_buf), 0);
#     return 0;
# }
```

#### Production Standard (Correct)
> **Standard**: Retaining frame pointers allows `bpf_get_stackid` to traverse the RBP link list directly in kernel context in under a microsecond, keeping continuous profiling overhead consistently below 1%.
```makefile
# Production Standard: Retain frame pointers for O(1) kernel-space stack unwinding
CFLAGS := -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -gline-tables-only

# eBPF profiler leverages kernel fast-path unwinding (<0.5% CPU overhead):
# SEC("perf_event")
# int record_stack(struct bpf_perf_event_data *ctx) {
#     int stack_id = bpf_get_stackid(ctx, &stack_traces, BPF_F_USER_STACK);
#     if (stack_id >= 0) {
#         bpf_map_update_elem(&counts, &stack_id, &one, BPF_ANY);
#     }
#     return 0;
# }
```

### Container Build Configuration - Polyglot Frame Pointer Preservation

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: HotSpot JIT generates assembly without frame pointers by default, leading to broken and truncated flame graphs unless costly symbols/DWARF unwind hooks are engaged.
```dockerfile
# Anti-Pattern: Omits runtime frame-pointer flags, breaking eBPF user stack walking
FROM openjdk:17-slim
ENV JAVA_OPTS="-Xms4g -Xmx4g"
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]
```

#### Production Standard (Correct)
> **Standard**: `-XX:+PreserveFramePointer` instructs the JVM JIT compiler to keep RBP intact in compiled bytecode methods, allowing eBPF to trace combined OS and Java stacks seamlessly at negligible overhead.
```dockerfile
# Production Standard: Explicitly preserve frame pointers for JIT compilation
FROM openjdk:17-slim
ENV JAVA_OPTS="-Xms4g -Xmx4g -XX:+PreserveFramePointer -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints"
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: eBPF Continuous Profiling DWARF-less Frame Pointer Unwind Standard

eBPF Continuous Profiling DWARF-less Frame Pointer Unwind Standard defines an industrial-grade behavioral standard for devops engineering. Enforces frame-pointer preservation across all compiled production binaries and runtime flags to enable zero-overhead kernel-level eBPF stack unwinding. Replaces heavy user-space DWARF/`.eh_frame` stack-walking algorithms with native BPF helper unwinding (`bpf_get_stackid`), guaranteeing continuous profiling CPU overhead remains strictly under 1%. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Omitted Frame Pointers Forcing Out-of-Band DWARF Stack Walks and High CPU Overhead Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftOmitted Frame Pointers Forcing Out-of-Band DWARF Stack Walks and High CPU OverheadCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS compile native production binaries (C/C++, Rust, Go) with preserved frame pointers (e.g., `-fno-omit-frame-pointer`, `-mno-omit-leaf-frame-pointer` or equivalent compiler flags).

Engineers MUST ALWAYS compile native production binaries (C/C++, Rust, Go) with preserved frame pointers (e.g., `-fno-omit-frame-pointer`, `-mno-omit-leaf-frame-pointer` or equivalent compiler flags).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT rely on runtime user-space DWARF parsing (`.eh_frame`, `.debug_frame`) for continuous real-time fleet profiling due to excessive CPU cycle and memory paging overhead.

Engineers MUST NOT rely on runtime user-space DWARF parsing (`.eh_frame`, `.debug_frame`) for continuous real-time fleet profiling due to excessive CPU cycle and memory paging overhead.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Code SHOULD configure managed runtimes to retain frame pointers in compiled JIT segments (e.g., `-XX

Code SHOULD configure managed runtimes to retain frame pointers in compiled JIT segments (e.g., `-XX:+PreserveFramePointer` for JVM, Node.js `--perf-prof-unwinding-info`).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Services MUST configure eBPF profiler kernel programs using `bpf_get_stackid(ctx, &stackmap, BPF_F_USER_STACK)` or optimized frame-pointer iterations with bound checks.

Services MUST configure eBPF profiler kernel programs using `bpf_get_stackid(ctx, &stackmap, BPF_F_USER_STACK)` or optimized frame-pointer iterations with bound checks.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Components NEVER drop eBPF ring buffers or stack maps due to blocking page-fault recovery loops caused by deep user-space stack unwinds.

Components NEVER drop eBPF ring buffers or stack maps due to blocking page-fault recovery loops caused by deep user-space stack unwinds.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is eBPF Continuous Profiling DWARF-less Frame Pointer Unwind Standard critical for AI coding assistants?

Enforces frame-pointer preservation across all compiled production binaries and runtime flags to enable zero-overhead kernel-level eBPF stack unwinding. Replaces heavy user-space DWARF/`.eh_frame` stack-walking algorithms with native BPF helper unwinding (`bpf_get_stackid`), guaranteeing continuous profiling CPU overhead remains strictly under 1%. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Omitted Frame Pointers Forcing Out-of-Band DWARF Stack Walks and High CPU Overhead) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

eBPF