diff options
Diffstat (limited to 'src/debug/pe/file.go')
| -rw-r--r-- | src/debug/pe/file.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/debug/pe/file.go b/src/debug/pe/file.go index bfc4cf8a18..f7b74e92a4 100644 --- a/src/debug/pe/file.go +++ b/src/debug/pe/file.go @@ -21,6 +21,7 @@ type File struct { OptionalHeader interface{} // of type *OptionalHeader32 or *OptionalHeader64 Sections []*Section Symbols []*Symbol + StringTable StringTable closer io.Closer } @@ -133,6 +134,14 @@ func NewFile(r io.ReaderAt) (*File, error) { return nil, errors.New("Invalid PE File Format.") } + var err error + + // Read string table. + f.StringTable, err = readStringTable(&f.FileHeader, sr) + if err != nil { + return nil, err + } + var ss []byte if f.FileHeader.NumberOfSymbols > 0 { // Get COFF string table, which is located at the end of the COFF symbol table. @@ -237,13 +246,6 @@ func NewFile(r io.ReaderAt) (*File, error) { return f, nil } -func cstring(b []byte) string { - var i int - for i = 0; i < len(b) && b[i] != 0; i++ { - } - return string(b[0:i]) -} - // getString extracts a string from symbol string table. func getString(section []byte, start int) (string, bool) { if start < 0 || start >= len(section) { |
