]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/trace: traces may end with pending mark assists
authorHeschi Kreinick <heschi@google.com>
Wed, 22 Feb 2017 22:58:31 +0000 (17:58 -0500)
committerHeschi Kreinick <heschi@google.com>
Thu, 2 Mar 2017 18:33:54 +0000 (18:33 +0000)
There's no guarantee that all in-progress mark assists will finish
before the trace does. Don't crash if that happens.

I haven't added a test because there's quite a bit of ceremony involved
and the bug is fairly straightforward.

Change-Id: Ia1369a8e2260fc6a328ad204a1eab1063d2e2c90
Reviewed-on: https://go-review.googlesource.com/37540
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/trace/trace.go

index 0b80d94f7d00fdae4eccf31083749cc842335456..72cab90de00e328175094725c876bdf0c206c9a8 100644 (file)
@@ -475,7 +475,7 @@ func generateTrace(params *traceParams) (ViewerData, error) {
                        goFinish := getGInfo(ev.G).start.Link
                        fakeMarkStart := *ev
                        text := "MARK ASSIST"
-                       if markFinish.Ts > goFinish.Ts {
+                       if markFinish == nil || markFinish.Ts > goFinish.Ts {
                                fakeMarkStart.Link = goFinish
                                text = "MARK ASSIST (unfinished)"
                        }
@@ -496,7 +496,7 @@ func generateTrace(params *traceParams) (ViewerData, error) {
                                goFinish := ev.Link
                                fakeMarkStart := *ev
                                text := "MARK ASSIST (resumed, unfinished)"
-                               if markFinish.Ts < goFinish.Ts {
+                               if markFinish != nil && markFinish.Ts < goFinish.Ts {
                                        fakeMarkStart.Link = markFinish
                                        text = "MARK ASSIST (resumed)"
                                }