mirror of
https://github.com/golang/go
synced 2024-11-18 23:44:43 -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,12 +115,21 @@ func (f *peFile) pcln() (textStart uint64, symtab, pclntab []byte, err error) {
|
||||
if sect := f.pe.Section(".text"); sect != nil {
|
||||
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 {
|
||||
// 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 {
|
||||
// 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
|
||||
}
|
||||
|
||||
|
@ -55,12 +55,21 @@ func (f *plan9File) symbols() ([]Sym, error) {
|
||||
|
||||
func (f *plan9File) pcln() (textStart uint64, symtab, pclntab []byte, err error) {
|
||||
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 {
|
||||
// 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 {
|
||||
// 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
|
||||
}
|
||||
|
||||
|
@ -355,12 +355,21 @@ func loadTables(f *os.File) (textStart uint64, textData, symtab, pclntab []byte,
|
||||
textStart = imageBase + uint64(sect.VirtualAddress)
|
||||
textData, _ = sect.Data()
|
||||
}
|
||||
if pclntab, err = loadPETable(obj, "pclntab", "epclntab"); err != nil {
|
||||
if pclntab, err = loadPETable(obj, "runtime.pclntab", "runtime.epclntab"); err != nil {
|
||||
// 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 {
|
||||
// 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
|
||||
}
|
||||
|
||||
@ -369,12 +378,21 @@ func loadTables(f *os.File) (textStart uint64, textData, symtab, pclntab []byte,
|
||||
if sect := obj.Section("text"); sect != nil {
|
||||
textData, _ = sect.Data()
|
||||
}
|
||||
if pclntab, err = loadPlan9Table(obj, "pclntab", "epclntab"); err != nil {
|
||||
if pclntab, err = loadPlan9Table(obj, "runtime.pclntab", "runtime.epclntab"); err != nil {
|
||||
// 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 {
|
||||
// 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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user