github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/vm/vmimpl/freebsd.go (about)

     1  // Copyright 2018 syzkaller project authors. All rights reserved.
     2  // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  package vmimpl
     5  
     6  import (
     7  	"io"
     8  	"time"
     9  )
    10  
    11  // DiagnoseFreeBSD sends the debug commands to the given writer which
    12  // is expected to be connected to a panicked FreeBSD kernel. If kernel
    13  // just hanged, we've lost connection or detected some non-panic error,
    14  // console still shows normal login prompt.
    15  func DiagnoseFreeBSD(w io.Writer) ([]byte, bool) {
    16  	commands := []string{
    17  		"",
    18  		"set $lines = 0",    // disable pagination
    19  		"set $maxwidth = 0", // disable line continuation
    20  		"show registers",
    21  		"show proc",
    22  		"ps",
    23  		"show all locks",
    24  		"show malloc",
    25  		"show uma",
    26  	}
    27  	for _, c := range commands {
    28  		w.Write([]byte(c + "\n"))
    29  		time.Sleep(1 * time.Second)
    30  	}
    31  	return nil, true
    32  }