Drop ELF, Wasm, Mach-O, or PE binary here
Accepts Linux ELF, WebAssembly (.wasm), macOS Mach-O, Windows PE (.exe/.dll), or DwarfLens JSON reports
Preloaded Demos
Analyzing binary layout and DWARF debug info...
Sections Breakdown
| Section Name | Category | Size | VM Address | % of File |
|---|
| Symbol Name (Demangled) | Section | Type | Compile Unit | Size |
|---|
| Struct Name | Total Size | Useful Bytes | Padding Wasted | Cache Lines | Issues | Action |
|---|
64-Byte Cache-Line Memory Grid 1 cell = 1 byte (8 bytes per row)
| Row | +0 | +1 | +2 | +3 | +4 | +5 | +6 | +7 |
|---|
Field Offset Map
| Offset | Size | Field | Type |
|---|
Sorting fields by descending alignment minimizes padding holes and struct footprint. Warning: Field reordering breaks binary ABI compatibility and ignores hot/cold runtime access patterns.
// No optimization needed
Binary Comparison (Diff)
Comparing base vs target
Section Deltas
| Section | Base Size | Target Size | Delta (Bytes) | Delta (%) | Change |
|---|
Symbol Deltas
| Symbol Name | Section | Base Size | Target Size | Delta | Change |
|---|
Struct Memory Layout Regressions
| Struct Name | Size Delta | Padding Delta | Cache Line Delta | Status |
|---|
About DwarfLens
DwarfLens is a high-performance C++23 and WebAssembly tool designed for low-level systems engineers, game programmers, and embedded developers. It parses Linux ELF64, WebAssembly (.wasm), macOS Mach-O, and Windows PE/COFF containers alongside DWARF v4/v5 debugging information (`.debug_info`, `.debug_abbrev`, `.debug_str`) to reveal exact memory footprints, padding waste, and CPU cache line alignment issues.
Why Struct Layout Matters
- Padding Holes: Compilers insert invisible padding between struct members to align them to natural memory boundaries (e.g., 4 bytes for
uint32_t, 8 bytes for pointers/double). Suboptimal ordering wastes precious RAM and ROM. - Cache Line Crossings: Modern CPUs fetch memory in 64-byte L1 cache lines. When a hot struct member crosses a 64-byte boundary, reading it requires two memory transactions, halving throughput and increasing latency.
- False Sharing: In multi-threaded systems, different CPU cores writing to independent variables located in the same 64-byte cache line cause severe cache ping-pong invalidations.
CLI Usage
# Analyze an ELF, Wasm, Mach-O, or PE binary:
$ dwarflens analyze firmware.elf
# Export full JSON report (drop it into this web app):
$ dwarflens analyze ./my_app --format=json > report.json
# Diff two binaries in CI/CD pipeline:
$ dwarflens diff base.elf target.elf --format=table
# Enforce zero padding regression and budget in CI:
$ dwarflens diff base.elf target.elf --max-growth-bytes=10240 --fail-on-padding-regression