summaryrefslogtreecommitdiff
path: root/src/cmd/addr2line
diff options
context:
space:
mode:
authorAram H?v?rneanu <aram@mgk.ro>2014-07-09 12:33:13 +0200
committerAram H?v?rneanu <aram@mgk.ro>2014-07-09 12:33:13 +0200
commit2b380b34ee2be34243bc9ffb1cbde28274d469cf (patch)
tree57d4ae932bf92fb8980a252e88d10aef03e38dac /src/cmd/addr2line
parentd99da71b1818c89d35b1ca89e1ff0203221cdbf3 (diff)
downloadgo-2b380b34ee2be34243bc9ffb1cbde28274d469cf.tar.gz
debug/plan9obj, cmd/addr2line: on Plan 9 use a.out header
size instead of abusing text symbol cmd/addr2line needs to know the virtual address of the start of the text segment (load address plus header size). For this, it used the text symbol added by the linker. This is wrong on amd64. Header size is 40 bytes, not 32 like on 386 and arm. Function alignment is 16 bytes causing text to be at 0x200030. debug/plan9obj now exports both the load address and the header size; cmd/addr2line uses this new information and doesn't rely on text anymore. LGTM=0intro R=0intro, gobot, ality CC=ality, golang-codereviews, jas, mischief https://codereview.appspot.com/106460044
Diffstat (limited to 'src/cmd/addr2line')
-rw-r--r--src/cmd/addr2line/main.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/cmd/addr2line/main.go b/src/cmd/addr2line/main.go
index b94ba12ef..c6e4563db 100644
--- a/src/cmd/addr2line/main.go
+++ b/src/cmd/addr2line/main.go
@@ -237,10 +237,6 @@ func loadPlan9Table(f *plan9obj.File, sname, ename string) ([]byte, error) {
if err != nil {
return nil, err
}
- text, err := findPlan9Symbol(f, "text")
- if err != nil {
- return nil, err
- }
sect := f.Section("text")
if sect == nil {
return nil, err
@@ -249,5 +245,5 @@ func loadPlan9Table(f *plan9obj.File, sname, ename string) ([]byte, error) {
if err != nil {
return nil, err
}
- return data[ssym.Value-text.Value : esym.Value-text.Value], nil
+ return data[ssym.Value-(f.LoadAddress+f.HdrSize) : esym.Value-(f.LoadAddress+f.HdrSize)], nil
}