diff options
author | Thomas Schwinge <tschwinge@gnu.org> | 2007-01-06 14:27:21 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2009-06-18 00:27:01 +0200 |
commit | 3527b78c645a5898c7ddbeb3128a49c21514cb1c (patch) | |
tree | 98a1f9e14c75fff57920ec7df65322e8b813e64b | |
parent | dd445ab906de464eaee2b45f1722fa27a886b591 (diff) |
2006-01-06 Thomas Schwinge <tschwinge@gnu.org>
* ddb/db_break.c (db_delete_thread_breakpoint): Don't declare
`db_cond_free'.
* ddb/db_run.c: Include <ddb/db_cond.h>.
(db_stop_at_pc): Don't declare `db_cond_check'.
* ddb/db_input.c: Include <ddb/db_input.h>.
* ddb/db_macro.c: Include <ddb/db_macro.h>.
* ddb/db_trap.c: Include <ddb/db_trap.h>.
* i386/i386/db_interface.h: Include <machine/thread.h>.
* i386/i386/db_interface.c: Include <machine/db_interface.h>.
* i386/i386/db_machdep.h: Include <machine/db_interface.h>.
(db_check_access, db_phys_eq, db_task_name): Remove declarations.
2006-01-06 Barry deFreese <bddebian@comcast.net>
* ddb/db_aout.c: Include <ddb/db_output.h>.
* ddb/db_break.c: Include <ddb/db_cond.h>, <ddb/db_expr.h> and
<ddb/db_output.h>.
(db_delete_cmd, db_breakpoint_cmd): Explicitly define untyped variables
as `int'.
* ddb/db_command.c: Include <ddb/db_examine.h>, <ddb/db_expr.h> and
<ddb/db_macro.h>.
* ddb/db_command.h (db_exec_cmd_nest): New declaration.
* ddb/db_cond.c: Include <ddb/db_cond.h>, <ddb/db_expr.h> and
<ddb/db_output.h>.
(db_cond_cmd): Explicitly define untyped variable as `int'.
* ddb/db_cond.h: New file.
* ddb/db_examine.c: Include <machine/db_interface.h>,
<ddb/db_examine.h> and <ddb/db_expr.h>.
(db_strcpy, db_examine): Remove forward declarations.
(db_xcdump): Explicitly define untyped variables as `int'.
* ddb/db_examine.h: New file.
* ddb/db_expr.c: Include <ddb/db_expr.h>, <ddb/db_output.h>,
<ddb/db_sym.h> and <ddb/db_variables.h>.
* ddb/db_input.c: Include <ddb/db_command.h>.
* ddb/db_input.h: New file.
* ddb/db_lex.c: Include <ddb/db_command.h>, <ddb/db_examine.h>,
<ddb/db_input.h> and <ddb/db_output.h>.
(db_skip_to_eol, db_lex): Explicitly define untyped variables as `int'.
* ddb/db_lex.h (db_lex): New declaration.
* ddb/db_macro.c: Include <ddb/db_examine.h>, <ddb/db_expr.h> and
<ddb/db_output.h>.
(db_def_macro_cmd, db_exec_macro): Explicitly define untyped variables
as `int'.
* ddb/db_macro.h: New file.
* ddb/db_output.c: Include <ddb/db_command.h>.
* ddb/db_output.h (db_putchar): New declaration.
* ddb/db_print.c: Include <machine/db_interface.h>, <ddb/db_command.h>
and <ddb/db_output.h>.
(db_show_regs): Explicitly define untyped variables as `int'.
* ddb/db_run.c: Include <ddb/db_command.h>, <ddb/db_examine.h>,
<ddb/db_output.h> and <ddb/db_watch.h>.
* ddb/db_run.h: Include <kern/task.h> and <machine/db_machdep.h>.
(db_single_step, db_single_step_cmd, db_in_single_step): New
declarations.
* ddb/db_sym.c: Include <ddb/db_command.h> and <ddb/db_output.h>.
(db_sym_parse_and_lookup): Explicitly define untyped variables as
`int'.
* ddb/db_sym.h (db_line_at_pc): New declaration.
* ddb/db_task_thread.c: Include <ddb/db_command.h>, <ddb/db_expr.h>,
<ddb/db_lex.h> and <ddb/db_output.h>.
(db_lookup_task, db_lookup_task_thread, db_lookup_thread)
(db_lookup_task_id, db_lookup_thread_id): Explicitly define untyped
variables as `int'.
* ddb/db_trap.c: Include <ddb/db_examine.h> and <ddb/db_output.h>.
* ddb/db_trap.h: New file.
* ddb/db_variables.c: Include <ddb/db_command.h>, <ddb/db_examine.h>,
<ddb/db_expr.h> and <ddb/db_output.h>.
(db_get_suffix, db_cmp_variable_name): Explicitly define untyped
variables as `int'.
* ddb/db_variables.h (db_get_variable): New declaration.
* ddb/db_watch.c: Include <ddb/db_command.h>, <ddb/db_expr.h>,
<ddb/db_output.h> and <ddb/db_run.h>.
* ddb/db_write_cmd.c: Include <ddb/db_expr.h> and <ddb/db_output.h>.
* i386/i386/db_interface.c: Include <kern/printf.h>, <ddb/db_access.h>,
<ddb/db_command.h>, <ddb/db_output.h>, <ddb/db_run.h> and
<ddb/db_trap.h>.
(kdbprinttrap): Add `void' return type.
(db_user_to_kernel_address, db_task_name): Explicitly define untyped
variables as `int'.
* i386/i386/db_interface.h: New file.
* i386/i386/db_trace.c (db_i386_reg_value): Add `int' return type.
* i386/i386/trap.c [MACH_KDB]: Include <ddb/db_run.h> and
<ddb/db_watch.h>.
* ipc/ipc_kmsg.c [MACH_KDB]: Include <ddb/db_output.h>.
* kern/lock.c [MACH_KDB]: Include <ddb/db_output.h>.
37 files changed, 457 insertions, 40 deletions
@@ -1,3 +1,91 @@ +2006-01-06 Thomas Schwinge <tschwinge@gnu.org> + + * ddb/db_break.c (db_delete_thread_breakpoint): Don't declare + `db_cond_free'. + * ddb/db_run.c: Include <ddb/db_cond.h>. + (db_stop_at_pc): Don't declare `db_cond_check'. + * ddb/db_input.c: Include <ddb/db_input.h>. + * ddb/db_macro.c: Include <ddb/db_macro.h>. + * ddb/db_trap.c: Include <ddb/db_trap.h>. + * i386/i386/db_interface.h: Include <machine/thread.h>. + * i386/i386/db_interface.c: Include <machine/db_interface.h>. + * i386/i386/db_machdep.h: Include <machine/db_interface.h>. + (db_check_access, db_phys_eq, db_task_name): Remove declarations. + +2006-01-06 Barry deFreese <bddebian@comcast.net> + + * ddb/db_aout.c: Include <ddb/db_output.h>. + * ddb/db_break.c: Include <ddb/db_cond.h>, <ddb/db_expr.h> and + <ddb/db_output.h>. + (db_delete_cmd, db_breakpoint_cmd): Explicitly define untyped variables + as `int'. + * ddb/db_command.c: Include <ddb/db_examine.h>, <ddb/db_expr.h> and + <ddb/db_macro.h>. + * ddb/db_command.h (db_exec_cmd_nest): New declaration. + * ddb/db_cond.c: Include <ddb/db_cond.h>, <ddb/db_expr.h> and + <ddb/db_output.h>. + (db_cond_cmd): Explicitly define untyped variable as `int'. + * ddb/db_cond.h: New file. + * ddb/db_examine.c: Include <machine/db_interface.h>, + <ddb/db_examine.h> and <ddb/db_expr.h>. + (db_strcpy, db_examine): Remove forward declarations. + (db_xcdump): Explicitly define untyped variables as `int'. + * ddb/db_examine.h: New file. + * ddb/db_expr.c: Include <ddb/db_expr.h>, <ddb/db_output.h>, + <ddb/db_sym.h> and <ddb/db_variables.h>. + * ddb/db_input.c: Include <ddb/db_command.h>. + * ddb/db_input.h: New file. + * ddb/db_lex.c: Include <ddb/db_command.h>, <ddb/db_examine.h>, + <ddb/db_input.h> and <ddb/db_output.h>. + (db_skip_to_eol, db_lex): Explicitly define untyped variables as `int'. + * ddb/db_lex.h (db_lex): New declaration. + * ddb/db_macro.c: Include <ddb/db_examine.h>, <ddb/db_expr.h> and + <ddb/db_output.h>. + (db_def_macro_cmd, db_exec_macro): Explicitly define untyped variables + as `int'. + * ddb/db_macro.h: New file. + * ddb/db_output.c: Include <ddb/db_command.h>. + * ddb/db_output.h (db_putchar): New declaration. + * ddb/db_print.c: Include <machine/db_interface.h>, <ddb/db_command.h> + and <ddb/db_output.h>. + (db_show_regs): Explicitly define untyped variables as `int'. + * ddb/db_run.c: Include <ddb/db_command.h>, <ddb/db_examine.h>, + <ddb/db_output.h> and <ddb/db_watch.h>. + * ddb/db_run.h: Include <kern/task.h> and <machine/db_machdep.h>. + (db_single_step, db_single_step_cmd, db_in_single_step): New + declarations. + * ddb/db_sym.c: Include <ddb/db_command.h> and <ddb/db_output.h>. + (db_sym_parse_and_lookup): Explicitly define untyped variables as + `int'. + * ddb/db_sym.h (db_line_at_pc): New declaration. + * ddb/db_task_thread.c: Include <ddb/db_command.h>, <ddb/db_expr.h>, + <ddb/db_lex.h> and <ddb/db_output.h>. + (db_lookup_task, db_lookup_task_thread, db_lookup_thread) + (db_lookup_task_id, db_lookup_thread_id): Explicitly define untyped + variables as `int'. + * ddb/db_trap.c: Include <ddb/db_examine.h> and <ddb/db_output.h>. + * ddb/db_trap.h: New file. + * ddb/db_variables.c: Include <ddb/db_command.h>, <ddb/db_examine.h>, + <ddb/db_expr.h> and <ddb/db_output.h>. + (db_get_suffix, db_cmp_variable_name): Explicitly define untyped + variables as `int'. + * ddb/db_variables.h (db_get_variable): New declaration. + * ddb/db_watch.c: Include <ddb/db_command.h>, <ddb/db_expr.h>, + <ddb/db_output.h> and <ddb/db_run.h>. + * ddb/db_write_cmd.c: Include <ddb/db_expr.h> and <ddb/db_output.h>. + * i386/i386/db_interface.c: Include <kern/printf.h>, <ddb/db_access.h>, + <ddb/db_command.h>, <ddb/db_output.h>, <ddb/db_run.h> and + <ddb/db_trap.h>. + (kdbprinttrap): Add `void' return type. + (db_user_to_kernel_address, db_task_name): Explicitly define untyped + variables as `int'. + * i386/i386/db_interface.h: New file. + * i386/i386/db_trace.c (db_i386_reg_value): Add `int' return type. + * i386/i386/trap.c [MACH_KDB]: Include <ddb/db_run.h> and + <ddb/db_watch.h>. + * ipc/ipc_kmsg.c [MACH_KDB]: Include <ddb/db_output.h>. + * kern/lock.c [MACH_KDB]: Include <ddb/db_output.h>. + 2007-01-06 Thomas Schwinge <tschwinge@gnu.org> * configure.ac (AM_INIT_AUTOMAKE): Add ``-Wall -Wno-portability''. diff --git a/ddb/db_aout.c b/ddb/db_aout.c index 03c9790..b55a4a1 100644 --- a/ddb/db_aout.c +++ b/ddb/db_aout.c @@ -37,6 +37,7 @@ #include <string.h> #include <mach/std_types.h> #include <machine/db_machdep.h> /* data types */ +#include <ddb/db_output.h> #include <ddb/db_sym.h> #ifndef DB_NO_AOUT diff --git a/ddb/db_break.c b/ddb/db_break.c index 777ad34..f07e2cc 100644 --- a/ddb/db_break.c +++ b/ddb/db_break.c @@ -43,6 +43,9 @@ #include <ddb/db_variables.h> #include <ddb/db_command.h> #include <ddb/db_task_thread.h> +#include <ddb/db_output.h> +#include <ddb/db_cond.h> +#include <ddb/db_expr.h> #define NBREAKPOINTS 100 #define NTHREAD_LIST (NBREAKPOINTS*3) @@ -122,7 +125,6 @@ db_delete_thread_breakpoint(bkpt, task_thd) { register db_thread_breakpoint_t tp; register db_thread_breakpoint_t *tpp; - void db_cond_free(); if (task_thd == 0) { /* delete all the thread-breakpoints */ @@ -594,7 +596,7 @@ db_list_breakpoints() void db_delete_cmd() { - register n; + register int n; thread_t thread; vm_offset_t task_thd; boolean_t user_global = FALSE; @@ -677,7 +679,7 @@ db_breakpoint_cmd(addr, have_addr, count, modif) db_expr_t count; char * modif; { - register n; + register int n; thread_t thread; boolean_t user_global = db_option(modif, 'U'); boolean_t task_bpt = db_option(modif, 'T'); diff --git a/ddb/db_command.c b/ddb/db_command.c index f4b8bec..ec46ba4 100644 --- a/ddb/db_command.c +++ b/ddb/db_command.c @@ -42,6 +42,9 @@ #include <ddb/db_output.h> #include <ddb/db_command.h> #include <ddb/db_task_thread.h> +#include <ddb/db_macro.h> +#include <ddb/db_expr.h> +#include <ddb/db_examine.h> #include <machine/setjmp.h> #include <kern/debug.h> diff --git a/ddb/db_command.h b/ddb/db_command.h index 58309b5..7870baa 100644 --- a/ddb/db_command.h +++ b/ddb/db_command.h @@ -67,4 +67,6 @@ struct db_command { struct db_command *more; /* another level of command */ }; +extern boolean_t db_exec_cmd_nest(char *cmd, int size); + #endif /* MACH_KDB */ diff --git a/ddb/db_cond.c b/ddb/db_cond.c index 9440cb6..60ea473 100644 --- a/ddb/db_cond.c +++ b/ddb/db_cond.c @@ -32,6 +32,9 @@ #include <ddb/db_lex.h> #include <ddb/db_break.h> #include <ddb/db_command.h> +#include <ddb/db_cond.h> +#include <ddb/db_expr.h> +#include <ddb/db_output.h> #include <kern/debug.h> @@ -122,7 +125,7 @@ db_cond_print(bkpt) void db_cond_cmd() { - register c; + register int c; register struct db_cond *cp; register char *p; db_expr_t value; diff --git a/ddb/db_cond.h b/ddb/db_cond.h new file mode 100644 index 0000000..dec4967 --- /dev/null +++ b/ddb/db_cond.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2007 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ + +#ifndef _DDB_DB_COND_H_ +#define _DDB_DB_COND_H_ + +#include <sys/types.h> +#include <machine/db_machdep.h> + +extern void db_cond_free (db_thread_breakpoint_t bkpt); + +extern boolean_t db_cond_check (db_thread_breakpoint_t bkpt); + +extern void db_cond_print (db_thread_breakpoint_t bkpt); + +extern void db_cond_cmd (void); + +#endif /* _DDB_DB_COND_H_ */ diff --git a/ddb/db_examine.c b/ddb/db_examine.c index 0881df7..889a5b0 100644 --- a/ddb/db_examine.c +++ b/ddb/db_examine.c @@ -32,6 +32,7 @@ #include <mach/boolean.h> #include <machine/db_machdep.h> +#include <machine/db_interface.h> #include <ddb/db_access.h> #include <ddb/db_lex.h> @@ -39,6 +40,8 @@ #include <ddb/db_command.h> #include <ddb/db_sym.h> #include <ddb/db_task_thread.h> +#include <ddb/db_examine.h> +#include <ddb/db_expr.h> #include <kern/thread.h> #include <kern/task.h> #include <mach/vm_param.h> @@ -53,9 +56,6 @@ thread_t db_examine_thread = THREAD_NULL; extern db_addr_t db_disasm(db_addr_t pc, boolean_t altform, task_t task); /* instruction disassembler */ -void db_examine();/*forwards*/ -void db_strcpy(); - /* * Examine (print) data. */ @@ -458,7 +458,7 @@ db_xcdump(addr, size, count, task) int count; task_t task; { - register i, n; + register int i, n; db_expr_t value; int bcount; db_addr_t off; diff --git a/ddb/db_examine.h b/ddb/db_examine.h new file mode 100644 index 0000000..96ad719 --- /dev/null +++ b/ddb/db_examine.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2007 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ + +#ifndef _DDB_DB_EXAMINE_H_ +#define _DDB_DB_EXAMINE_H_ + +#include <sys/types.h> +#include <ddb/db_variables.h> +#include <ddb/db_expr.h> + +extern void db_examine_cmd ( + db_expr_t addr, + int have_addr, + db_expr_t count, + char *modif); + +extern void db_strcpy (char *dst, char *src); + +extern void db_examine ( + db_addr_t addr, + char *fmt, + int count, + task_t task); + +extern void db_print_loc_and_inst ( + db_addr_t loc, + task_t task); + +#endif /* _DDB_DB_EXAMINE_H_ */ diff --git a/ddb/db_expr.c b/ddb/db_expr.c index d10f1bc..611baa0 100644 --- a/ddb/db_expr.c +++ b/ddb/db_expr.c @@ -35,6 +35,10 @@ #include <ddb/db_lex.h> #include <ddb/db_access.h> #include <ddb/db_command.h> +#include <ddb/db_expr.h> +#include <ddb/db_output.h> +#include <ddb/db_sym.h> +#include <ddb/db_variables.h> #include <kern/task.h> diff --git a/ddb/db_input.c b/ddb/db_input.c index 6e8e240..ce6a310 100644 --- a/ddb/db_input.c +++ b/ddb/db_input.c @@ -32,10 +32,10 @@ #include <mach/boolean.h> #include <machine/db_machdep.h> +#include <ddb/db_command.h> +#include <ddb/db_input.h> #include <ddb/db_output.h> - - #ifndef DB_HISTORY_SIZE #define DB_HISTORY_SIZE 4000 #endif /* DB_HISTORY_SIZE */ diff --git a/ddb/db_input.h b/ddb/db_input.h new file mode 100644 index 0000000..316e326 --- /dev/null +++ b/ddb/db_input.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2007 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ + +#ifndef _DDB_DB_INPUT_H_ +#define _DDB_DB_INPUT_H_ + +#include <sys/types.h> + +extern int db_readline (char *lstart, int lsize); + +#endif /* _DDB_DB_INPUT_H_ */ diff --git a/ddb/db_lex.c b/ddb/db_lex.c index 3d05404..88ac212 100644 --- a/ddb/db_lex.c +++ b/ddb/db_lex.c @@ -35,7 +35,11 @@ */ #include <string.h> #include <machine/db_machdep.h> +#include <ddb/db_command.h> +#include <ddb/db_examine.h> +#include <ddb/db_input.h> #include <ddb/db_lex.h> +#include <ddb/db_output.h> char db_line[DB_LEX_LINE_SIZE]; char db_last_line[DB_LEX_LINE_SIZE]; @@ -175,9 +179,9 @@ db_flush_lex() void db_skip_to_eol() { - register skip; - register t; - register n; + register int skip; + register int t; + register int n; register char *p; t = db_read_token(); @@ -202,7 +206,7 @@ int db_lex() { register char *cp; - register c; + register int c; c = db_read_char(); while (c <= ' ' || c > '~') { diff --git a/ddb/db_lex.h b/ddb/db_lex.h index c73b93e..3cb9ae6 100644 --- a/ddb/db_lex.h +++ b/ddb/db_lex.h @@ -41,6 +41,7 @@ struct db_lex_context { char *l_eptr; /* line end pointer */ }; +extern int db_lex(); extern int db_read_line(/* char *rep_str */); extern void db_flush_line(); extern int db_read_char(); diff --git a/ddb/db_macro.c b/ddb/db_macro.c index 83c30ce..e372c23 100644 --- a/ddb/db_macro.c +++ b/ddb/db_macro.c @@ -33,7 +33,10 @@ #include <ddb/db_lex.h> #include <ddb/db_variables.h> #include <ddb/db_command.h> - +#include <ddb/db_examine.h> +#include <ddb/db_expr.h> +#include <ddb/db_macro.h> +#include <ddb/db_output.h> /* @@ -73,7 +76,7 @@ void db_def_macro_cmd() { register char *p; - register c; + register int c; register struct db_user_macro *mp, *ep; if (db_read_token() != tIDENT) { @@ -141,7 +144,7 @@ db_exec_macro(name) char *name; { register struct db_user_macro *mp; - register n; + register int n; if ((mp = db_lookup_macro(name)) == 0) return(-1); diff --git a/ddb/db_macro.h b/ddb/db_macro.h new file mode 100644 index 0000000..12ed16e --- /dev/null +++ b/ddb/db_macro.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2007 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ + +#ifndef _DDB_DB_MACRO_H_ +#define _DDB_DB_MACRO_H_ + +#include <sys/types.h> +#include <ddb/db_variables.h> + +extern void db_def_macro_cmd (void); + +extern void db_del_macro_cmd (void); + +extern void db_show_macro (void); + +extern int db_exec_macro (char *name); + +extern int db_arg_variable ( + struct db_variable *vp, + db_expr_t *valuep, + int flag, + db_var_aux_param_t ap); + +#endif /* _DDB_DB_MACRO_H_ */ diff --git a/ddb/db_output.c b/ddb/db_output.c index 6433901..44a71ab 100644 --- a/ddb/db_output.c +++ b/ddb/db_output.c @@ -38,6 +38,7 @@ #include <stdarg.h> #include <mach/boolean.h> #include <machine/db_machdep.h> +#include <ddb/db_command.h> #include <ddb/db_lex.h> #include <ddb/db_output.h> diff --git a/ddb/db_output.h b/ddb/db_output.h index b19f64d..6667d19 100644 --- a/ddb/db_output.h +++ b/ddb/db_output.h @@ -36,5 +36,5 @@ extern void db_force_whitespace(); extern int db_print_position(); extern void db_end_line(); extern void db_printf( const char *fmt, ...); - +extern void db_putchar(int c); diff --git a/ddb/db_print.c b/ddb/db_print.c index e9d8e4b..5d0f150 100644 --- a/ddb/db_print.c +++ b/ddb/db_print.c @@ -41,9 +41,12 @@ #include <ipc/ipc_port.h> #include <ipc/ipc_space.h> +#include <machine/db_interface.h> #include <machine/db_machdep.h> #include <machine/thread.h> +#include <ddb/db_command.h> +#include <ddb/db_output.h> #include <ddb/db_lex.h> #include <ddb/db_variables.h> #include <ddb/db_sym.h> @@ -63,7 +66,7 @@ db_show_regs(addr, have_addr, count, modif) db_expr_t value; db_addr_t offset; char * name; - register i; + register int i; struct db_var_aux_param aux_param; task_t task = TASK_NULL; diff --git a/ddb/db_run.c b/ddb/db_run.c index 8769523..53a02ce 100644 --- a/ddb/db_run.c +++ b/ddb/db_run.c @@ -41,6 +41,12 @@ #include <ddb/db_access.h> #include <ddb/db_run.h> #include <ddb/db_task_thread.h> +#include <ddb/db_command.h> +#include <ddb/db_examine.h> +#include <ddb/db_output.h> +#include <ddb/db_watch.h> +#include <ddb/db_cond.h> + int db_run_mode; @@ -71,7 +77,6 @@ db_stop_at_pc(is_breakpoint, task) { register db_addr_t pc; register db_thread_breakpoint_t bkpt; - boolean_t db_cond_check(); db_clear_task_single_step(DDB_REGS, task); db_clear_breakpoints(); diff --git a/ddb/db_run.h b/ddb/db_run.h index fcc8ece..31c0e37 100644 --- a/ddb/db_run.h +++ b/ddb/db_run.h @@ -24,6 +24,9 @@ * the rights to redistribute these changes. */ +#include <kern/task.h> +#include <machine/db_machdep.h> + extern int db_run_mode; /* modes the system may be running in */ @@ -35,3 +38,13 @@ extern int db_run_mode; #define STEP_CONTINUE 4 #define STEP_INVISIBLE 5 #define STEP_COUNT 6 + +extern void db_single_step(db_regs_t *regs, task_t task); + +extern void db_single_step_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_sym.c b/ddb/db_sym.c index cd4632f..be839fd 100644 --- a/ddb/db_sym.c +++ b/ddb/db_sym.c @@ -33,6 +33,8 @@ #include <string.h> #include <mach/std_types.h> #include <machine/db_machdep.h> +#include <ddb/db_command.h> +#include <ddb/db_output.h> #include <ddb/db_sym.h> #include <ddb/db_task_thread.h> @@ -194,7 +196,7 @@ db_sym_parse_and_lookup(func, symtab, symstr) char *symstr; { register char *p; - register n; + register int n; int n_name; int line_number; char *file_name = 0; diff --git a/ddb/db_sym.h b/ddb/db_sym.h index dd320b7..c2d5fec 100644 --- a/ddb/db_sym.h +++ b/ddb/db_sym.h @@ -198,3 +198,10 @@ extern struct db_sym_switch { #define X_db_search_symbol(s,o,t,d) x_db[(s)->type].search_symbol(s,o,t,d) #define X_db_line_at_pc(s,p,f,l,a) x_db[(s)->type].line_at_pc(s,p,f,l,a) #define X_db_symbol_values(s,p,n,v) x_db[(s)->type].symbol_values(p,n,v) + +extern boolean_t db_line_at_pc( + db_sym_t sym, + char **filename, + int *linenum, + db_expr_t pc); + diff --git a/ddb/db_task_thread.c b/ddb/db_task_thread.c index f4dfaf2..ba101fb 100644 --- a/ddb/db_task_thread.c +++ b/ddb/db_task_thread.c @@ -27,6 +27,10 @@ #if MACH_KDB #include <machine/db_machdep.h> +#include <ddb/db_command.h> +#include <ddb/db_expr.h> +#include <ddb/db_lex.h> +#include <ddb/db_output.h> #include <ddb/db_task_thread.h> #include <ddb/db_variables.h> @@ -51,9 +55,9 @@ db_lookup_task(target_task) task_t target_task; { register task_t task; - register task_id; + register int task_id; register processor_set_t pset; - register npset = 0; + register int npset = 0; task_id = 0; if (queue_first(&all_psets) == 0) @@ -82,7 +86,7 @@ db_lookup_task_thread(task, target_thread) thread_t target_thread; { register thread_t thread; - register thread_id; + register int thread_id; thread_id = 0; if (queue_first(&task->thread_list) == 0) @@ -104,11 +108,11 @@ int db_lookup_thread(target_thread) thread_t target_thread; { - register thread_id; + register int thread_id; register task_t task; register processor_set_t pset; - register ntask = 0; - register npset = 0; + register int ntask = 0; + register int npset = 0; if (queue_first(&all_psets) == 0) return(-1); @@ -150,11 +154,11 @@ db_check_thread_address_valid(thread) */ task_t db_lookup_task_id(task_id) - register task_id; + register int task_id; { register task_t task; register processor_set_t pset; - register npset = 0; + register int npset = 0; if (task_id > DB_MAX_TASKID) return(TASK_NULL); @@ -179,7 +183,7 @@ db_lookup_task_id(task_id) static thread_t db_lookup_thread_id(task, thread_id) task_t task; - register thread_id; + register int thread_id; { register thread_t thread; diff --git a/ddb/db_trap.c b/ddb/db_trap.c index 44b4f4d..395a9b5 100644 --- a/ddb/db_trap.c +++ b/ddb/db_trap.c @@ -38,8 +38,10 @@ #include <ddb/db_command.h> #include <ddb/db_access.h> #include <ddb/db_break.h> +#include <ddb/db_examine.h> +#include <ddb/db_output.h> #include <ddb/db_task_thread.h> - +#include <ddb/db_trap.h> extern jmp_buf_t *db_recover; diff --git a/ddb/db_trap.h b/ddb/db_trap.h new file mode 100644 index 0000000..933fcd3 --- /dev/null +++ b/ddb/db_trap.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2007 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ + +#ifndef _DDB_DB_TRAP_H_ +#define _DDB_DB_TRAP_H_ + +#include <sys/types.h> +#include <machine/db_machdep.h> + +extern void db_task_trap ( + int type, + int code, + boolean_t user_space); + +extern void db_trap (int type, int code); + +#endif /* _DDB_DB_TRAP_H_ */ diff --git a/ddb/db_variables.c b/ddb/db_variables.c index 0f43396..55b8742 100644 --- a/ddb/db_variables.c +++ b/ddb/db_variables.c @@ -32,7 +32,11 @@ #include <machine/db_machdep.h> +#include <ddb/db_command.h> +#include <ddb/db_examine.h> +#include <ddb/db_expr.h> #include <ddb/db_lex.h> +#include <ddb/db_output.h> #include <ddb/db_variables.h> #include <ddb/db_task_thread.h> @@ -71,7 +75,7 @@ db_get_suffix(suffix, suffix_value) register char *suffix; short *suffix_value; { - register value; + register int value; for (value = 0; *suffix && *suffix != '.' && *suffix != ':'; suffix++) { if (*suffix < '0' || *suffix > '9') @@ -91,7 +95,7 @@ db_cmp_variable_name(vp, name, ap) register db_var_aux_param_t ap; { register char *var_np, *np; - register level; + register int level; for (np = name, var_np = vp->name; *var_np; ) { if (*np++ != *var_np++) diff --git a/ddb/db_variables.h b/ddb/db_variables.h index 8829aa9..b340c3d 100644 --- a/ddb/db_variables.h +++ b/ddb/db_variables.h @@ -75,4 +75,6 @@ extern struct db_variable *db_evars; extern struct db_variable db_regs[]; /* machine registers */ extern struct db_variable *db_eregs; +extern int db_get_variable(db_expr_t *valuep); + #endif /* _DB_VARIABLES_H_ */ diff --git a/ddb/db_watch.c b/ddb/db_watch.c index 22734fa..4450676 100644 --- a/ddb/db_watch.c +++ b/ddb/db_watch.c @@ -37,9 +37,13 @@ #include <vm/vm_map.h> #include <machine/db_machdep.h> +#include <ddb/db_command.h> #include <ddb/db_lex.h> #include <ddb/db_watch.h> #include <ddb/db_access.h> +#include <ddb/db_expr.h> +#include <ddb/db_output.h> +#include <ddb/db_run.h> #include <ddb/db_sym.h> #include <ddb/db_task_thread.h> diff --git a/ddb/db_write_cmd.c b/ddb/db_write_cmd.c index b10c74c..eacf53b 100644 --- a/ddb/db_write_cmd.c +++ b/ddb/db_write_cmd.c @@ -39,6 +39,8 @@ #include <ddb/db_lex.h> #include <ddb/db_access.h> #include <ddb/db_command.h> +#include <ddb/db_expr.h> +#include <ddb/db_output.h> #include <ddb/db_sym.h> #include <ddb/db_task_thread.h> diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c index f254776..cf1e1c4 100644 --- a/i386/i386/db_interface.c +++ b/i386/i386/db_interface.c @@ -45,9 +45,16 @@ #include "vm_param.h" #include <vm/vm_map.h> #include <kern/cpu_number.h> +#include <kern/printf.h> #include <kern/thread.h> #include <kern/task.h> +#include <ddb/db_access.h> +#include <ddb/db_command.h> +#include <ddb/db_output.h> +#include <ddb/db_run.h> #include <ddb/db_task_thread.h> +#include <ddb/db_trap.h> +#include <machine/db_interface.h> #include <machine/machspl.h> struct i386_saved_state *i386_last_saved_statep; @@ -59,6 +66,7 @@ extern thread_t db_default_thread; /* * Print trap reason. */ +void kdbprinttrap(type, code) int type, code; { @@ -258,7 +266,7 @@ int db_user_to_kernel_address( task_t task, vm_offset_t addr, - unsigned *kaddr, + unsigned int *kaddr, int flag) { register pt_entry_t *ptp; @@ -518,7 +526,7 @@ db_task_name( task_t task) { register char *p; - register n; + register int n; unsigned vaddr, kaddr; vaddr = DB_USER_STACK_ADDR; diff --git a/i386/i386/db_interface.h b/i386/i386/db_interface.h new file mode 100644 index 0000000..8cd1690 --- /dev/null +++ b/i386/i386/db_interface.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ + +#ifndef _I386_DB_INTERFACE_H_ +#define _I386_DB_INTERFACE_H_ + +#include <sys/types.h> +#include <kern/task.h> +#include <machine/thread.h> + +extern boolean_t kdb_trap ( + int type, + int code, + struct i386_saved_state *regs); + +extern void db_read_bytes ( + vm_offset_t addr, + int size, + char *data, + task_t task); + +extern void db_write_bytes ( + vm_offset_t addr, + int size, + char *data, + task_t task); + +extern boolean_t db_check_access ( + vm_offset_t addr, + int size, + task_t task); + +extern boolean_t db_phys_eq ( + task_t task1, + vm_offset_t addr1, + task_t task2, + vm_offset_t addr2); + +extern void db_task_name (task_t task); + +#endif /* _I386_DB_INTERFACE_H_ */ diff --git a/i386/i386/db_machdep.h b/i386/i386/db_machdep.h index ee5853a..cba259c 100644 --- a/i386/i386/db_machdep.h +++ b/i386/i386/db_machdep.h @@ -34,6 +34,7 @@ #include <mach/machine/vm_types.h> #include <mach/machine/vm_param.h> #include <mach/machine/eflags.h> +#include <machine/db_interface.h> #include <i386/thread.h> /* for thread_status */ #include <i386/trap.h> @@ -87,9 +88,6 @@ db_regs_t ddb_regs; /* register state */ ((!(user) && DB_VALID_KERN_ADDR(addr)) || \ ((user) && (addr) < VM_MIN_KERNEL_ADDRESS)) -boolean_t db_check_access(/* vm_offset_t, int, task_t */); -boolean_t db_phys_eq(/* task_t, vm_offset_t, task_t, vm_offset_t */); - /* macros for printing OS server dependent task name */ #define DB_TASK_NAME(task) db_task_name(task) @@ -97,8 +95,6 @@ boolean_t db_phys_eq(/* task_t, vm_offset_t, task_t, vm_offset_t */); #define DB_TASK_NAME_LEN 23 #define DB_NULL_TASK_NAME "? " -void db_task_name(/* task_t */); - /* macro for checking if a thread has used floating-point */ #define db_thread_fp_used(thread) ((thread)->pcb->ims.ifps != 0) diff --git a/i386/i386/db_trace.c b/i386/i386/db_trace.c index 4402161..d1c9512 100644 --- a/i386/i386/db_trace.c +++ b/i386/i386/db_trace.c @@ -124,6 +124,7 @@ db_lookup_i386_kreg( return 0; } +int db_i386_reg_value( struct db_variable *vp, db_expr_t *valuep, diff --git a/i386/i386/trap.c b/i386/i386/trap.c index bd0d8e0..2cb81e6 100644 --- a/i386/i386/trap.c +++ b/i386/i386/trap.c @@ -52,6 +52,11 @@ #include <i386/io_emulate.h> +#if MACH_KDB +#include <ddb/db_run.h> +#include <ddb/db_watch.h> +#endif + #include "debug.h" extern void exception(); diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c index e6e2932..5ad8d61 100644 --- a/ipc/ipc_kmsg.c +++ b/ipc/ipc_kmsg.c @@ -59,6 +59,10 @@ #include <ipc/ipc_machdep.h> +#if MACH_KDB +#include <ddb/db_output.h> +#endif + extern int copyinmap(); extern int copyoutmap(); void ipc_msg_print(); /* forward */ diff --git a/kern/lock.c b/kern/lock.c index a604761..909aa46 100644 --- a/kern/lock.c +++ b/kern/lock.c @@ -42,6 +42,7 @@ #include <kern/sched_prim.h> #if MACH_KDB #include <machine/db_machdep.h> +#include <ddb/db_output.h> #include <ddb/db_sym.h> #endif |