app

package
v0.0.0-...-93df57a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   = "dev"
	GitCommit = "none"
	BuildDate = "unknown"
)
View Source
var ErrThreshold = errors.New("threshold exceeded")

Functions

func DiffSymbols

func DiffSymbols(a, b []SymbolInfo, topN int) (grown []SymDelta, shrunk []SymDelta)

DiffSymbols returns the biggest symbol size increases and decreases between A and B, limited to topN results per group.

func Execute

func Execute() error

Execute runs the root command of the CLI application and handles any errors by printing them to stderr.

func ExitCode

func ExitCode(err error) int

ExitCode returns the exit code for the given error.

func NewDoctorCmd

func NewDoctorCmd() *cobra.Command

NewDoctorCmd returns the doctor command for checking the local firmdiff setup and dependencies.

func NewExplainCmd

func NewExplainCmd() *cobra.Command

NewExplainCmd returns the explain command for comparing two ELF files.

func NewRootCmd

func NewRootCmd() *cobra.Command

NewRootCmd returns the root command for the CLI application.

func NewRunCmd

func NewRunCmd() *cobra.Command

NewRunCmd returns the run command for building and comparing two variants.

func NewVersionCmd

func NewVersionCmd() *cobra.Command

NewVersionCmd returns the version command for printing firmdiff version info.

Types

type AnalyzeResult

type AnalyzeResult struct {
	Size    SizeInfo
	TopSyms []SymbolInfo // largest symbols (best-effort)
}

AnalyzeResult represents the result of analyzing an ELF file.

func AnalyzeELF

func AnalyzeELF(path string, topN int) (AnalyzeResult, error)

AnalyzeELF analyzes an ELF file at the given path and returns its size and top symbols.

type BinaryFormat

type BinaryFormat string

BinaryFormat represents the format of a binary file.

const (
	FormatELF     BinaryFormat = "ELF"
	FormatMachO   BinaryFormat = "Mach-O"
	FormatPE      BinaryFormat = "PE"
	FormatUnknown BinaryFormat = "Unknown"
)

type Level

type Level int

Level represents the severity or importance of a log message.

const (
	Info Level = iota
	Warn
	Fail
)

type SizeInfo

type SizeInfo struct {
	Flash int64 // approx: allocated + !write sections (SHT_NOBITS excluded)
	Ram   int64 // approx: allocated + writable + NOBITS (bss)
	Text  int64 // optional breakdown
	Data  int64
	Bss   int64
}

SizeInfo represents the size of an ELF file.

func (SizeInfo) String

func (s SizeInfo) String() string

type SymDelta

type SymDelta struct {
	Name  string
	A     int64
	B     int64
	Delta int64 // B - A
}

SymDelta represents the difference in size between two symbols.

type SymbolInfo

type SymbolInfo struct {
	Name string
	Size int64
}

SymbolInfo represents information about a symbol, including its name and size.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL