mirror of
https://github.com/golang/go
synced 2024-11-13 15:50:22 -07:00
cmd/link: Clean up Pcln struct
Removes unnecessary fields from Pcln. Change-Id: I175049ca749b510eedaf65162355bc4d7a93315e Reviewed-on: https://go-review.googlesource.com/21041 Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
53efe1e121
commit
516c6b4085
@ -344,7 +344,7 @@ func (d *deadcodepass) flood() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if s.Pcln != nil {
|
if s.Pcln != nil {
|
||||||
for i := 0; i < s.Pcln.Nfuncdata; i++ {
|
for i := range s.Pcln.Funcdata {
|
||||||
d.mark(s.Pcln.Funcdata[i], s)
|
d.mark(s.Pcln.Funcdata[i], s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1367,7 +1367,7 @@ func finddebugruntimepath(s *LSym) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < s.Pcln.Nfile; i++ {
|
for i := range s.Pcln.File {
|
||||||
f := s.Pcln.File[i]
|
f := s.Pcln.File[i]
|
||||||
if i := strings.Index(f.Name, "runtime/runtime.go"); i >= 0 {
|
if i := strings.Index(f.Name, "runtime/runtime.go"); i >= 0 {
|
||||||
gdbscript = f.Name[:i] + "runtime/runtime-gdb.py"
|
gdbscript = f.Name[:i] + "runtime/runtime-gdb.py"
|
||||||
|
@ -235,13 +235,9 @@ type Pcln struct {
|
|||||||
Pcfile Pcdata
|
Pcfile Pcdata
|
||||||
Pcline Pcdata
|
Pcline Pcdata
|
||||||
Pcdata []Pcdata
|
Pcdata []Pcdata
|
||||||
Npcdata int
|
|
||||||
Funcdata []*LSym
|
Funcdata []*LSym
|
||||||
Funcdataoff []int64
|
Funcdataoff []int64
|
||||||
Nfuncdata int
|
|
||||||
File []*LSym
|
File []*LSym
|
||||||
Nfile int
|
|
||||||
Mfile int
|
|
||||||
Lastfile *LSym
|
Lastfile *LSym
|
||||||
Lastindex int
|
Lastindex int
|
||||||
}
|
}
|
||||||
|
@ -282,14 +282,12 @@ overwrite:
|
|||||||
pc.Pcline.P = rddata(f, buf)
|
pc.Pcline.P = rddata(f, buf)
|
||||||
n = rdint(f)
|
n = rdint(f)
|
||||||
pc.Pcdata = make([]Pcdata, n)
|
pc.Pcdata = make([]Pcdata, n)
|
||||||
pc.Npcdata = n
|
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
pc.Pcdata[i].P = rddata(f, buf)
|
pc.Pcdata[i].P = rddata(f, buf)
|
||||||
}
|
}
|
||||||
n = rdint(f)
|
n = rdint(f)
|
||||||
pc.Funcdata = make([]*LSym, n)
|
pc.Funcdata = make([]*LSym, n)
|
||||||
pc.Funcdataoff = make([]int64, n)
|
pc.Funcdataoff = make([]int64, n)
|
||||||
pc.Nfuncdata = n
|
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
pc.Funcdata[i] = rdsym(ctxt, f, pkg)
|
pc.Funcdata[i] = rdsym(ctxt, f, pkg)
|
||||||
}
|
}
|
||||||
@ -298,7 +296,6 @@ overwrite:
|
|||||||
}
|
}
|
||||||
n = rdint(f)
|
n = rdint(f)
|
||||||
pc.File = make([]*LSym, n)
|
pc.File = make([]*LSym, n)
|
||||||
pc.Nfile = n
|
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
pc.File[i] = rdsym(ctxt, f, pkg)
|
pc.File[i] = rdsym(ctxt, f, pkg)
|
||||||
}
|
}
|
||||||
|
@ -280,8 +280,8 @@ func pclntab() {
|
|||||||
// fixed size of struct, checked below
|
// fixed size of struct, checked below
|
||||||
off = funcstart
|
off = funcstart
|
||||||
|
|
||||||
end = funcstart + int32(Thearch.Ptrsize) + 3*4 + 5*4 + int32(pcln.Npcdata)*4 + int32(pcln.Nfuncdata)*int32(Thearch.Ptrsize)
|
end = funcstart + int32(Thearch.Ptrsize) + 3*4 + 5*4 + int32(len(pcln.Pcdata))*4 + int32(len(pcln.Funcdata))*int32(Thearch.Ptrsize)
|
||||||
if pcln.Nfuncdata > 0 && (end&int32(Thearch.Ptrsize-1) != 0) {
|
if len(pcln.Funcdata) > 0 && (end&int32(Thearch.Ptrsize-1) != 0) {
|
||||||
end += 4
|
end += 4
|
||||||
}
|
}
|
||||||
Symgrow(Ctxt, ftab, int64(end))
|
Symgrow(Ctxt, ftab, int64(end))
|
||||||
@ -321,19 +321,19 @@ func pclntab() {
|
|||||||
|
|
||||||
off = addpctab(ftab, off, &pcln.Pcfile)
|
off = addpctab(ftab, off, &pcln.Pcfile)
|
||||||
off = addpctab(ftab, off, &pcln.Pcline)
|
off = addpctab(ftab, off, &pcln.Pcline)
|
||||||
off = int32(setuint32(Ctxt, ftab, int64(off), uint32(pcln.Npcdata)))
|
off = int32(setuint32(Ctxt, ftab, int64(off), uint32(len(pcln.Pcdata))))
|
||||||
off = int32(setuint32(Ctxt, ftab, int64(off), uint32(pcln.Nfuncdata)))
|
off = int32(setuint32(Ctxt, ftab, int64(off), uint32(len(pcln.Funcdata))))
|
||||||
for i = 0; i < int32(pcln.Npcdata); i++ {
|
for i = 0; i < int32(len(pcln.Pcdata)); i++ {
|
||||||
off = addpctab(ftab, off, &pcln.Pcdata[i])
|
off = addpctab(ftab, off, &pcln.Pcdata[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
// funcdata, must be pointer-aligned and we're only int32-aligned.
|
// funcdata, must be pointer-aligned and we're only int32-aligned.
|
||||||
// Missing funcdata will be 0 (nil pointer).
|
// Missing funcdata will be 0 (nil pointer).
|
||||||
if pcln.Nfuncdata > 0 {
|
if len(pcln.Funcdata) > 0 {
|
||||||
if off&int32(Thearch.Ptrsize-1) != 0 {
|
if off&int32(Thearch.Ptrsize-1) != 0 {
|
||||||
off += 4
|
off += 4
|
||||||
}
|
}
|
||||||
for i = 0; i < int32(pcln.Nfuncdata); i++ {
|
for i = 0; i < int32(len(pcln.Funcdata)); i++ {
|
||||||
if pcln.Funcdata[i] == nil {
|
if pcln.Funcdata[i] == nil {
|
||||||
setuintxx(Ctxt, ftab, int64(off)+int64(Thearch.Ptrsize)*int64(i), uint64(pcln.Funcdataoff[i]), int64(Thearch.Ptrsize))
|
setuintxx(Ctxt, ftab, int64(off)+int64(Thearch.Ptrsize)*int64(i), uint64(pcln.Funcdataoff[i]), int64(Thearch.Ptrsize))
|
||||||
} else {
|
} else {
|
||||||
@ -344,11 +344,11 @@ func pclntab() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
off += int32(pcln.Nfuncdata) * int32(Thearch.Ptrsize)
|
off += int32(len(pcln.Funcdata)) * int32(Thearch.Ptrsize)
|
||||||
}
|
}
|
||||||
|
|
||||||
if off != end {
|
if off != end {
|
||||||
Diag("bad math in functab: funcstart=%d off=%d but end=%d (npcdata=%d nfuncdata=%d ptrsize=%d)", funcstart, off, end, pcln.Npcdata, pcln.Nfuncdata, Thearch.Ptrsize)
|
Diag("bad math in functab: funcstart=%d off=%d but end=%d (npcdata=%d nfuncdata=%d ptrsize=%d)", funcstart, off, end, len(pcln.Pcdata), len(pcln.Funcdata), Thearch.Ptrsize)
|
||||||
errorexit()
|
errorexit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user