aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vmimpl
diff options
context:
space:
mode:
authorGreg Steuck <blackgnezdo@gmail.com>2018-12-02 05:22:10 -0800
committerDmitry Vyukov <dvyukov@google.com>2018-12-02 13:22:10 +0000
commit7a0edfbe7c3703a0bf48f01dd818173a68a8f747 (patch)
tree90c0faa35925f3a0cfcdd376315265a6936e396f /vm/vmimpl
parent048d09b2054f0baeea83fe2595e496c0630e845f (diff)
vm/gce: use openbsd console diagnostic code for both vmm and gce
* openbsd: use console diagnostic code for both vmm and gce. * gometalinter wants less indentation and more stuff in scope * Comment no longer applies
Diffstat (limited to 'vm/vmimpl')
-rw-r--r--vm/vmimpl/openbsd.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/vm/vmimpl/openbsd.go b/vm/vmimpl/openbsd.go
new file mode 100644
index 000000000..79132ebf8
--- /dev/null
+++ b/vm/vmimpl/openbsd.go
@@ -0,0 +1,27 @@
+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
+}