📄 db_command.cxx
字号:
{ (char *)0 }};struct db_command db_show_cmds[] = { { "all", 0, 0, db_show_all_cmds }, { "breaks", db_listbreak_cmd, 0, 0 }, { "cckr", db_ctxt_kr_print_cmd, 0, 0 }, { "ctxt", db_ctxt_print_cmd, 0, 0 }, /* { "count", db_show_counters_cmd, 0, 0 }, */ { "entry", db_entry_print_cmd, 0, 0 }, { "exit", db_exit_print_cmd, 0, 0 },#ifdef ARCH_X86 { "gdt", db_show_gdt, 0, 0 },#endif { "inv", db_inv_print_cmd, 0, 0 }, { "invkeys", db_invokee_keys_print_cmd,0, 0 }, { "invokee", db_invokee_print_cmd, 0, 0 }, { "irq", db_show_irq_cmd, 0, 0 }, { "key", db_show_key_cmd, 0, 0 }, { "keyregs", db_ctxt_keys_print_cmd, 0, 0 }, { "keyring", db_ctxt_kr_print_cmd, 0, 0 }, { "krsrvs", db_show_kreserves_cmd, 0, 0 }, { "mappings", db_show_mappings_cmd, CS_OWN, 0 }, { "node", db_show_node_cmd, 0, 0 }, { "nodes", db_show_nodes_cmd, 0, 0 }, { "obhdr", db_show_obhdr_cmd, 0, 0 }, { "pages", db_show_pages_cmd, 0, 0 }, { "pins", db_show_pins_cmd, 0, 0 }, { "pmem", db_show_pmem_cmd, 0, 0 }, { "pte", db_show_pte_cmd, 0, 0 }, { "regs", db_show_regs, 0, 0 }, { "rsrvs", db_show_reserves_cmd, 0, 0 }, { "rsrv", db_rsrv_print_cmd, 0, 0 }, { "rsrvchain", db_rsrvchain_print_cmd, 0, 0 }, { "sa", db_show_savearea_cmd, 0, 0 }, { "sizes", db_show_sizes_cmd, 0, 0 }, { "sources", db_show_sources, 0, 0 }, { "thread", db_thread_print_cmd, 0, 0 }, { "uthreads", db_show_uthread_cmd, 0, 0 }, { "walkinfo", db_show_walkinfo_cmd, 0, 0 },#ifdef OPTION_OPTION_DDB_WATCH { "watches", db_listwatch_cmd, 0, 0 },#endif { (char *)0, }};#ifdef OPTION_KERN_STATSextern void db_kstat_hist_depend_cmd(db_expr_t, int, db_expr_t, char*);extern void db_kstat_hist_objhash_cmd(db_expr_t, int, db_expr_t, char*);extern void db_kstat_show_cmd(db_expr_t, int, db_expr_t, char*);#ifdef FAST_IPC_STATSextern void db_kstat_fast_cmd(db_expr_t, int, db_expr_t, char*);#endif#ifdef OPTION_KERN_TIMING_STATSextern void db_kstat_ipc_cmd(db_expr_t, int, db_expr_t, char*);#endifextern void db_kstat_clear_cmd(db_expr_t, int, db_expr_t, char*);struct db_command db_kstat_hist_cmds[] = { { "depend", db_kstat_hist_depend_cmd, CS_OWN, 0 }, { "object", db_kstat_hist_objhash_cmd, CS_OWN, 0 }, { (char *)0 }};struct db_command db_kstat_cmds[] = { { "clear", db_kstat_clear_cmd, 0, 0 },#ifdef FAST_IPC_STATS { "fast", db_kstat_fast_cmd, 0, 0 },#endif { "hist", 0, 0, db_kstat_hist_cmds },#ifdef OPTION_KERN_TIMING_STATS { "ipc", db_kstat_ipc_cmd, 0, 0 },#endif { "show", db_kstat_show_cmd, 0, 0 }, { (char *)0, }};#endif#ifdef OPTION_KERN_PROFILEextern void db_prof_all_cmd(db_expr_t, int, db_expr_t, char*);extern void db_prof_top_cmd(db_expr_t, int, db_expr_t, char*);extern void db_prof_clear_cmd(db_expr_t, int, db_expr_t, char*);struct db_command db_prof_cmds[] = { { "all", db_prof_all_cmd, 0, 0 }, { "clear", db_prof_clear_cmd, 0, 0 }, { "top", db_prof_top_cmd, 0, 0 }, { (char *)0, }};#endifextern void db_eros_mesg_allinv_cmd(db_expr_t, int, db_expr_t, char*);extern void db_eros_mesg_gate_cmd(db_expr_t, int, db_expr_t, char*);extern void db_eros_mesg_keyerr_cmd(db_expr_t, int, db_expr_t, char*);extern void db_eros_mesg_keeper_cmd(db_expr_t, int, db_expr_t, char*);extern void db_eros_mesg_procinv_cmd(db_expr_t, int, db_expr_t, char*);extern void db_eros_mesg_proctrap_cmd(db_expr_t, int, db_expr_t, char*);extern void db_eros_mesg_return_cmd(db_expr_t, int, db_expr_t, char*);extern void db_eros_mesg_segwalk_cmd(db_expr_t, int, db_expr_t, char*);extern void db_eros_mesg_show_cmd(db_expr_t, int, db_expr_t, char*);extern void db_eros_mesg_uqueue_cmd(db_expr_t, int, db_expr_t, char*);extern void db_eros_mesg_uyield_cmd(db_expr_t, int, db_expr_t, char*);struct db_command db_mesg_cmds[] = { { "allinv", db_eros_mesg_allinv_cmd, 0, 0 }, { "gate", db_eros_mesg_gate_cmd, 0, 0 }, { "keyerr", db_eros_mesg_keyerr_cmd, 0, 0 }, { "keeper", db_eros_mesg_keeper_cmd, 0, 0 }, { "procinv", db_eros_mesg_procinv_cmd, 0, 0 }, { "proctrap", db_eros_mesg_proctrap_cmd, 0, 0 }, { "return", db_eros_mesg_return_cmd, 0, 0 }, { "segwalk", db_eros_mesg_segwalk_cmd, 0, 0 }, { "show", db_eros_mesg_show_cmd, 0, 0 }, { "uqueue", db_eros_mesg_uqueue_cmd, 0, 0 }, { "uyield", db_eros_mesg_uyield_cmd, 0, 0 }, { (char *)0, }};#ifndef NDEBUGextern void db_eros_dbg_inttrap_n_cmd(db_expr_t, int, db_expr_t, char*);extern void db_eros_dbg_inttrap_y_cmd(db_expr_t, int, db_expr_t, char*);struct db_command db_debug_inttrap_cmds[] = { { "n", db_eros_dbg_inttrap_n_cmd, 0, 0 }, { "y", db_eros_dbg_inttrap_y_cmd, 0, 0 }, { (char *)0, }};#endif#if DBG_WILD_PTRextern void db_eros_dbg_wild_n_cmd(db_expr_t, int, db_expr_t, char*);extern void db_eros_dbg_wild_y_cmd(db_expr_t, int, db_expr_t, char*);struct db_command db_debug_wild_cmds[] = { { "n", db_eros_dbg_wild_n_cmd, 0, 0 }, { "y", db_eros_dbg_wild_y_cmd, 0, 0 }, { (char *)0, }};#endifstruct db_command db_debug_cmds[] = {#if DBG_WILD_PTR { "wild", 0, 0, db_debug_wild_cmds },#endif#ifndef NDEBUG { "inttrap", 0, 0, db_debug_inttrap_cmds },#endif { (char *)0, }};extern void db_check_ctxt_cmd(db_expr_t, int, db_expr_t, char*);extern void db_check_pages_cmd(db_expr_t, int, db_expr_t, char*);extern void db_check_nodes_cmd(db_expr_t, int, db_expr_t, char*);struct db_command db_check_cmds[] = { { "ctxt", db_check_ctxt_cmd, 0, 0 }, { "nodes", db_check_nodes_cmd, 0, 0 }, { "pages", db_check_pages_cmd, 0, 0 }, { (char *)0, }};extern void db_print_cmd(db_expr_t, int, db_expr_t, char*);extern void db_examine_cmd(db_expr_t, int, db_expr_t, char*);extern void db_set_cmd(db_expr_t, int, db_expr_t, char*);extern void db_search_cmd(db_expr_t, int, db_expr_t, char*);extern void db_write_cmd(db_expr_t, int, db_expr_t, char*);extern void db_delete_cmd(db_expr_t, int, db_expr_t, char*);extern void db_breakpoint_cmd(db_expr_t, int, db_expr_t, char*);#ifdef OPTION_OPTION_DDB_WATCHextern void db_deletewatch_cmd(db_expr_t, int, db_expr_t, char*);extern void db_watchpoint_cmd(db_expr_t, int, db_expr_t, char*);#endifextern void db_single_step_cmd(db_expr_t, int, db_expr_t, char*);extern void db_trace_until_call_cmd(db_expr_t, int, db_expr_t, char*);extern void db_trace_until_matching_cmd(db_expr_t, int, db_expr_t, char*);extern void db_continue_cmd(db_expr_t, int, db_expr_t, char*);extern void db_stack_trace_cmd(db_expr_t, int, db_expr_t, char*);extern void db_reboot_cmd(db_expr_t, int, db_expr_t, char*);extern void db_node_cmd(db_expr_t, int, db_expr_t, char*);extern void db_page_cmd(db_expr_t, int, db_expr_t, char*);extern void db_pframe_cmd(db_expr_t, int, db_expr_t, char*);void db_help_cmd(db_expr_t, int, db_expr_t, char*);void db_fncall(db_expr_t, int, db_expr_t, char*);extern void db_user_continue_cmd(db_expr_t, int, db_expr_t, char*);extern void db_user_single_step_cmd(db_expr_t, int, db_expr_t, char*);struct db_command db_command_table[] = {#ifdef DB_MACHINE_COMMANDS /* this must be the first entry, if it exists */ { "machine", 0, 0, 0},#endif { "b", db_breakpoint_cmd, 0, 0 }, { "break", db_breakpoint_cmd, 0, 0 }, { "c", db_continue_cmd, 0, 0 }, { "call", db_fncall, CS_OWN, 0 },#if 0 { "callout", db_show_callout, 0, 0 },#endif { "check", 0, 0, db_check_cmds }, { "continue", db_continue_cmd, 0, 0 }, { "d", db_delete_cmd, 0, 0 }, { "debug", 0, 0, db_debug_cmds }, { "delete", db_delete_cmd, 0, 0 },#ifdef OPTION_OPTION_DDB_WATCH { "dwatch", db_deletewatch_cmd, 0, 0 },#endif { "examine", db_examine_cmd, CS_SET_DOT, 0 }, { "help", db_help_cmd, 0, 0 },#ifdef OPTION_KERN_STATS { "kstat", 0, 0, db_kstat_cmds },#endif { "match", db_trace_until_matching_cmd,0, 0 }, { "mesg", 0, 0, db_mesg_cmds }, { "n", db_trace_until_matching_cmd,0, 0 }, { "next", db_trace_until_matching_cmd,0, 0 }, { "node", db_node_cmd, CS_OWN, 0 }, { "page", db_page_cmd, CS_OWN, 0 }, { "pframe", db_pframe_cmd, CS_OWN, 0 }, { "print", db_print_cmd, 0, 0 },#ifdef OPTION_KERN_PROFILE { "profile", 0, 0, db_prof_cmds },#endif#if 0 { "ps", db_show_all_procs, 0, 0 },#endif { "rb", db_reboot_cmd, 0, 0 }, { "reboot", db_reboot_cmd, 0, 0 }, { "s", db_single_step_cmd, 0, 0 }, { "search", db_search_cmd, CS_OWN|CS_SET_DOT, 0 }, { "set", db_set_cmd, CS_OWN, 0 }, { "show", 0, 0, db_show_cmds }, { "step", db_single_step_cmd, 0, 0 }, { "trace", db_stack_trace_cmd, 0, 0 }, { "uc", db_user_continue_cmd, 0, 0 }, { "us", db_user_single_step_cmd, 0, 0 }, { "until", db_trace_until_call_cmd,0, 0 }, { "w", db_write_cmd, CS_MORE|CS_SET_DOT, 0 },#ifdef OPTION_OPTION_DDB_WATCH { "watch", db_watchpoint_cmd, CS_MORE, 0 },#endif { "write", db_write_cmd, CS_MORE|CS_SET_DOT, 0 }, { "x", db_examine_cmd, CS_SET_DOT, 0 }, { (char *)0, }};#ifdef DB_MACHINE_COMMANDS/* this function should be called to install the machine dependent commands. It should be called before the debugger is enabled */void db_machine_commands_install(ptr)struct db_command *ptr;{ db_command_table[0].more = ptr; return;}#endifstruct db_command *db_last_command = 0;voiddb_help_cmd(db_expr_t, int, db_expr_t, char*){ int i = 0; struct db_command *cmd = db_command_table; while (cmd->name != 0) { db_printf("%-12s", cmd->name); i++; if ((i % 6) == 0) db_printf("\n"); db_end_line(); cmd++; }}voiddb_command_loop(){ jmp_buf db_jmpbuf; jmp_buf *savejmp = db_recover; extern int db_output_line; /* * Initialize 'prev' and 'next' to dot. */ db_prev = db_dot; db_next = db_dot; db_cmd_loop_done = 0; (void) setjmp(*(db_recover = &db_jmpbuf)); while (!db_cmd_loop_done) { if (db_print_position() != 0) db_printf("\n"); db_output_line = 0; db_printf("kdb> "); (void) db_read_line(); db_command(&db_last_command, db_command_table); } db_recover = savejmp;}voiddb_error(char *s){ if (s) db_printf(s); db_flush_lex(); longjmp(*db_recover, 1);}/* * Call random function: * !expr(arg,arg,arg) */voiddb_fncall(db_expr_t, int, db_expr_t, char*){ db_expr_t fn_addr;#define MAXARGS 11 db_expr_t args[MAXARGS]; int nargs = 0; db_expr_t retval; db_expr_t (*func)(...); int t; if (!db_expression(&fn_addr)) { db_printf("Bad function\n"); db_flush_lex(); return; } func = (db_expr_t (*) (...)) fn_addr; t = db_read_token(); if (t == tLPAREN) { if (db_expression(&args[0])) { nargs++; while ((t = db_read_token()) == tCOMMA) { if (nargs == MAXARGS) { db_printf("Too many arguments\n"); db_flush_lex(); return; } if (!db_expression(&args[nargs])) { db_printf("Argument missing\n"); db_flush_lex(); return; } nargs++; } db_unread_token(t); } if (db_read_token() != tRPAREN) { db_printf("?\n"); db_flush_lex(); return; } } db_skip_to_eol(); while (nargs < MAXARGS) { args[nargs++] = 0; } retval = (*func)(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9] ); db_printf("%#n\n", retval);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -