1 /* 2 * include/linux/kernel_debugger.h 3 * 4 * Copyright (C) 2008 Google, Inc. 5 * 6 * This software is licensed under the terms of the GNU General Public 7 * License version 2, as published by the Free Software Foundation, and 8 * may be copied, distributed, and modified under those terms. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 */ 15 16 #ifndef _LINUX_KERNEL_DEBUGGER_H_ 17 #define _LINUX_KERNEL_DEBUGGER_H_ 18 19 struct kdbg_ctxt { 20 int (*printf)(void *cookie, const char *fmt, ...); 21 void *cookie; 22 }; 23 24 /* kernel_debugger() is called from IRQ context and should 25 * use the kdbg_ctxt.printf to write output (do NOT call 26 * printk, do operations not safe from IRQ context, etc). 27 * 28 * kdbg_ctxt.printf will return -1 if there is not enough 29 * buffer space or if you are being aborted. In this case 30 * you must return as soon as possible. 31 * 32 * Return non-zero if more data is available -- if buffer 33 * space ran and you had to stop, but could print more, 34 * for example. 35 * 36 * Additional calls where cmd is "more" will be made if 37 * the additional data is desired. 38 */ 39 int kernel_debugger(struct kdbg_ctxt *ctxt, char *cmd); 40 41 #endif 42