diff options
| author | Andrew Turner <andrew@fubar.geek.nz> | 2019-10-21 13:25:55 +0100 |
|---|---|---|
| committer | Michael Tüxen <tuexen@fh-muenster.de> | 2019-10-21 14:25:55 +0200 |
| commit | b24d2b8a213c09b511478e7eab5fa343e4a198de (patch) | |
| tree | e5c1c459fedf77172e3f28ed935ded9a2391e675 /vm/vmimpl | |
| parent | 8c88c9c1c99c8cd8dabc951164c820b9c9f25114 (diff) | |
vm: Get debug information when FreeBSD on panics (#1470)
The FreeBSD kernel debugger can provide more information when the
kernel panics. Add support to bhybe and gce to print this information.
Diffstat (limited to 'vm/vmimpl')
| -rw-r--r-- | vm/vmimpl/freebsd.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/vm/vmimpl/freebsd.go b/vm/vmimpl/freebsd.go new file mode 100644 index 000000000..c6074028a --- /dev/null +++ b/vm/vmimpl/freebsd.go @@ -0,0 +1,32 @@ +// 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" +) + +// DiagnoseFreeBSD sends the debug commands to the given writer which +// is expected to be connected to a panicked FreeBSD kernel. If kernel +// just hanged, we've lost connection or detected some non-panic +// error, console still shows normal login prompt. +func DiagnoseFreeBSD(w io.Writer) bool { + commands := []string{ + "", + "set $lines = 0", // disable pagination + "set $maxwidth = 0", // disable line continuation + "show registers", + "show proc", + "ps", + "show all locks", + "show malloc", + "show ktr", + } + for _, c := range commands { + w.Write([]byte(c + "\n")) + time.Sleep(1 * time.Second) + } + return true +} |
