cmd/objdump: use cmd/internal/objfile

This removes a bunch of ugly duplicate code.
The end goal is to factor the disassembly code
into cmd/internal/objfile too, so that pprof can use it,
but one step at a time.

LGTM=r, iant
R=r, alex.brainman, iant
CC=golang-codereviews
https://golang.org/cl/149400043
This commit is contained in:
Russ Cox 2014-10-29 18:07:24 -04:00
parent 97b24a05df
commit 3eadbb02af
12 changed files with 154 additions and 568 deletions

View file

@ -14,6 +14,8 @@ import (
type rawFile interface {
symbols() (syms []Sym, err error)
pcln() (textStart uint64, symtab, pclntab []byte, err error)
text() (textStart uint64, text []byte, err error)
goarch() string
}
// A File is an opened executable file.
@ -70,3 +72,11 @@ func (f *File) PCLineTable() (*gosym.Table, error) {
}
return gosym.NewTable(symtab, gosym.NewLineTable(pclntab, textStart))
}
func (f *File) Text() (uint64, []byte, error) {
return f.raw.text()
}
func (f *File) GOARCH() string {
return f.raw.goarch()
}