linux/include/linux/kdb.h

#ifndef _KDB_H
#define _KDB_H

/*
 * Kernel Debugger Architecture Independent Global Headers
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (c) 2000-2007 Silicon Graphics, Inc.  All Rights Reserved.
 * Copyright (C) 2000 Stephane Eranian <[email protected]>
 * Copyright (C) 2009 Jason Wessel <[email protected]>
 */

#include <linux/list.h>

/* Shifted versions of the command enable bits are be used if the command
 * has no arguments (see kdb_check_flags). This allows commands, such as
 * go, to have different permissions depending upon whether it is called
 * with an argument.
 */
#define KDB_ENABLE_NO_ARGS_SHIFT

kdb_cmdflags_t;

kdb_func_t;

/* The KDB shell command table */
kdbtab_t;

#ifdef	CONFIG_KGDB_KDB
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/atomic.h>

#define KDB_POLL_FUNC_MAX
extern int kdb_poll_idx;

/*
 * kdb_initial_cpu is initialized to -1, and is set to the cpu
 * number whenever the kernel debugger is entered.
 */
extern int kdb_initial_cpu;

/* Types and messages used for dynamically added kdb shell commands */

#define KDB_MAXARGS

/* KDB return codes from a command or internal kdb function */
#define KDB_NOTFOUND
#define KDB_ARGCOUNT
#define KDB_BADWIDTH
#define KDB_BADRADIX
#define KDB_NOTENV
#define KDB_NOENVVALUE
#define KDB_NOTIMP
#define KDB_ENVFULL
#define KDB_ENVBUFFULL
#define KDB_TOOMANYBPT
#define KDB_TOOMANYDBREGS
#define KDB_DUPBPT
#define KDB_BPTNOTFOUND
#define KDB_BADMODE
#define KDB_BADINT
#define KDB_INVADDRFMT
#define KDB_BADREG
#define KDB_BADCPUNUM
#define KDB_BADLENGTH
#define KDB_NOBP
#define KDB_BADADDR
#define KDB_NOPERM

/*
 * kdb_diemsg
 *
 *	Contains a pointer to the last string supplied to the
 *	kernel 'die' panic function.
 */
extern const char *kdb_diemsg;

#define KDB_FLAG_EARLYKDB
#define KDB_FLAG_CATASTROPHIC
#define KDB_FLAG_CMD_INTERRUPT
#define KDB_FLAG_NOIPI
#define KDB_FLAG_NO_CONSOLE
#define KDB_FLAG_NO_VT_CONSOLE
#define KDB_FLAG_NO_I8042

extern unsigned int kdb_flags;	/* Global flags, see kdb_state for per cpu state */

extern void kdb_save_flags(void);
extern void kdb_restore_flags(void);

#define KDB_FLAG(flag)
#define KDB_FLAG_SET(flag)
#define KDB_FLAG_CLEAR(flag)

/*
 * External entry point for the kernel debugger.  The pt_regs
 * at the time of entry are supplied along with the reason for
 * entry to the kernel debugger.
 */

kdb_reason_t;

enum kdb_msgsrc {};

extern int kdb_trap_printk;
extern int kdb_printf_cpu;
extern __printf(2, 0) int vkdb_printf(enum kdb_msgsrc src, const char *fmt,
				      va_list args);
extern __printf(1, 2) int kdb_printf(const char *, ...);
kdb_printf_t;

extern void kdb_init(int level);

/* Access to kdb specific polling devices */
get_char_func;
extern get_char_func kdb_poll_funcs[];
extern int kdb_get_kbd_char(void);

static inline
int kdb_process_cpu(const struct task_struct *p)
{}

extern void kdb_send_sig(struct task_struct *p, int sig);

#ifdef CONFIG_KALLSYMS
extern const char *kdb_walk_kallsyms(loff_t *pos);
#else /* ! CONFIG_KALLSYMS */
static inline const char *kdb_walk_kallsyms(loff_t *pos)
{
	return NULL;
}
#endif /* ! CONFIG_KALLSYMS */

/* Dynamic kdb shell command registration */
extern int kdb_register(kdbtab_t *cmd);
extern void kdb_unregister(kdbtab_t *cmd);
#else /* ! CONFIG_KGDB_KDB */
static inline __printf(1, 2) int kdb_printf(const char *fmt, ...) { return 0; }
static inline void kdb_init(int level) {}
static inline int kdb_register(kdbtab_t *cmd) { return 0; }
static inline void kdb_unregister(kdbtab_t *cmd) {}
#endif	/* CONFIG_KGDB_KDB */
enum {};

extern int kdbgetintenv(const char *, int *);
extern int kdb_set(int, const char **);
int kdb_lsmod(int argc, const char **argv);

#endif	/* !_KDB_H */