diff options
author | jake <jake@FreeBSD.org> | 2002-12-31 06:51:19 +0000 |
---|---|---|
committer | jake <jake@FreeBSD.org> | 2002-12-31 06:51:19 +0000 |
commit | 77677050671ce8348ae91f77d4576f5156cd4abd (patch) | |
tree | 9dcdd6d37e0be79ab1ed2b28087e7987606ab01a /sys | |
parent | 3ebf3b00f0cc6e5450a864bbac9b878e0398cc88 (diff) | |
download | FreeBSD-src-77677050671ce8348ae91f77d4576f5156cd4abd.zip FreeBSD-src-77677050671ce8348ae91f77d4576f5156cd4abd.tar.gz |
- Add a function db_alt_break which recognizes the character sequence used to
implement ALT_BREAK_TO_DEBUGGER. The caller provides a pointer to a state
variable to allow different state to be maintained for separate instances of
a device.
- Use struct vm_map * instead of vm_map_t in db_break.h to avoid its users
needing to include vm headers.
Requested by: njl
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ddb/db_break.c | 44 | ||||
-rw-r--r-- | sys/ddb/db_break.h | 8 |
2 files changed, 51 insertions, 1 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 diff --git a/sys/ddb/db_break.h b/sys/ddb/db_break.h index d6ed76e..ef43f68 100644 --- a/sys/ddb/db_break.h +++ b/sys/ddb/db_break.h @@ -41,8 +41,10 @@ #define BKPT_INST_TYPE int #endif +struct vm_map; + struct db_breakpoint { - vm_map_t map; /* in this map */ + struct vm_map *map; /* in this map */ db_addr_t address; /* set here */ int init_count; /* number of times to skip bkpt */ int count; /* current count */ @@ -64,4 +66,8 @@ void db_set_breakpoints(void); db_breakpoint_t db_set_temp_breakpoint(db_addr_t); #endif +#ifdef ALT_BREAK_TO_DEBUGGER +int db_alt_break(int, int *); +#endif + #endif /* !_DDB_DB_BREAK_H_ */ |