aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/runtime/trace.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/runtime/trace.go')
-rw-r--r--libgo/go/runtime/trace.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/libgo/go/runtime/trace.go b/libgo/go/runtime/trace.go
index 5d7eb75..9678144 100644
--- a/libgo/go/runtime/trace.go
+++ b/libgo/go/runtime/trace.go
@@ -230,7 +230,7 @@ func StartTrace() error {
gp.traceseq = 0
gp.tracelastp = getg().m.p
// +PCQuantum because traceFrameForPC expects return PCs and subtracts PCQuantum.
- id := trace.stackTab.put([]location{location{pc: gp.startpc + sys.PCQuantum}})
+ id := trace.stackTab.put([]location{location{pc: startPCforTrace(gp.startpc) + sys.PCQuantum}})
traceEvent(traceEvGoCreate, -1, uint64(gp.goid), uint64(id), stackID)
}
if status == _Gwaiting {
@@ -1066,7 +1066,7 @@ func traceGoCreate(newg *g, pc uintptr) {
newg.traceseq = 0
newg.tracelastp = getg().m.p
// +PCQuantum because traceFrameForPC expects return PCs and subtracts PCQuantum.
- id := trace.stackTab.put([]location{location{pc: pc + sys.PCQuantum}})
+ id := trace.stackTab.put([]location{location{pc: startPCforTrace(pc) + sys.PCQuantum}})
traceEvent(traceEvGoCreate, 2, uint64(newg.goid), uint64(id))
}
@@ -1239,3 +1239,9 @@ func trace_userLog(id uint64, category, message string) {
traceReleaseBuffer(pid)
}
+
+// the start PC of a goroutine for tracing purposes. If pc is a wrapper,
+// it returns the PC of the wrapped function. Otherwise it returns pc.
+func startPCforTrace(pc uintptr) uintptr {
+ return pc
+}