diff options
author | rwatson <rwatson@FreeBSD.org> | 2007-12-26 09:33:19 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2007-12-26 09:33:19 +0000 |
commit | 6ff1515c5f8d3787a46b92ded45aacb75cec051e (patch) | |
tree | a166a654090db301023b94b02c647554eb7320ae /sys/ddb/ddb.h | |
parent | 19ae9a5e773935b7d124c45606ca64d72213a810 (diff) | |
download | FreeBSD-src-6ff1515c5f8d3787a46b92ded45aacb75cec051e.zip FreeBSD-src-6ff1515c5f8d3787a46b92ded45aacb75cec051e.tar.gz |
Add a simple scripting facility to DDB(4), allowing the user to
define a set of named scripts. Each script consists of a list of DDB
commands separated by ";"s that will be executed verbatim. No higher
level language constructs, such as branching, are provided for:
scripts are executed by sequentially injecting commands into the DDB
input buffer.
Four new commands are present in DDB: "run" to run a specific script,
"script" to define or print a script, "scripts" to list currently
defined scripts, and "unscript" to delete a script, modeled on shell
alias commands. Scripts may also be manipulated using sysctls in the
debug.ddb.scripting MIB space, although users will prefer to use the
soon-to-be-added ddb(8) tool for usability reasons.
Scripts with certain names are automatically executed on various DDB
events, such as entering the debugger via a panic, a witness error,
watchdog, breakpoint, sysctl, serial break, etc, allowing customized
handling.
MFC after: 3 months
Diffstat (limited to 'sys/ddb/ddb.h')
-rw-r--r-- | sys/ddb/ddb.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h index cb516cc..ebec60a 100644 --- a/sys/ddb/ddb.h +++ b/sys/ddb/ddb.h @@ -47,6 +47,26 @@ SYSCTL_DECL(_debug_ddb); #define DB_MAXARGS 10 #endif +#ifndef DB_MAXLINE +#define DB_MAXLINE 120 +#endif + +#ifndef DB_MAXSCRIPTS +#define DB_MAXSCRIPTS 8 +#endif + +#ifndef DB_MAXSCRIPTNAME +#define DB_MAXSCRIPTNAME 32 +#endif + +#ifndef DB_MAXSCRIPTLEN +#define DB_MAXSCRIPTLEN 128 +#endif + +#ifndef DB_MAXSCRIPTRECURSION +#define DB_MAXSCRIPTRECURSION 3 +#endif + #ifndef DB_CALL #define DB_CALL db_fncall_generic #else @@ -138,8 +158,11 @@ db_cmdfcn_t db_deletewatch_cmd; db_cmdfcn_t db_examine_cmd; db_cmdfcn_t db_hwatchpoint_cmd; db_cmdfcn_t db_listbreak_cmd; +db_cmdfcn_t db_scripts_cmd; db_cmdfcn_t db_print_cmd; db_cmdfcn_t db_ps; +db_cmdfcn_t db_run_cmd; +db_cmdfcn_t db_script_cmd; db_cmdfcn_t db_search_cmd; db_cmdfcn_t db_set_cmd; db_cmdfcn_t db_set_thread; @@ -148,6 +171,7 @@ db_cmdfcn_t db_show_threads; db_cmdfcn_t db_single_step_cmd; db_cmdfcn_t db_trace_until_call_cmd; db_cmdfcn_t db_trace_until_matching_cmd; +db_cmdfcn_t db_unscript_cmd; db_cmdfcn_t db_watchpoint_cmd; db_cmdfcn_t db_write_cmd; @@ -183,4 +207,9 @@ void db_capture_exitpager(void); void db_capture_write(char *buffer, u_int buflen); void db_capture_writech(char ch); +/* + * Interface between DDB and the script facility. + */ +void db_script_kdbenter(const char *eventname); /* KDB enter event. */ + #endif /* !_DDB_DDB_H_ */ |