diff options
author | ps <ps@FreeBSD.org> | 2000-06-14 06:41:33 +0000 |
---|---|---|
committer | ps <ps@FreeBSD.org> | 2000-06-14 06:41:33 +0000 |
commit | 27235775e10be39868b9f27f126f607c31596275 (patch) | |
tree | fa2b6bc115b5feed5b1ae66b9b01fe8ea30ce4fc /sys/dev/sio/sio.c | |
parent | 9941e0786710b93c7b52eb1adf70c4c2ad6571e1 (diff) | |
download | FreeBSD-src-27235775e10be39868b9f27f126f607c31596275.zip FreeBSD-src-27235775e10be39868b9f27f126f607c31596275.tar.gz |
Add option ALT_BREAK_TO_DEBUGGER.
Implement the Solaris way to break into DDB over a serial console
instead of sending a break. Sending the character sequence
CR ~ ^b will break the kernel into DDB (if DDB is enabled).
Reviewed by: peter
Diffstat (limited to 'sys/dev/sio/sio.c')
-rw-r--r-- | sys/dev/sio/sio.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 8a299bd..5fef0d9 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -1868,6 +1868,35 @@ siointr1(com) recv_data = 0; else recv_data = inb(com->data_port); +#if defined(DDB) && defined(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. + */ +#define KEY_CRTLB 2 /* ^B */ +#define KEY_CR 13 /* CR '\r' */ +#define KEY_TILDE 126 /* ~ */ + + if (com->unit == comconsole) { + static int brk_state1 = 0, brk_state2 = 0; + if (recv_data == KEY_CR) { + brk_state1 = recv_data; + brk_state2 = 0; + } else if (brk_state1 == KEY_CR && (recv_data == KEY_TILDE || recv_data == KEY_CRTLB)) { + if (recv_data == KEY_TILDE) + brk_state2 = recv_data; + else if (brk_state2 == KEY_TILDE && recv_data == KEY_CRTLB) { + breakpoint(); + brk_state1 = brk_state2 = 0; + goto cont; + } else + brk_state2 = 0; + } else + brk_state1 = 0; + } +#endif if (line_status & (LSR_BI | LSR_FE | LSR_PE)) { /* * Don't store BI if IGNBRK or FE/PE if IGNPAR. |