aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/extern.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-01-11 18:45:32 -0800
committerRuss Cox <rsc@golang.org>2012-01-11 18:45:32 -0800
commit610757b1552d35d3e960b053ad2a5aedea85b8da (patch)
treee6bc331cc1c2eea16a476ef64d000f6c36b6bc39 /src/pkg/runtime/extern.go
parent524fb81c41ea559306a5ee3dbaf60fa6cda2479f (diff)
downloadgo-610757b1552d35d3e960b053ad2a5aedea85b8da.tar.xz
runtime: delete duplicate implementation of pcln walker
It's hard enough to get right once. R=golang-dev, r CC=golang-dev https://golang.org/cl/5533073
Diffstat (limited to 'src/pkg/runtime/extern.go')
-rw-r--r--src/pkg/runtime/extern.go47
1 files changed, 4 insertions, 43 deletions
diff --git a/src/pkg/runtime/extern.go b/src/pkg/runtime/extern.go
index e86da01732..1860c5b896 100644
--- a/src/pkg/runtime/extern.go
+++ b/src/pkg/runtime/extern.go
@@ -59,51 +59,12 @@ func (f *Func) Entry() uintptr { return f.entry }
// The result will not be accurate if pc is not a program
// counter within f.
func (f *Func) FileLine(pc uintptr) (file string, line int) {
- // NOTE(rsc): If you edit this function, also edit
- // symtab.c:/^funcline. That function also has the
- // comments explaining the logic.
- targetpc := pc
-
- var pcQuant uintptr = 1
- if GOARCH == "arm" {
- pcQuant = 4
- }
-
- p := f.pcln
- pc = f.pc0
- line = int(f.ln0)
- i := 0
- //print("FileLine start pc=", pc, " targetpc=", targetpc, " line=", line,
- // " tab=", p, " ", p[0], " quant=", pcQuant, " GOARCH=", GOARCH, "\n")
- for {
- for i < len(p) && p[i] > 128 {
- pc += pcQuant * uintptr(p[i]-128)
- i++
- }
- //print("pc<", pc, " targetpc=", targetpc, " line=", line, "\n")
- if pc > targetpc || i >= len(p) {
- break
- }
- if p[i] == 0 {
- if i+5 > len(p) {
- break
- }
- line += int(p[i+1]<<24) | int(p[i+2]<<16) | int(p[i+3]<<8) | int(p[i+4])
- i += 5
- } else if p[i] <= 64 {
- line += int(p[i])
- i++
- } else {
- line -= int(p[i] - 64)
- i++
- }
- //print("pc=", pc, " targetpc=", targetpc, " line=", line, "\n")
- pc += pcQuant
- }
- file = f.src
- return
+ return funcline_go(f, pc)
}
+// implemented in symtab.c
+func funcline_go(*Func, uintptr) (string, int)
+
// mid returns the current os thread (m) id.
func mid() uint32