nmindex query symbol

This commit is contained in:
xushiwei
2024-04-20 11:58:26 +08:00
parent 0b1f36b6fe
commit 6a359a4d4d
3 changed files with 157 additions and 9 deletions

View File

@@ -81,11 +81,16 @@ func (p *IndexBuilder) IndexFile(arFile, outFile string) (err error) {
return
}
var b bytes.Buffer
b.WriteString("file ")
b.WriteString("nm ")
b.WriteString(arFile)
b.WriteByte('\n')
nbase := b.Len()
for _, item := range items {
if item.File != "" {
b.WriteString("file ")
b.WriteString(item.File)
b.WriteByte('\n')
}
for _, sym := range item.Symbols {
switch sym.Type {
case Text, Data, BSS, Rodata, 'S', 'C', 'W', 'A':