mirror of
https://github.com/thunderbrewhq/binana.git
synced 2026-05-03 05:03:50 +00:00
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:
parent
d020e6ba36
commit
cbb42eb953
6 changed files with 145 additions and 4 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue