Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ddb ANSIfy, KNF.
details: https://anonhg.NetBSD.org/src/rev/c69a95b03aee
branches: trunk
changeset: 522281:c69a95b03aee
user: simonb <simonb%NetBSD.org@localhost>
date: Fri Feb 15 07:33:48 2002 +0000
description:
ANSIfy, KNF.
Make some variables and functions static when not used outside of a module.
Make variables in headers extern.
Delete the unused db_find_watchpoint() function.
diffstat:
sys/ddb/TODO | 6 +-
sys/ddb/db_access.c | 28 +-
sys/ddb/db_access.h | 22 +-
sys/ddb/db_aout.c | 348 ++++++++---------
sys/ddb/db_break.c | 202 ++++-----
sys/ddb/db_break.h | 38 +-
sys/ddb/db_command.c | 909 +++++++++++++++++++++++-------------------------
sys/ddb/db_command.h | 49 +-
sys/ddb/db_elf.c | 97 ++---
sys/ddb/db_examine.c | 67 +--
sys/ddb/db_expr.c | 259 +++++++------
sys/ddb/db_extern.h | 43 +-
sys/ddb/db_input.c | 263 +++++++-------
sys/ddb/db_interface.h | 18 +-
sys/ddb/db_lex.c | 292 +++++++-------
sys/ddb/db_lex.h | 38 +-
sys/ddb/db_output.c | 161 ++++----
sys/ddb/db_output.h | 35 +-
sys/ddb/db_print.c | 53 +-
sys/ddb/db_run.c | 255 ++++++-------
sys/ddb/db_run.h | 38 +-
sys/ddb/db_sym.c | 221 ++++-------
sys/ddb/db_sym.h | 69 +-
sys/ddb/db_trap.c | 63 +-
sys/ddb/db_variables.c | 119 ++---
sys/ddb/db_variables.h | 29 +-
sys/ddb/db_watch.c | 200 ++++------
sys/ddb/db_watch.h | 30 +-
sys/ddb/db_write_cmd.c | 52 +-
sys/ddb/db_xxx.c | 43 +-
sys/ddb/ddbvar.h | 8 +-
31 files changed, 1853 insertions(+), 2202 deletions(-)
diffs (truncated from 6743 to 300 lines):
diff -r 84cace4c17c1 -r c69a95b03aee sys/ddb/TODO
--- a/sys/ddb/TODO Fri Feb 15 07:32:34 2002 +0000
+++ b/sys/ddb/TODO Fri Feb 15 07:33:48 2002 +0000
@@ -1,4 +1,4 @@
-$NetBSD: TODO,v 1.9 2002/01/05 01:48:10 jhawk Exp $
+$NetBSD: TODO,v 1.10 2002/02/15 07:33:48 simonb Exp $
In rough order.
@@ -31,7 +31,7 @@
4. Note only some radixes are supported.
5. Allow a mechanism for DDB to not fail under X (on the i386).
- Probably just skip DDB in such cases.
+ Probably just skip DDB in such cases.
6. Enable DDB in GENERIC on all architectures not starved for
space.
@@ -79,7 +79,7 @@
and ] in kadb (but not in adb):
[ Like :e in adb(1), but requires only one keys-
troke and no RETURN character.
-
+
] Like :s in adb(1), but requires only one keys-
troke and no RETURN character.
Does this make people queasy?
diff -r 84cace4c17c1 -r c69a95b03aee sys/ddb/db_access.c
--- a/sys/ddb/db_access.c Fri Feb 15 07:32:34 2002 +0000
+++ b/sys/ddb/db_access.c Fri Feb 15 07:33:48 2002 +0000
@@ -1,27 +1,27 @@
-/* $NetBSD: db_access.c,v 1.16 2001/11/12 22:54:03 lukem Exp $ */
+/* $NetBSD: db_access.c,v 1.17 2002/02/15 07:33:49 simonb Exp $ */
-/*
+/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution%CS.CMU.EDU@localhost
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_access.c,v 1.16 2001/11/12 22:54:03 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_access.c,v 1.17 2002/02/15 07:33:49 simonb Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -53,10 +53,7 @@
};
db_expr_t
-db_get_value(addr, size, is_signed)
- db_addr_t addr;
- size_t size;
- boolean_t is_signed;
+db_get_value(db_addr_t addr, size_t size, boolean_t is_signed)
{
char data[sizeof(db_expr_t)];
db_expr_t value;
@@ -71,17 +68,14 @@
for (i = 0; i < size; i++)
#endif /* BYTE_ORDER */
value = (value << 8) + (data[i] & 0xFF);
-
+
if (size < 4 && is_signed && (value & db_extend[size]) != 0)
value |= db_extend[size];
return (value);
}
void
-db_put_value(addr, size, value)
- db_addr_t addr;
- size_t size;
- db_expr_t value;
+db_put_value(db_addr_t addr, size_t size, db_expr_t value)
{
char data[sizeof(db_expr_t)];
size_t i;
diff -r 84cace4c17c1 -r c69a95b03aee sys/ddb/db_access.h
--- a/sys/ddb/db_access.h Fri Feb 15 07:32:34 2002 +0000
+++ b/sys/ddb/db_access.h Fri Feb 15 07:33:48 2002 +0000
@@ -1,27 +1,27 @@
-/* $NetBSD: db_access.h,v 1.8 1999/04/12 20:38:20 pk Exp $ */
+/* $NetBSD: db_access.h,v 1.9 2002/02/15 07:33:49 simonb Exp $ */
-/*
+/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution%CS.CMU.EDU@localhost
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
@@ -32,8 +32,8 @@
/*
* Data access functions for debugger.
*/
-db_expr_t db_get_value __P((db_addr_t, size_t, boolean_t));
-void db_put_value __P((db_addr_t, size_t, db_expr_t));
+db_expr_t db_get_value(db_addr_t, size_t, boolean_t);
+void db_put_value(db_addr_t, size_t, db_expr_t);
-void db_read_bytes __P((db_addr_t, size_t, char *));
-void db_write_bytes __P((db_addr_t, size_t, char *));
+void db_read_bytes(db_addr_t, size_t, char *);
+void db_write_bytes(db_addr_t, size_t, char *);
diff -r 84cace4c17c1 -r c69a95b03aee sys/ddb/db_aout.c
--- a/sys/ddb/db_aout.c Fri Feb 15 07:32:34 2002 +0000
+++ b/sys/ddb/db_aout.c Fri Feb 15 07:33:48 2002 +0000
@@ -1,39 +1,39 @@
-/* $NetBSD: db_aout.c,v 1.32 2001/11/15 09:48:02 lukem Exp $ */
+/* $NetBSD: db_aout.c,v 1.33 2002/02/15 07:33:49 simonb Exp $ */
-/*
+/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution%CS.CMU.EDU@localhost
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_aout.c,v 1.32 2001/11/15 09:48:02 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_aout.c,v 1.33 2002/02/15 07:33:49 simonb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
-#include <machine/db_machdep.h> /* data types */
+#include <machine/db_machdep.h>
#include <ddb/db_sym.h>
#include <ddb/db_output.h>
@@ -43,18 +43,17 @@
#include <ddb/db_aout.h>
-boolean_t db_aout_sym_init __P((int, void *, void *, const char *));
-db_sym_t db_aout_lookup __P((db_symtab_t *, char *));
-db_sym_t db_aout_search_symbol __P((db_symtab_t *, db_addr_t,
- db_strategy_t, db_expr_t *));
-void db_aout_symbol_values __P((db_symtab_t *, db_sym_t,
- char **, db_expr_t *));
-boolean_t db_aout_line_at_pc __P((db_symtab_t *, db_sym_t,
- char **, int *, db_expr_t));
-boolean_t db_aout_sym_numargs __P((db_symtab_t *, db_sym_t, int *,
- char **));
-void db_aout_forall __P((db_symtab_t *,
- db_forall_func_t db_forall_func, void *));
+static boolean_t db_aout_sym_init(int, void *, void *, const char *);
+static db_sym_t db_aout_lookup(db_symtab_t *, char *);
+static db_sym_t db_aout_search_symbol(db_symtab_t *, db_addr_t, db_strategy_t,
+ db_expr_t *);
+static void db_aout_symbol_values(db_symtab_t *, db_sym_t, char **,
+ db_expr_t *);
+static boolean_t db_aout_line_at_pc(db_symtab_t *, db_sym_t, char **, int *,
+ db_expr_t);
+static boolean_t db_aout_sym_numargs(db_symtab_t *, db_sym_t, int *, char **);
+static void db_aout_forall(db_symtab_t *, db_forall_func_t db_forall_func,
+ void *);
const db_symformat_t db_symformat_aout = {
"a.out",
@@ -83,14 +82,15 @@
/*
* Find the symbol table and strings; tell ddb about them.
*/
-boolean_t
-db_aout_sym_init(symsize, vsymtab, vesymtab, name)
- int symsize; /* size of symbol table */
- void *vsymtab; /* pointer to start of symbol table */
- void *vesymtab; /* pointer to end of string table,
+static boolean_t
+db_aout_sym_init(
+ int symsize, /* size of symbol table */
+ void *vsymtab, /* pointer to start of symbol table */
+ void *vesymtab, /* pointer to end of string table,
for checking - rounded up to integer
boundary */
- const char *name;
+ const char *name
+)
{
struct nlist *sym_start, *sym_end;
struct nlist *sp;
@@ -125,24 +125,24 @@
(((vaddr_t)(x) + sizeof(vsize_t) - 1) & ~(sizeof(vsize_t) - 1))
if (round_to_size(estrtab) != round_to_size(vesymtab)) {
- printf("[ %s a.out symbol table not valid ]\n", name);
- return (FALSE);
- }
+ printf("[ %s a.out symbol table not valid ]\n", name);
+ return (FALSE);
+ }
#undef round_to_size
-
+
for (sp = sym_start; sp < sym_end; sp++) {
- int strx;
- strx = sp->n_un.n_strx;
- if (strx != 0) {
- if (strx > slen) {
- printf("[ %s has bad a.out string table index (0x%x) ]\n",
- name, strx);
- sp->n_un.n_name = 0;
- bad = 1;
- continue;
+ int strx;
+ strx = sp->n_un.n_strx;
+ if (strx != 0) {
+ if (strx > slen) {
+ printf("[ %s has bad a.out string table "
+ "index (0x%x) ]\n", name, strx);
+ sp->n_un.n_name = 0;
+ bad = 1;
+ continue;
+ }
+ sp->n_un.n_name = strtab + strx;
}
- sp->n_un.n_name = strtab + strx;
- }
}
Home |
Main Index |
Thread Index |
Old Index