aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vmimpl/openbsd.go
blob: 221e1e4db3fa85c4faf0e33f794f1246289f2057 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2018 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

package vmimpl

import (
	"io"
	"time"
)

// DiagnoseOpenBSD sends the debug commands to the given writer which
// is expected to be connected to a paniced openbsd kernel.  If kernel
// just hanged, we've lost connection or detected some non-panic
// error, console still shows normal login prompt.
func DiagnoseOpenBSD(w io.Writer) bool {
	commands := []string{
		"",
		"set $lines = 0", // disable pagination
		"show panic",
		"trace",
		"show registers",
		"show proc",
		"ps",
	}
	for _, c := range commands {
		w.Write([]byte(c + "\n"))
		time.Sleep(1 * time.Second)
	}
	return true
}