Skip to content

feat(inspect): add ELF symbol inspection and comparison - #132

Merged
adi0x90 merged 2 commits into
masterfrom
feat/inspect-symbols
Nov 29, 2026
Merged

adi0x90 merged 2 commits into
masterfrom
feat/inspect-symbols

Conversation

@adi0x90

@adi0x90 adi0x90 commented Nov 29, 2026

Copy link
Copy Markdown
Member

Closes #131

Summary

  • New fat inspect symbols subcommand: symbol sizing, filtering, section/region enrichment, bounded previews, demangling, and two-file diffs.
  • One shared st_shndx-based ELF section reader for discovery and enrichment; corrects region and preview handling for relocatables, section-end symbols, ARM Thumb, and extended indices.
  • Selection, input parsing, rendering, and diffing stay in dedicated modules over one serializable model.

Behavior

  • --name, --names-file, --filter, --regex, --exclude, --min-size, --max-size, --type, --writable, --in-ram, and --in-flash compose with AND.
  • --preview is capped at 64 bytes; --demangle feeds only mangled names to c++filt with concurrent stdout draining and keeps raw names for matching.
  • --diff requires exactly two files, rejects incompatible selection/format flags, and emits elf-symbol-diff/v1 JSON.
  • Non-ELF, malformed ELF, out-of-range string offsets, and extra --file arguments fail explicitly.

Verification

  • cargo fmt --all --check
  • cargo test -p firmware-analysis-toolkit --bin fat symbol (48 passed)
  • cargo clippy -p firmware-analysis-toolkit --all-targets -- -D warnings
  • cargo build -p firmware-analysis-toolkit --bin fat
  • Manual ELF fixtures: relocatable objects, e_shstrndx=0, unnamed symtab, SHN_XINDEX with 65,281 sections, 5,000-symbol demangle, exact-name matching, and error paths.

Docs

  • CHANGELOG.md Unreleased entry and AGENTS.md CLI-surface guidance.

- Add `fat inspect symbols` with name, regex, size, type and region filters, bounded previews, demangling, multiple output formats, and two-file diffs.
- Share one `st_shndx`-based ELF section reader across symbol discovery and enrichment, including extended indices and string-table bounds.
- Keep demangling deadlock-free and preserve raw names for selection; validate CLI inputs and cap previews.
- Document the CLI surface in AGENTS.md and CHANGELOG.md.

Fixes #131
- Add the Unreleased entry for `fat inspect symbols`.

Fixes #131
@adi0x90
adi0x90 merged commit d40f4fb into master Nov 29, 2026
19 checks passed
@adi0x90
adi0x90 deleted the feat/inspect-symbols branch November 29, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add ELF symbol inspection to fat inspect

1 participant