feat(bna): implement fix-labels command

The fix-labels command will fix a symbol file by automatically renaming
labels matching a certain regex, and looking for the captured parameter
in a "fixlist" i.e. a newline delimited list of OG names.
This commit is contained in:
phaneron 2026-04-29 03:13:52 -04:00
parent d020e6ba36
commit cbb42eb953
6 changed files with 145 additions and 4 deletions

View file

@ -11,6 +11,7 @@ import (
type linter struct {
warnings uint64
named_functions_count uint64
typed_function_count uint64
}
func (linter *linter) warn(s *symbols.TableEntry, f string, args ...any) {
@ -54,6 +55,10 @@ func Lint(params *LintParams) {
linter.warn(entry, "does not have an end address\n")
}
}
if entry.Symbol.DataType != "" {
linter.typed_function_count++
}
}
}
@ -62,4 +67,9 @@ func Lint(params *LintParams) {
fmt.Printf("%d out of %d functions named (%f%%)\n", linter.named_functions_count, Profile.Info.FunctionCount, ratio*100.0)
fmt.Printf("%d warnings generated\n", linter.warnings)
}
if linter.named_functions_count != 0 {
typed_ratio := float64(linter.typed_function_count) / float64(linter.named_functions_count)
fmt.Printf("%d out of %d (%f%%) named functions have type information", linter.typed_function_count, linter.named_functions_count, typed_ratio*100.0)
}
}