summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Ramesa <marin.ramesa@gmail.com>2013-07-06 14:11:29 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-07-06 22:56:34 +0200
commit681d4080940819dc522e61369f199577c2819367 (patch)
treecb12278e243bbf426f3ae92393d2de9c70e2897b
parent89701c6b02abcdfed54277ed5dd388d954621043 (diff)
ddb: cleanup db_command.c
* ddb/db_write_cmd.h: New file. (db_write_cmd): Add prototype. Include <mach/boolean.h>. Include <machine/db_machdep.h>. * ddb/db_break.h (db_listbreak_cmd): Add prototype. (db_delete_cmd): Likewise. (db_breakpoint_cmd): Likewise. * ddb/db_watch.h (db_listwatch_cmd): Likewise. (db_deletewatch_cmd): Likewise. (db_watchpoint_cmd): Likewise. * ddb/db_print.h (db_show_one_thread): Likewise. (db_show_all_threads): Likewise. * ddb/db_examine.h (db_print_cmd): Likewise. (db_examine_forward): Likewise. (db_examine_backward): Likewise. (db_search_cmd): Likewise. * ddb/db_variables.h (db_set_cmd): Likewise. * ddb/db_run.h (db_trace_until_call_cmd): Likewise. (db_trace_until_matching_cmd): Likewise. (db_continue_cmd): Likewise. * ddb/db_command.h (db_fncall): Likewise. * ddb/db_command.c: Include <ddb/db_break.h>. Include <ddb/db_watch.h>. Include <ddb/db_variables.h>. Include <ddb/db_write_cmd.h>. Include <ddb/db_run.h>. Include <ddb/db_cond.h>. (db_listbreak_cmd): Remove prototype. (db_listwatch_cmd): Likewise. (db_show_one_thread): Likewise. (db_show_all_threads): Likewise. (db_show_macro): Likewise. (db_show_help): Likewise. (db_print_cmd): Likewise. (db_examine_cmd): Likewise. (db_set_cmd): Likewise. (db_examine_forward): Likewise. (db_examine_backward): Likewise. (db_search_cmd): Likewise. (db_write_cmd): Likewise. (db_delete_cmd): Likewise. (db_breakpoint_cmd): Likewise. (db_deletewatch_cmd): Likewise. (db_watchpoint_cmd): Likewise. (db_single_step_cmd): Likewise. (db_trace_until_call_cmd): Likewise. (db_trace_until_matching_cmd): Likewise. (db_continue_cmd): Likewise. (db_cond_cmd): Likewise. (db_help_cmd): Likewise. (db_def_macro_cmd): Likewise. (db_del_macro_cmd): Likewise. (db_fncall): Likewise.
-rw-r--r--ddb/db_break.h10
-rw-r--r--ddb/db_command.c37
-rw-r--r--ddb/db_command.h2
-rw-r--r--ddb/db_examine.h16
-rw-r--r--ddb/db_print.h12
-rw-r--r--ddb/db_run.h18
-rw-r--r--ddb/db_variables.h2
-rw-r--r--ddb/db_watch.h14
-rw-r--r--ddb/db_write_cmd.h16
9 files changed, 97 insertions, 30 deletions
diff --git a/ddb/db_break.h b/ddb/db_break.h
index 20d74d2..89e7889 100644
--- a/ddb/db_break.h
+++ b/ddb/db_break.h
@@ -88,4 +88,14 @@ extern db_breakpoint_t db_set_breakpoint(task_t task, db_addr_t addr,
int count, thread_t thread,
boolean_t task_bpt);
+void db_listbreak_cmd();
+
+void db_delete_cmd();
+
+void db_breakpoint_cmd(
+ db_expr_t addr,
+ int have_addr,
+ db_expr_t count,
+ char * modif);
+
#endif /* _DDB_DB_BREAK_H_ */
diff --git a/ddb/db_command.c b/ddb/db_command.c
index bcc507d..c032172 100644
--- a/ddb/db_command.c
+++ b/ddb/db_command.c
@@ -46,6 +46,12 @@
#include <ddb/db_expr.h>
#include <ddb/db_examine.h>
#include <ddb/db_print.h>
+#include <ddb/db_break.h>
+#include <ddb/db_watch.h>
+#include <ddb/db_variables.h>
+#include <ddb/db_write_cmd.h>
+#include <ddb/db_run.h>
+#include <ddb/db_cond.h>
#include <machine/setjmp.h>
#include <kern/debug.h>
@@ -300,16 +306,10 @@ db_command_list(last_cmdp, cmd_table)
/*
* 'show' commands
*/
-extern void db_listbreak_cmd();
-extern void db_listwatch_cmd();
-extern void db_show_one_thread();
-extern void db_show_all_threads();
-extern void db_show_macro();
extern void vm_map_print(), vm_object_print(), vm_page_print();
extern void vm_map_copy_print();
extern void ipc_port_print(), ipc_pset_print(), db_show_all_slocks();
extern void ipc_kmsg_print(), ipc_msg_print();
-void db_show_help();
struct db_command db_show_all_cmds[] = {
{ "threads", db_show_all_threads, 0, 0 },
@@ -337,18 +337,7 @@ struct db_command db_show_cmds[] = {
{ (char *)0, }
};
-extern void db_print_cmd(), db_examine_cmd(), db_set_cmd();
-extern void db_examine_forward(), db_examine_backward();
-extern void db_search_cmd();
-extern void db_write_cmd();
-extern void db_delete_cmd(), db_breakpoint_cmd();
-extern void db_deletewatch_cmd(), db_watchpoint_cmd();
-extern void db_single_step_cmd(), db_trace_until_call_cmd(),
- db_trace_until_matching_cmd(), db_continue_cmd();
-extern void db_stack_trace_cmd(), db_cond_cmd();
-void db_help_cmd();
-void db_def_macro_cmd(), db_del_macro_cmd();
-void db_fncall();
+extern void db_stack_trace_cmd();
extern void db_reset_cpu();
struct db_command db_command_table[] = {
@@ -404,18 +393,6 @@ struct db_command *ptr;
struct db_command *db_last_command = 0;
-void
-db_help_cmd()
-{
- struct db_command *cmd = db_command_table;
-
- while (cmd->name != 0) {
- db_printf("%-12s", cmd->name);
- db_end_line();
- cmd++;
- }
-}
-
int (*ddb_display)();
void
diff --git a/ddb/db_command.h b/ddb/db_command.h
index 1c0d106..3ed1fb9 100644
--- a/ddb/db_command.h
+++ b/ddb/db_command.h
@@ -68,4 +68,6 @@ struct db_command {
extern boolean_t db_exec_cmd_nest(char *cmd, int size);
+void db_fncall();
+
#endif /* MACH_KDB */
diff --git a/ddb/db_examine.h b/ddb/db_examine.h
index 197f397..e1fb1ee 100644
--- a/ddb/db_examine.h
+++ b/ddb/db_examine.h
@@ -39,6 +39,18 @@ extern void db_examine (
int count,
task_t task);
+void db_examine_forward(
+ db_expr_t addr,
+ int have_addr,
+ db_expr_t count,
+ char * modif);
+
+void db_examine_backward(
+ db_expr_t addr,
+ int have_addr,
+ db_expr_t count,
+ char * modif);
+
extern void db_print_loc_and_inst (
db_addr_t loc,
task_t task);
@@ -49,4 +61,8 @@ int db_xcdump(
int count,
task_t task);
+void db_print_cmd();
+
+void db_search_cmd();
+
#endif /* _DDB_DB_EXAMINE_H_ */
diff --git a/ddb/db_print.h b/ddb/db_print.h
index 5f7a146..898014e 100644
--- a/ddb/db_print.h
+++ b/ddb/db_print.h
@@ -32,6 +32,18 @@ void db_show_port_id(
db_expr_t count,
char * modif);
+void db_show_one_thread(
+ db_expr_t addr,
+ int have_addr,
+ db_expr_t count,
+ char * modif);
+
+void db_show_all_threads(
+ db_expr_t addr,
+ int have_addr,
+ db_expr_t count,
+ char * modif);
+
db_addr_t db_task_from_space(
ipc_space_t space,
int *task_id);
diff --git a/ddb/db_run.h b/ddb/db_run.h
index 31c0e37..e138f60 100644
--- a/ddb/db_run.h
+++ b/ddb/db_run.h
@@ -47,4 +47,22 @@ extern void db_single_step_cmd(
db_expr_t count,
char *modif);
+void db_trace_until_call_cmd(
+ db_expr_t addr,
+ int have_addr,
+ db_expr_t count,
+ char * modif);
+
+void db_trace_until_matching_cmd(
+ db_expr_t addr,
+ int have_addr,
+ db_expr_t count,
+ char * modif);
+
+void db_continue_cmd(
+ db_expr_t addr,
+ int have_addr,
+ db_expr_t count,
+ char * modif);
+
extern boolean_t db_in_single_step(void);
diff --git a/ddb/db_variables.h b/ddb/db_variables.h
index 5249d18..af7068f 100644
--- a/ddb/db_variables.h
+++ b/ddb/db_variables.h
@@ -80,4 +80,6 @@ extern struct db_variable *db_eregs;
extern int db_get_variable(db_expr_t *valuep);
+void db_set_cmd();
+
#endif /* _DB_VARIABLES_H_ */
diff --git a/ddb/db_watch.h b/ddb/db_watch.h
index a7acb39..fb95ae5 100644
--- a/ddb/db_watch.h
+++ b/ddb/db_watch.h
@@ -57,6 +57,20 @@ extern void db_set_watchpoint(task_t task, db_addr_t addr, vm_size_t size);
extern void db_delete_watchpoint(task_t task, db_addr_t addr);
extern void db_list_watchpoints(void);
+void db_listwatch_cmd();
+
+void db_deletewatch_cmd(
+ db_expr_t addr,
+ int have_addr,
+ db_expr_t count,
+ char * modif);
+
+void db_watchpoint_cmd(
+ db_expr_t addr,
+ int have_addr,
+ db_expr_t count,
+ char * modif);
+
#endif /* _DDB_DB_WATCH_ */
#endif /* MACH_KDB */
diff --git a/ddb/db_write_cmd.h b/ddb/db_write_cmd.h
new file mode 100644
index 0000000..74bac54
--- /dev/null
+++ b/ddb/db_write_cmd.h
@@ -0,0 +1,16 @@
+#ifndef _DDB_DB_WRITE_CMD_H_
+#define _DDB_DB_WRITE_CMD_H_
+
+#include <mach/boolean.h>
+#include <machine/db_machdep.h>
+
+/* Prototypes for functions exported by this module.
+ */
+
+void db_write_cmd(
+ db_expr_t address,
+ boolean_t have_addr,
+ db_expr_t count,
+ char * modif);
+
+#endif /* !_DDB_DB_WRITE_CMD_H_ */