stack/context.go
func ParseDump(r io.Reader, out io.Writer, guesspaths bool) (*Context, error) {
	goroutines, err := parseDump(r, out)
	if len(goroutines) == 0 {
		return nil, err
	}
	c := &Context{
		Goroutines:   goroutines,
		localgoroot:  runtime.GOROOT(),
		localgopaths: getGOPATHs(),
	}
	nameArguments(goroutines)
	// Corresponding local values on the host for Context.
	if guesspaths {
		c.findRoots()
		for _, r := range c.Goroutines {
			// Note that this is important to call it even if
			// c.GOROOT == c.localgoroot.
			r.updateLocations(c.GOROOT, c.localgoroot, c.GOPATHs)
		}
	}
	return c, err
}
func ParseDump(r io.Reader, out io.Writer, guesspaths bool) (*Context, error) {
	goroutines, err := parseDump(r, out)
	if len(goroutines) == 0 {
		return nil, err
	}
	c := &Context{
		Goroutines:   goroutines,
		localgoroot:  runtime.GOROOT(),
		localgopaths: getGOPATHs(),
	}
	nameArguments(goroutines)
	// Corresponding local values on the host for Context.
	if guesspaths {
		c.findRoots()
		for _, r := range c.Goroutines {
			// Note that this is important to call it even if
			// c.GOROOT == c.localgoroot.
			r.updateLocations(c.GOROOT, c.localgoroot, c.GOPATHs)
		}
	}
	return c, err
}
func ParseDump ( r io . Reader , out io . Writer , guesspaths bool ) ( * Context , error ) { goroutines , err := parseDump ( r , out ) if len ( goroutines ) == 0 { return nil , err } c := & Context { Goroutines : goroutines , localgoroot : runtime . GOROOT ( ) , localgopaths : getGOPATHs ( ) , } nameArguments ( goroutines ) // Corresponding local values on the host for Context. if guesspaths { c . findRoots ( ) for _ , r := range c . Goroutines { // Note that this is important to call it even if // c.GOROOT == c.localgoroot. r . updateLocations ( c . GOROOT , c . localgoroot , c . GOPATHs ) } } return c , err }
// ParseDump processes the output from runtime.Stack().
//
// Returns nil *Context if no stack trace was detected.
//
// It pipes anything not detected as a panic stack trace from r into out. It
// assumes there is junk before the actual stack trace. The junk is streamed to
// out.
//
// If guesspaths is false, no guessing of GOROOT and GOPATH is done, and Call
// entites do not have LocalSrcPath and IsStdlib filled in.
ParseDump processes the output from runtime . Stack () . Returns nil * Context if no stack trace was detected . It pipes anything not detected as a panic stack trace from r into out . It assumes there is junk before the actual stack trace . The junk is streamed to out . If guesspaths is false no guessing of GOROOT and GOPATH is done and Call entites do not have LocalSrcPath and IsStdlib filled in .