mirror of
https://github.com/thunderbrewhq/binana.git
synced 2025-12-12 09:52:28 +00:00
feat(go): add format-symbols command
This commit is contained in:
parent
b8b0b5076f
commit
0eec0219f9
7 changed files with 269 additions and 142 deletions
|
|
@ -1,7 +1,9 @@
|
|||
package symfile
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// What kind of Entry is this?
|
||||
|
|
@ -36,6 +38,21 @@ type Entry struct {
|
|||
DataType string
|
||||
}
|
||||
|
||||
func (entry *Entry) String() string {
|
||||
var b strings.Builder
|
||||
fmt.Fprintf(&b, "%s %08X %c", entry.Name, entry.StartAddress, entry.Kind)
|
||||
if entry.EndAddress != 0 {
|
||||
fmt.Fprintf(&b, " end=%08X", entry.EndAddress)
|
||||
}
|
||||
if entry.DataType != "" {
|
||||
fmt.Fprintf(&b, " type=\"%s\"", entry.DataType)
|
||||
}
|
||||
if entry.Comment != "" {
|
||||
fmt.Fprintf(&b, " ; %s", entry.Comment)
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
type Table interface {
|
||||
Insert(entry *Entry) (err error)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue