summaryrefslogtreecommitdiffstats
path: root/sys/ddb/db_main.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2007-12-26 09:33:19 +0000
committerrwatson <rwatson@FreeBSD.org>2007-12-26 09:33:19 +0000
commit6ff1515c5f8d3787a46b92ded45aacb75cec051e (patch)
treea166a654090db301023b94b02c647554eb7320ae /sys/ddb/db_main.c
parent19ae9a5e773935b7d124c45606ca64d72213a810 (diff)
downloadFreeBSD-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/db_main.c')
-rw-r--r--sys/ddb/db_main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/ddb/db_main.c b/sys/ddb/db_main.c
index 0a9fbf7..e63b4fc0 100644
--- a/sys/ddb/db_main.c
+++ b/sys/ddb/db_main.c
@@ -194,6 +194,7 @@ db_trap(int type, int code)
jmp_buf jb;
void *prev_jb;
boolean_t bkpt, watchpt;
+ const char *why;
/*
* Don't handle the trap if the console is unavailable (i.e. it
@@ -222,6 +223,8 @@ db_trap(int type, int code)
db_printf("Stopped at\t");
db_print_loc_and_inst(db_dot);
}
+ why = kdb_why;
+ db_script_kdbenter(why != KDB_WHY_UNSET ? why : "unknown");
db_command_loop();
(void)kdb_jmpbuf(prev_jb);
}
OpenPOWER on IntegriCloud