Add PrintStacks util function.

Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/74d85128
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/74d85128
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/74d85128

Branch: refs/heads/master
Commit: 74d851283af3c31e79cd6f0432c0aa02d93c13f5
Parents: 1a0a9ef
Author: Christopher Collins <ccoll...@apache.org>
Authored: Fri Mar 31 17:07:54 2017 -0700
Committer: Christopher Collins <ccoll...@apache.org>
Committed: Fri Mar 31 17:07:54 2017 -0700

----------------------------------------------------------------------
 util/util.go | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/74d85128/util/util.go
----------------------------------------------------------------------
diff --git a/util/util.go b/util/util.go
index fa3e60f..3e144e6 100644
--- a/util/util.go
+++ b/util/util.go
@@ -620,3 +620,9 @@ func IntMin(a, b int) int {
                return b
        }
 }
+
+func PrintStacks() {
+       buf := make([]byte, 1024*1024)
+       stacklen := runtime.Stack(buf, true)
+       fmt.Printf("*** goroutine dump\n%s\n*** end\n", buf[:stacklen])
+}

Reply via email to