Added number of used functions to the statistics
This commit is contained in:
parent
371059d08a
commit
4dd40f6fec
@ -22,6 +22,7 @@ import (
|
||||
type Result struct {
|
||||
Main *core.Function
|
||||
Functions map[string]*core.Function
|
||||
Traversed map[*core.Function]bool
|
||||
InstructionCount int
|
||||
DataCount int
|
||||
Code []byte
|
||||
@ -60,9 +61,11 @@ func (r *Result) finalize() {
|
||||
{Name: "kernel32", Functions: []string{"ExitProcess"}},
|
||||
}
|
||||
|
||||
r.Traversed = make(map[*core.Function]bool, len(r.Functions))
|
||||
|
||||
// This will place the main function immediately after the entry point
|
||||
// and also add everything the main function calls recursively.
|
||||
r.eachFunction(r.Main, map[*core.Function]bool{}, func(f *core.Function) {
|
||||
r.eachFunction(r.Main, r.Traversed, func(f *core.Function) {
|
||||
final.Merge(f.Assembler)
|
||||
|
||||
for _, library := range f.DLLs {
|
||||
@ -127,8 +130,22 @@ func (r *Result) PrintInstructions() {
|
||||
// PrintStatistics shows the statistics.
|
||||
func (r *Result) PrintStatistics() {
|
||||
ansi.Dim.Println("╭──────────────────────────────────────────────────────────────────────────────╮")
|
||||
ansi.Dim.Printf("│ %-44s%-32s │\n", "Code:", fmt.Sprintf("%d bytes", len(r.Code)))
|
||||
ansi.Dim.Printf("│ %-44s%-32s │\n", "Data:", fmt.Sprintf("%d bytes", len(r.Data)))
|
||||
|
||||
ansi.Dim.Print("│ ")
|
||||
ansi.Dim.Printf("%-44s", "Code:")
|
||||
fmt.Printf("%-32s", fmt.Sprintf("%d bytes", len(r.Code)))
|
||||
ansi.Dim.Print(" │\n")
|
||||
|
||||
ansi.Dim.Print("│ ")
|
||||
ansi.Dim.Printf("%-44s", "Data:")
|
||||
fmt.Printf("%-32s", fmt.Sprintf("%d bytes", len(r.Data)))
|
||||
ansi.Dim.Print(" │\n")
|
||||
|
||||
ansi.Dim.Print("│ ")
|
||||
ansi.Dim.Printf("%-44s", "Functions:")
|
||||
fmt.Printf("%-32s", fmt.Sprintf("%d / %d", len(r.Traversed), len(r.Functions)))
|
||||
ansi.Dim.Print(" │\n")
|
||||
|
||||
ansi.Dim.Println("╰──────────────────────────────────────────────────────────────────────────────╯")
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,9 @@ func (f *Function) PrintInstructions() {
|
||||
|
||||
for _, reg := range f.CPU.All {
|
||||
if used&(1<<reg) != 0 {
|
||||
registers.WriteString("⏺ ")
|
||||
registers.WriteString("● ")
|
||||
} else {
|
||||
registers.WriteString(" ")
|
||||
registers.WriteString("· ")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user