diff options
Diffstat (limited to 'sys/ddb/db_break.c')
-rw-r--r-- | sys/ddb/db_break.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sys/ddb/db_break.c b/sys/ddb/db_break.c index 9522f3b..bc5ac20 100644 --- a/sys/ddb/db_break.c +++ b/sys/ddb/db_break.c @@ -33,6 +33,8 @@ /* * Breakpoints. */ +#include "opt_comconsole.h" + #include <sys/param.h> #include <vm/vm.h> @@ -363,3 +365,45 @@ db_map_addr(addr) #endif return kernel_map; } + +#ifdef ALT_BREAK_TO_DEBUGGER +/* + * Solaris implements a new BREAK which is initiated by a character sequence + * CR ~ ^b which is similar to a familiar pattern used on Sun servers by the + * Remote Console. + * + * Note that this function may be called from almost anywhere, with interrupts + * disabled and with unknown locks held, so it must not access data other than + * its arguments. Its up to the caller to ensure that the state variable is + * consistent. + */ + +#define KEY_CR 13 /* CR '\r' */ +#define KEY_TILDE 126 /* ~ */ +#define KEY_CRTLB 2 /* ^B */ + +int +db_alt_break(int data, int *state) +{ + int brk = 0; + + switch (data) { + case KEY_CR: + *state = KEY_TILDE; + break; + case KEY_TILDE: + if (*state == KEY_TILDE) + *state = KEY_CRTLB; + else + *state = 0; + break; + case KEY_CRTLB: + if (*state == KEY_CRTLB) + brk = 1; + default: + *state = 0; + break; + } + return (brk); +} +#endif |