How do I track down a golang stack overflow?

Viewed 135

I have a stack overflow in my code somewhere that's most likely caused by a (deliberately) recursive structure being printed (I don't actually want to print it). I want to track down which print call in my code is leading to the stack overflow, but all I get is the top 100 entries of the stack, and then one entry from the bottom:

fmt.(*pp).printValue(0xc000088a90, 0x609680, 0xc00015cde0, 0x97, 0xc000000076, 0x115ab4)
    /usr/local/go/src/fmt/print.go:869 +0x516 fp=0xc0204b98a8 sp=0xc0204b96d0 pc=0x4cd066
fmt.(*pp).printValue(0xc000088a90, 0x61d300, 0xc000149400, 0x194, 0x76, 0x115ab3)
    /usr/local/go/src/fmt/print.go:823 +0x1883 fp=0xc0204b9a80 sp=0xc0204b98a8 pc=0x4ce3d3
...additional frames elided...
created by testing.(*T).Run
    /usr/local/go/src/testing/testing.go:960 +0x350

... which is completely opposite to what you need to track down a SO. Is there a way to get the useful part of the stack trace (the first 100 entries rather than the last 100 entries)?

0 Answers
Related