I quote the project page: "For some of the internal header files (containing function prototypes and the like), it might actually be useful to use them. (And then get rid of a bunch of extern ... statements in other files.)".
So, I made a preliminary patch with db_print.h. I don't really know if this is an improvement over having extern statements in db_command.c. For example, I don't know how the compiler handles the two cases (extern in .c file compared to the prototype in a header file) in terms of improvement in the resulting object files. If this patch gets accepted I might continue to work on this, as db_command.c contains a lot of references to extern 'show' functions. It might be a good idea to have them all in db_print.h. I don't know if that would improve the readability of the code?
* ddb/db_command.c: Include db_print.h. Remove extern db_show_regs(). Remove extern db_show_one_task(). Remove extern db_show_port_id(). * ddb/db_print.c: Include db_print.h * ddb/db_print.h (db_show_all_acts): Remove prototype. (db_show_one_act): Likewise. (db_show_shuttle): Likewise. (db_show_one_task_vm): Likewise. (db_show_all_task_vm): Likewise. (db_show_one_space): Likewise. (db_show_all_spaces): Likewise. (db_sys): Likewise. (db_port_kmsg_count): Likewise. (db_show_one_simple_lock): Likewise. (db_show_one_mutex): Likewise. (db_show_subsystem): Likewise. (db_show_runq): Likewise.
diff -Nurp ../gnumach/ddb/db_command.c ../gnumach1/ddb/db_command.c --- ../gnumach/ddb/db_command.c 2013-06-28 10:10:49.865024564 +0200 +++ ../gnumach1/ddb/db_command.c 2013-07-02 10:33:05.618884106 +0200 @@ -45,6 +45,7 @@ #include <ddb/db_macro.h> #include <ddb/db_expr.h> #include <ddb/db_examine.h> +#include <ddb/db_print.h> #include <machine/setjmp.h> #include <kern/debug.h> @@ -301,14 +302,13 @@ db_command_list(last_cmdp, cmd_table) */ extern void db_listbreak_cmd(); extern void db_listwatch_cmd(); -extern void db_show_regs(), db_show_one_thread(), db_show_one_task(); +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(); -extern void db_show_port_id(); void db_show_help(); struct db_command db_show_all_cmds[] = { diff -Nurp ../gnumach/ddb/db_print.c ../gnumach1/ddb/db_print.c --- ../gnumach/ddb/db_print.c 2013-06-28 10:10:49.868024514 +0200 +++ ../gnumach1/ddb/db_print.c 2013-07-02 10:24:42.928837177 +0200 @@ -51,6 +51,7 @@ #include <ddb/db_variables.h> #include <ddb/db_sym.h> #include <ddb/db_task_thread.h> +#include <ddb/db_print.h> extern unsigned int db_maxoff; diff -Nurp ../gnumach/ddb/db_print.h ../gnumach1/ddb/db_print.h --- ../gnumach/ddb/db_print.h 2013-06-28 10:10:49.868024514 +0200 +++ ../gnumach1/ddb/db_print.h 2013-07-02 10:45:55.826039013 +0200 @@ -20,91 +20,20 @@ void db_show_regs( db_expr_t count, char *modif); -void db_show_all_acts( - db_expr_t addr, - boolean_t have_addr, - db_expr_t count, - char * modif); - -void db_show_one_act( - db_expr_t addr, - boolean_t have_addr, - db_expr_t count, - char * modif); - void db_show_one_task( db_expr_t addr, boolean_t have_addr, db_expr_t count, char * modif); -void db_show_shuttle( - db_expr_t addr, - boolean_t have_addr, - db_expr_t count, - char * modif); - void db_show_port_id( db_expr_t addr, boolean_t have_addr, db_expr_t count, char * modif); -void db_show_one_task_vm( - db_expr_t addr, - boolean_t have_addr, - db_expr_t count, - char *modif); - -void db_show_all_task_vm( - db_expr_t addr, - boolean_t have_addr, - db_expr_t count, - char *modif); - -void db_show_one_space( - db_expr_t addr, - boolean_t have_addr, - db_expr_t count, - char * modif); - -void db_show_all_spaces( - db_expr_t addr, - boolean_t have_addr, - db_expr_t count, - char * modif); - -void db_sys(void); - -int db_port_kmsg_count( - ipc_port_t port); - db_addr_t db_task_from_space( ipc_space_t space, int *task_id); -void db_show_one_simple_lock( - db_expr_t addr, - boolean_t have_addr, - db_expr_t count, - char * modif); - -void db_show_one_mutex( - db_expr_t addr, - boolean_t have_addr, - db_expr_t count, - char * modif); - -void db_show_subsystem( - db_expr_t addr, - boolean_t have_addr, - db_expr_t count, - char * modif); - -void db_show_runq( - db_expr_t addr, - boolean_t have_addr, - db_expr_t count, - char * modif); - #endif /* !_DDB_DB_PRINT_H_ */