linux/kernel/debug/kdb/kdb_private.h

#ifndef _KDBPRIVATE_H
#define _KDBPRIVATE_H

/*
 * Kernel Debugger Architecture Independent Private 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-2004 Silicon Graphics, Inc.  All Rights Reserved.
 * Copyright (c) 2009 Wind River Systems, Inc.  All Rights Reserved.
 */

#include <linux/kgdb.h>
#include "../debug_core.h"

/* Kernel Debugger Command codes.  Must not overlap with error codes. */
#define KDB_CMD_GO
#define KDB_CMD_CPU
#define KDB_CMD_SS
#define KDB_CMD_KGDB

/* Internal debug flags */
#define KDB_DEBUG_FLAG_BP
#define KDB_DEBUG_FLAG_BB_SUMM
#define KDB_DEBUG_FLAG_AR
#define KDB_DEBUG_FLAG_ARA
#define KDB_DEBUG_FLAG_BB
#define KDB_DEBUG_FLAG_STATE
#define KDB_DEBUG_FLAG_MASK
#define KDB_DEBUG_FLAG_SHIFT

#define KDB_DEBUG(flag)
#define KDB_DEBUG_STATE(text, value)

#if BITS_PER_LONG == 32

#define KDB_PLATFORM_ENV

#define kdb_machreg_fmt
#define kdb_machreg_fmt0
#define kdb_bfd_vma_fmt
#define kdb_bfd_vma_fmt0
#define kdb_elfw_addr_fmt
#define kdb_elfw_addr_fmt0
#define kdb_f_count_fmt

#elif BITS_PER_LONG == 64

#define KDB_PLATFORM_ENV

#define kdb_machreg_fmt
#define kdb_machreg_fmt0
#define kdb_bfd_vma_fmt
#define kdb_bfd_vma_fmt0
#define kdb_elfw_addr_fmt
#define kdb_elfw_addr_fmt0
#define kdb_f_count_fmt

#endif

/*
 * KDB_MAXBPT describes the total number of breakpoints
 * supported by this architecture.
 */
#define KDB_MAXBPT

/* Symbol table format returned by kallsyms. */
kdb_symtab_t;
extern int kallsyms_symbol_next(char *prefix_name, int flag, int buf_size);
extern int kallsyms_symbol_complete(char *prefix_name, int max_len);

/* Exported Symbols for kernel loadable modules to use. */
extern int kdb_getarea_size(void *, unsigned long, size_t);
extern int kdb_putarea_size(unsigned long, void *, size_t);

/*
 * Like get_user and put_user, kdb_getarea and kdb_putarea take variable
 * names, not pointers.  The underlying *_size functions take pointers.
 */
#define kdb_getarea(x, addr)
#define kdb_putarea(addr, x)

extern int kdb_getphysword(unsigned long *word,
			unsigned long addr, size_t size);
extern int kdb_getword(unsigned long *, unsigned long, size_t);
extern int kdb_putword(unsigned long, unsigned long, size_t);

extern int kdbgetularg(const char *, unsigned long *);
extern int kdbgetu64arg(const char *, u64 *);
extern char *kdbgetenv(const char *);
extern int kdbgetaddrarg(int, const char **, int*, unsigned long *,
			 long *, char **);
extern int kdbgetsymval(const char *, kdb_symtab_t *);
extern int kdbnearsym(unsigned long, kdb_symtab_t *);
extern char *kdb_strdup(const char *str, gfp_t type);
extern void kdb_symbol_print(unsigned long, const kdb_symtab_t *, unsigned int);

/* Routine for debugging the debugger state. */
extern void kdb_print_state(const char *, int);

extern int kdb_state;
#define KDB_STATE_KDB
#define KDB_STATE_LEAVING
#define KDB_STATE_CMD
#define KDB_STATE_KDB_CONTROL
#define KDB_STATE_HOLD_CPU
#define KDB_STATE_DOING_SS
#define KDB_STATE_SSBPT
#define KDB_STATE_REENTRY
#define KDB_STATE_SUPPRESS
#define KDB_STATE_PAGER
#define KDB_STATE_GO_SWITCH
#define KDB_STATE_WAIT_IPI
#define KDB_STATE_RECURSE
#define KDB_STATE_IP_ADJUSTED
#define KDB_STATE_GO1
#define KDB_STATE_KEYBOARD
#define KDB_STATE_KEXEC
#define KDB_STATE_DOING_KGDB
#define KDB_STATE_KGDB_TRANS
#define KDB_STATE_ARCH

#define KDB_STATE(flag)
#define KDB_STATE_SET(flag)
#define KDB_STATE_CLEAR(flag)

extern int kdb_nextline; /* Current number of lines displayed */

kdb_bp_t;

#ifdef CONFIG_KGDB_KDB
extern kdb_bp_t kdb_breakpoints[/* KDB_MAXBPT */];

extern void kdb_register_table(kdbtab_t *kp, size_t len);
extern int kdb_bt(int, const char **);	/* KDB display back trace */

/* KDB breakpoint management functions */
extern void kdb_initbptab(void);
extern void kdb_bp_install(struct pt_regs *);
extern void kdb_bp_remove(void);

kdb_dbtrap_t;

extern int kdb_main_loop(kdb_reason_t, kdb_reason_t,
			 int, kdb_dbtrap_t, struct pt_regs *);

/* Miscellaneous functions and data areas */
extern int kdb_grepping_flag;
#define KDB_GREPPING_FLAG_SEARCH
extern char kdb_grep_string[];
#define KDB_GREP_STRLEN
extern int kdb_grep_leading;
extern int kdb_grep_trailing;
extern char *kdb_cmds[];
extern char kdb_task_state_char (const struct task_struct *);
extern bool kdb_task_state(const struct task_struct *p, const char *mask);
extern void kdb_ps_suppressed(void);
extern void kdb_ps1(const struct task_struct *p);
extern char kdb_getchar(void);
extern char *kdb_getstr(char *, size_t, const char *);
extern void kdb_gdb_state_pass(char *buf);

/* Defines for kdb_symbol_print */
#define KDB_SP_SPACEB
#define KDB_SP_SPACEA
#define KDB_SP_PAREN
#define KDB_SP_VALUE
#define KDB_SP_SYMSIZE
#define KDB_SP_NEWLINE
#define KDB_SP_DEFAULT

#define KDB_TSK(cpu)
#define KDB_TSKREGS(cpu)

#define kdb_task_has_cpu(p)

#define GFP_KDB

extern struct task_struct *kdb_current_task;
extern struct pt_regs *kdb_current_regs;

#ifdef CONFIG_KDB_KEYBOARD
extern void kdb_kbd_cleanup_state(void);
#else /* ! CONFIG_KDB_KEYBOARD */
#define kdb_kbd_cleanup_state
#endif /* ! CONFIG_KDB_KEYBOARD */

extern char kdb_prompt_str[];

#define KDB_WORD_SIZE

#endif /* CONFIG_KGDB_KDB */

#define kdb_func_printf(format, args...)

#define kdb_dbg_printf(mask, format, args...)

#endif	/* !_KDBPRIVATE_H */