From 20a33efdf32bf0aedcb0c9813ddc7572bb1ab8c7 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor <iant@golang.org>
Date: Fri, 18 Feb 2022 13:10:34 -0800
Subject: libgo: update to Go1.18rc1 release

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/386594
---
 libgo/go/runtime/trace.go | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'libgo/go/runtime/trace.go')

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
+}
-- 
cgit v1.1