mirror of
https://github.com/golang/go
synced 2024-11-18 23:34:45 -07:00
cmd/{addr2line,objdump}: fix finding pclntab and symtab for pe and plan9obj
Broken by 8b5fc7c59d05. Update #8092 LGTM=iant, alex.brainman R=rsc, iant, alex.brainman CC=golang-codereviews https://golang.org/cl/138770043
This commit is contained in:
parent
2c110a11e0
commit
43d4f93c91
@ -115,11 +115,20 @@ func (f *peFile) pcln() (textStart uint64, symtab, pclntab []byte, err error) {
|
|||||||
if sect := f.pe.Section(".text"); sect != nil {
|
if sect := f.pe.Section(".text"); sect != nil {
|
||||||
textStart = imageBase + uint64(sect.VirtualAddress)
|
textStart = imageBase + uint64(sect.VirtualAddress)
|
||||||
}
|
}
|
||||||
if pclntab, err = loadPETable(f.pe, "pclntab", "epclntab"); err != nil {
|
if pclntab, err = loadPETable(f.pe, "runtime.pclntab", "runtime.epclntab"); err != nil {
|
||||||
return 0, nil, nil, err
|
// We didn't find the symbols, so look for the names used in 1.3 and earlier.
|
||||||
|
// TODO: Remove code looking for the old symbols when we no longer care about 1.3.
|
||||||
|
var err2 error
|
||||||
|
if pclntab, err2 = loadPETable(f.pe, "pclntab", "epclntab"); err2 != nil {
|
||||||
|
return 0, nil, nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if symtab, err = loadPETable(f.pe, "symtab", "esymtab"); err != nil {
|
if symtab, err = loadPETable(f.pe, "runtime.symtab", "runtime.esymtab"); err != nil {
|
||||||
return 0, nil, nil, err
|
// Same as above.
|
||||||
|
var err2 error
|
||||||
|
if symtab, err2 = loadPETable(f.pe, "symtab", "esymtab"); err2 != nil {
|
||||||
|
return 0, nil, nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return textStart, symtab, pclntab, nil
|
return textStart, symtab, pclntab, nil
|
||||||
}
|
}
|
||||||
|
@ -55,11 +55,20 @@ func (f *plan9File) symbols() ([]Sym, error) {
|
|||||||
|
|
||||||
func (f *plan9File) pcln() (textStart uint64, symtab, pclntab []byte, err error) {
|
func (f *plan9File) pcln() (textStart uint64, symtab, pclntab []byte, err error) {
|
||||||
textStart = f.plan9.LoadAddress + f.plan9.HdrSize
|
textStart = f.plan9.LoadAddress + f.plan9.HdrSize
|
||||||
if pclntab, err = loadPlan9Table(f.plan9, "pclntab", "epclntab"); err != nil {
|
if pclntab, err = loadPlan9Table(f.plan9, "runtime.pclntab", "runtime.epclntab"); err != nil {
|
||||||
return 0, nil, nil, err
|
// We didn't find the symbols, so look for the names used in 1.3 and earlier.
|
||||||
|
// TODO: Remove code looking for the old symbols when we no longer care about 1.3.
|
||||||
|
var err2 error
|
||||||
|
if pclntab, err2 = loadPlan9Table(f.plan9, "pclntab", "epclntab"); err2 != nil {
|
||||||
|
return 0, nil, nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if symtab, err = loadPlan9Table(f.plan9, "symtab", "esymtab"); err != nil {
|
if symtab, err = loadPlan9Table(f.plan9, "runtime.symtab", "runtime.esymtab"); err != nil {
|
||||||
return 0, nil, nil, err
|
// Same as above.
|
||||||
|
var err2 error
|
||||||
|
if symtab, err2 = loadPlan9Table(f.plan9, "symtab", "esymtab"); err2 != nil {
|
||||||
|
return 0, nil, nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return textStart, symtab, pclntab, nil
|
return textStart, symtab, pclntab, nil
|
||||||
}
|
}
|
||||||
|
@ -355,11 +355,20 @@ func loadTables(f *os.File) (textStart uint64, textData, symtab, pclntab []byte,
|
|||||||
textStart = imageBase + uint64(sect.VirtualAddress)
|
textStart = imageBase + uint64(sect.VirtualAddress)
|
||||||
textData, _ = sect.Data()
|
textData, _ = sect.Data()
|
||||||
}
|
}
|
||||||
if pclntab, err = loadPETable(obj, "pclntab", "epclntab"); err != nil {
|
if pclntab, err = loadPETable(obj, "runtime.pclntab", "runtime.epclntab"); err != nil {
|
||||||
return 0, nil, nil, nil, err
|
// We didn't find the symbols, so look for the names used in 1.3 and earlier.
|
||||||
|
// TODO: Remove code looking for the old symbols when we no longer care about 1.3.
|
||||||
|
var err2 error
|
||||||
|
if pclntab, err2 = loadPETable(obj, "pclntab", "epclntab"); err2 != nil {
|
||||||
|
return 0, nil, nil, nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if symtab, err = loadPETable(obj, "symtab", "esymtab"); err != nil {
|
if symtab, err = loadPETable(obj, "runtime.symtab", "runtime.esymtab"); err != nil {
|
||||||
return 0, nil, nil, nil, err
|
// Same as above.
|
||||||
|
var err2 error
|
||||||
|
if symtab, err2 = loadPETable(obj, "symtab", "esymtab"); err2 != nil {
|
||||||
|
return 0, nil, nil, nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return textStart, textData, symtab, pclntab, nil
|
return textStart, textData, symtab, pclntab, nil
|
||||||
}
|
}
|
||||||
@ -369,11 +378,20 @@ func loadTables(f *os.File) (textStart uint64, textData, symtab, pclntab []byte,
|
|||||||
if sect := obj.Section("text"); sect != nil {
|
if sect := obj.Section("text"); sect != nil {
|
||||||
textData, _ = sect.Data()
|
textData, _ = sect.Data()
|
||||||
}
|
}
|
||||||
if pclntab, err = loadPlan9Table(obj, "pclntab", "epclntab"); err != nil {
|
if pclntab, err = loadPlan9Table(obj, "runtime.pclntab", "runtime.epclntab"); err != nil {
|
||||||
return 0, nil, nil, nil, err
|
// We didn't find the symbols, so look for the names used in 1.3 and earlier.
|
||||||
|
// TODO: Remove code looking for the old symbols when we no longer care about 1.3.
|
||||||
|
var err2 error
|
||||||
|
if pclntab, err2 = loadPlan9Table(obj, "pclntab", "epclntab"); err2 != nil {
|
||||||
|
return 0, nil, nil, nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if symtab, err = loadPlan9Table(obj, "symtab", "esymtab"); err != nil {
|
if symtab, err = loadPlan9Table(obj, "runtime.symtab", "runtime.esymtab"); err != nil {
|
||||||
return 0, nil, nil, nil, err
|
// Same as above.
|
||||||
|
var err2 error
|
||||||
|
if symtab, err2 = loadPlan9Table(obj, "symtab", "esymtab"); err2 != nil {
|
||||||
|
return 0, nil, nil, nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return textStart, textData, symtab, pclntab, nil
|
return textStart, textData, symtab, pclntab, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user