diff --git a/stack/context.go b/stack/context.go index d2d92c4..27c6256 100644 --- a/stack/context.go +++ b/stack/context.go @@ -118,7 +118,7 @@ var ( // when a signal is not correctly handled. It is printed with m.throwing>0. // These are discarded. // - For cgo, the source file may be "??". - reFile = regexp.MustCompile("^(?:\t| +)(\\?\\?|\\|.+\\.(?:c|go|s))\\:(\\d+)(?:| \\+0x[0-9a-f]+)(?:| fp=0x[0-9a-f]+ sp=0x[0-9a-f]+)$") + reFile = regexp.MustCompile("^(?:\t| +)(\\?\\?|\\|.+\\.(?:c|go|s))\\:(\\d+)(?:| \\+0x[0-9a-f]+)(?:| fp=0x[0-9a-f]+ sp=0x[0-9a-f]+(?:| pc=0x[0-9a-f]+))$") // Sadly, it doesn't note the goroutine number so we could cascade them per // parenthood. reCreated = regexp.MustCompile("^created by (.+)$") diff --git a/stack/context_test.go b/stack/context_test.go index 693a260..7d2e8c8 100644 --- a/stack/context_test.go +++ b/stack/context_test.go @@ -216,6 +216,42 @@ func TestParseDumpAsm(t *testing.T) { compareString(t, "panic: reflect.Set: value of type\n\n", extra.String()) } +func TestParseDumpAsmGo1dot13(t *testing.T) { + data := []string{ + "panic: reflect.Set: value of type", + "", + "goroutine 16 [garbage collection]:", + "runtime.switchtoM()", + "\t/goroot/src/runtime/asm_amd64.s:198 fp=0xc20cfb80d8 sp=0xc20cfb80d0 pc=0x5007be", + "", + } + extra := &bytes.Buffer{} + c, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), extra, false) + if err != nil { + t.Fatal(err) + } + expected := []*Goroutine{ + { + Signature: Signature{ + State: "garbage collection", + Stack: Stack{ + Calls: []Call{ + { + SrcPath: "/goroot/src/runtime/asm_amd64.s", + Line: 198, + Func: Func{Raw: "runtime.switchtoM"}, + }, + }, + }, + }, + ID: 16, + First: true, + }, + } + compareGoroutines(t, expected, c.Goroutines) + compareString(t, "panic: reflect.Set: value of type\n\n", extra.String()) +} + func TestParseDumpLineErr(t *testing.T) { data := []string{ "panic: reflect.Set: value of type",