...

Source file src/github.com/Microsoft/hcsshim/cmd/shimdiag/stacks.go

Documentation: github.com/Microsoft/hcsshim/cmd/shimdiag

     1  //go:build windows
     2  
     3  package main
     4  
     5  import (
     6  	"context"
     7  	"fmt"
     8  
     9  	"github.com/Microsoft/hcsshim/internal/appargs"
    10  	"github.com/Microsoft/hcsshim/internal/shimdiag"
    11  	"github.com/urfave/cli"
    12  )
    13  
    14  var stacksCommand = cli.Command{
    15  	Name:      "stacks",
    16  	Usage:     "Dump the shim and guest's goroutine stacks",
    17  	ArgsUsage: "<shim name>",
    18  	Before:    appargs.Validate(appargs.String),
    19  	Action: func(c *cli.Context) error {
    20  		shim, err := shimdiag.GetShim(c.Args()[0])
    21  		if err != nil {
    22  			return err
    23  		}
    24  		svc := shimdiag.NewShimDiagClient(shim)
    25  		resp, err := svc.DiagStacks(context.Background(), &shimdiag.StacksRequest{})
    26  		if err != nil {
    27  			return err
    28  		}
    29  
    30  		fmt.Println("Stacks:\n", resp.Stacks)
    31  
    32  		if resp.GuestStacks != "" {
    33  			fmt.Println("Guest Stacks:\n", resp.GuestStacks)
    34  		}
    35  		return nil
    36  	},
    37  }
    38  

View as plain text