summaryrefslogtreecommitdiff
path: root/include/linux/kernel_debugger.h
diff options
context:
space:
mode:
authorBrian Swetland <swetland@google.com>2008-04-08 22:34:46 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 12:12:07 -0700
commit982dd581c444824348f27adff593880e77a53600 (patch)
treef3a6468eafb5ae226a6367556371d5345294245d /include/linux/kernel_debugger.h
parentd384394c04c9f9ae04cb0a7677d871205483193c (diff)
kernel_debugger_core: add interrupt-context debugger core
This provides kernel_debugger() which can be called from an interrupt context low level debugger wedge to execute commands that inspect kernel state. It doesn't do much on its own. Signed-off-by: Brian Swetland <swetland@google.com> kernel_debugger_core: Add sysrq command. sysrq <c> will run the sysrq command <c> and dump what was added to the kernel log while the command ran. Signed-off-by: Brian Swetland <swetland@google.com> Signed-off-by: Arve Hjønnevåg <arve@android.com> Change-Id: I7d260f89595f18638bcedc90d27471b840957631 Reviewed-on: http://git-master/r/111034 Reviewed-by: Prashant Malani <pmalani@nvidia.com> Tested-by: Prashant Malani <pmalani@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bo Yan <byan@nvidia.com> Rebase-Id: R078775f41883d31bd9d397f7256481eef08421e1
Diffstat (limited to 'include/linux/kernel_debugger.h')
-rw-r--r--include/linux/kernel_debugger.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/include/linux/kernel_debugger.h b/include/linux/kernel_debugger.h
new file mode 100644
index 000000000000..b4dbfe99d79e
--- /dev/null
+++ b/include/linux/kernel_debugger.h
@@ -0,0 +1,41 @@
+/*
+ * include/linux/kernel_debugger.h
+ *
+ * Copyright (C) 2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _LINUX_KERNEL_DEBUGGER_H_
+#define _LINUX_KERNEL_DEBUGGER_H_
+
+struct kdbg_ctxt {
+ int (*printf)(void *cookie, const char *fmt, ...);
+ void *cookie;
+};
+
+/* kernel_debugger() is called from IRQ context and should
+ * use the kdbg_ctxt.printf to write output (do NOT call
+ * printk, do operations not safe from IRQ context, etc).
+ *
+ * kdbg_ctxt.printf will return -1 if there is not enough
+ * buffer space or if you are being aborted. In this case
+ * you must return as soon as possible.
+ *
+ * Return non-zero if more data is available -- if buffer
+ * space ran and you had to stop, but could print more,
+ * for example.
+ *
+ * Additional calls where cmd is "more" will be made if
+ * the additional data is desired.
+ */
+int kernel_debugger(struct kdbg_ctxt *ctxt, char *cmd);
+
+#endif