public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libgo patch committed: In sigprof, skip to sigtrampgo if we don't find sigtramp
@ 2019-01-18  3:30 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2019-01-18  3:30 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

This patch to libgo change the runtime function sigprof to skip to
sigtrampgo if we don't find sigtramp.  This fixes GCC PR 88202.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
Bootstrapped and ran runtime/pprof test on aarch64-linux-gnu.
Committed to mainline.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1513 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 268001)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-d6576c83016d856217758c06d945bfc363ffb817
+d16e9181a760796802c067730bb030b92b63fb2c
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/go/runtime/proc.go
===================================================================
--- libgo/go/runtime/proc.go	(revision 268001)
+++ libgo/go/runtime/proc.go	(working copy)
@@ -3600,10 +3600,17 @@ func sigprof(pc uintptr, gp *g, mp *m) {
 		// To ensure a sane profile, walk through the frames in
 		// "stklocs" until we find the "runtime.sigtramp" frame, then
 		// report only those frames below the frame one down from
-		// that. If for some reason "runtime.sigtramp" is not present,
-		// don't make any changes.
+		// that. On systems that don't split stack, "sigtramp" can
+		// do a sibling call to "sigtrampgo", so use "sigtrampgo"
+		// if we don't find "sigtramp". If for some reason
+		// neither "runtime.sigtramp" nor "runtime.sigtrampgo" is
+		// present, don't make any changes.
 		framesToDiscard := 0
 		for i := 0; i < n; i++ {
+			if stklocs[i].function == "runtime.sigtrampgo" && i+2 < n {
+				framesToDiscard = i + 2
+				n -= framesToDiscard
+			}
 			if stklocs[i].function == "runtime.sigtramp" && i+2 < n {
 				framesToDiscard = i + 2
 				n -= framesToDiscard

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-18  3:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-18  3:30 libgo patch committed: In sigprof, skip to sigtrampgo if we don't find sigtramp Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).