nmdump: support .dylib/.so
This commit is contained in:
@@ -33,7 +33,9 @@ func main() {
|
||||
items, err := nm.List(os.Args[1])
|
||||
check(err)
|
||||
for _, item := range items {
|
||||
fmt.Printf("\n%s:\n", item.File)
|
||||
if item.File != "" {
|
||||
fmt.Printf("\n%s:\n", item.File)
|
||||
}
|
||||
for _, sym := range item.Symbols {
|
||||
if sym.FAddr {
|
||||
fmt.Printf("%016x %c %s\n", sym.Addr, sym.Type, sym.Name)
|
||||
|
||||
10
x/nm/nm.go
10
x/nm/nm.go
@@ -87,10 +87,14 @@ func (p *Cmd) List(arfile string) (items []*ObjectFile, err error) {
|
||||
}
|
||||
|
||||
func listOutput(data []byte) (items []*ObjectFile, err error) {
|
||||
var item *ObjectFile
|
||||
var sep = []byte{'\n'}
|
||||
for _, line := range bytes.Split(data, sep) {
|
||||
sep := []byte{'\n'}
|
||||
item := &ObjectFile{}
|
||||
lines := bytes.Split(data, sep)
|
||||
for _, line := range lines {
|
||||
if len(line) == 0 {
|
||||
if item.File == "" && len(item.Symbols) > 0 {
|
||||
items = append(items, item)
|
||||
}
|
||||
item = nil
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user