From e8b45fe8b5c6801f60e2825d09a2bda22e80372a Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Sun, 2 Apr 2017 00:13:56 +0200 Subject: ddb: debug traps and port references * ddb/db_command.c (db_debug_all_traps_cmd): New declaration and function. (db_debug_port_references_cmd): Likewise. * doc/mach.texi: Describe new commands. * i386/i386/db_interface.h (db_debug_all_traps): New declaration. * i386/i386/trap.c (db_debug_all_traps): New function. * ipc/mach_port.c (db_debug_port_references): New function. * ipc/mach_port.h (db_debug_port_references): New declaration. --- ddb/db_command.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'ddb/db_command.c') diff --git a/ddb/db_command.c b/ddb/db_command.c index 721f04fe..11bca7ac 100644 --- a/ddb/db_command.c +++ b/ddb/db_command.c @@ -332,6 +332,23 @@ struct db_command db_show_cmds[] = { { (char *)0, } }; +void +db_debug_all_traps_cmd(db_expr_t addr, + int have_addr, + db_expr_t count, + const char *modif); +void +db_debug_port_references_cmd(db_expr_t addr, + int have_addr, + db_expr_t count, + const char *modif); + +struct db_command db_debug_cmds[] = { + { "traps", db_debug_all_traps_cmd, 0, 0 }, + { "references", db_debug_port_references_cmd, 0, 0 }, + { (char *)0, } +}; + struct db_command db_command_table[] = { #ifdef DB_MACHINE_COMMANDS /* this must be the first entry, if it exists */ @@ -364,6 +381,7 @@ struct db_command db_command_table[] = { { "macro", db_def_macro_cmd, CS_OWN, 0 }, { "dmacro", db_del_macro_cmd, CS_OWN, 0 }, { "show", 0, 0, db_show_cmds }, + { "debug", 0, 0, db_debug_cmds }, { "reset", db_reset_cpu, 0, 0 }, { "reboot", db_reset_cpu, 0, 0 }, { "halt", db_halt_cpu, 0, 0 }, @@ -538,4 +556,32 @@ db_option(modif, option) return(FALSE); } +void +db_debug_all_traps_cmd(db_expr_t addr, + int have_addr, + db_expr_t count, + const char *modif) +{ + if (strcmp (modif, "on") == 0) + db_debug_all_traps (TRUE); + else if (strcmp (modif, "off") == 0) + db_debug_all_traps (FALSE); + else + db_error ("debug traps /on|/off\n"); +} + +void +db_debug_port_references_cmd(db_expr_t addr, + int have_addr, + db_expr_t count, + const char *modif) +{ + if (strcmp (modif, "on") == 0) + db_debug_port_references (TRUE); + else if (strcmp (modif, "off") == 0) + db_debug_port_references (FALSE); + else + db_error ("debug references /on|/off\n"); +} + #endif /* MACH_KDB */ -- cgit v1.2.3