Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
kgdb_nmi.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/compiler.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/atomic.h>
#include <linux/console.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/interrupt.h>
#include <linux/hrtimer.h>
#include <linux/tick.h>
#include <linux/kfifo.h>
#include <linux/kgdb.h>
#include <linux/kdb.h>

Go to the source code of this file.

Data Structures

struct  kgdb_nmi_tty_priv
 

Macros

#define KGDB_NMI_BAUD   115200
 
#define KGDB_NMI_FIFO_SIZE   roundup_pow_of_two(KGDB_NMI_BAUD / 8 / HZ)
 

Functions

 module_param_named (knock, kgdb_nmi_knock, int, 0600)
 
 MODULE_PARM_DESC (knock,"if set to 1 (default), the special '$3#33' command ""must be used to enter the debugger; when set to 0, ""hitting return key is enough to enter the debugger; ""when set to -1, the debugger is entered immediately ""upon NMI")
 
 module_param_named (magic, kgdb_nmi_magic, charp, 0600)
 
 MODULE_PARM_DESC (magic,"magic sequence to enter NMI debugger (default $3#33)")
 
bool kgdb_nmi_poll_knock (void)
 
int kgdb_register_nmi_console (void)
 
 EXPORT_SYMBOL_GPL (kgdb_register_nmi_console)
 
int kgdb_unregister_nmi_console (void)
 
 EXPORT_SYMBOL_GPL (kgdb_unregister_nmi_console)
 

Macro Definition Documentation

#define KGDB_NMI_BAUD   115200

Definition at line 78 of file kgdb_nmi.c.

#define KGDB_NMI_FIFO_SIZE   roundup_pow_of_two(KGDB_NMI_BAUD / 8 / HZ)

Definition at line 79 of file kgdb_nmi.c.

Function Documentation

EXPORT_SYMBOL_GPL ( kgdb_register_nmi_console  )
EXPORT_SYMBOL_GPL ( kgdb_unregister_nmi_console  )
bool kgdb_nmi_poll_knock ( void  )

kgdb_nmi_poll_knock - Check if it is time to enter the debugger

"Serial ports are often noisy, especially when muxed over another port (we often use serial over the headset connector). Noise on the async command line just causes characters that are ignored, on a command line that blocked execution noise would be catastrophic." – Colin Cross

So, this function implements KGDB/KDB knocking on the serial line: we won't enter the debugger until we receive a known magic phrase (which is actually "$3#33", known as "escape to KDB" command. There is also a relaxed variant of knocking, i.e. just pressing the return key is enough to enter the debugger. And if knocking is disabled, the function always returns 1.

Definition at line 181 of file kgdb_nmi.c.

int kgdb_register_nmi_console ( void  )

Definition at line 333 of file kgdb_nmi.c.

int kgdb_unregister_nmi_console ( void  )

Definition at line 381 of file kgdb_nmi.c.

module_param_named ( knock  ,
kgdb_nmi_knock  ,
int  ,
0600   
)
module_param_named ( magic  ,
kgdb_nmi_magic  ,
charp  ,
0600   
)
MODULE_PARM_DESC ( knock  ,
"if set to 1   default,
the special '$3#33'command""must be used to enter the debugger;when set to  0,
""hitting return key is enough to enter the debugger;""when set to-  1,
the debugger is entered immediately""upon NMI  
)
MODULE_PARM_DESC ( magic  ,
"magic sequence to enter NMI debugger (default $3#33)"   
)