-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
On GO binaries with stripped .symtab sections the objfile tool fails to located the pclntab and fails to print embedded symbols. The table can still be found however by byte scanning the .text section of the binary for the header magic for the table:
Lines 169 to 170 in 89f687d
| const go12magic = 0xfffffffb | |
| const go116magic = 0xfffffffa |
The gosym NewTable method does not require the .symtab section to correctly parse the pclntab table and is still useful for this case of stripped binaries. It may simply be passed an empty byte array as it's first argument:
go/src/cmd/internal/objfile/objfile.go
Line 152 in 2d0258d
| return gosym.NewTable(symtab, gosym.NewLineTable(pclntab, textStart)) |
I propose that a simple byte scan be added in objfile.go if the .pcln() method fails to locate the table by the standard symbols lookup. By falling back to byte scanning the tool can still print much useful information.