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.
This commit is contained in:
simonb 2002-02-15 07:33:48 +00:00
parent 4a188395df
commit 4eaa4d66a8
31 changed files with 1854 additions and 2203 deletions

View File

@ -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 @@ done "set" should display the old value as "write" does.
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 @@ done Numbers starting with [a-f] should work, but symbols
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?

View File

@ -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
* 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 @@ const int db_extend[] = { /* table for sign-extending */
};
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 @@ db_get_value(addr, size, is_signed)
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;

View File

@ -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
* 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 *);

View File

@ -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
* 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 @@ __KERNEL_RCSID(0, "$NetBSD: db_aout.c,v 1.32 2001/11/15 09:48:02 lukem Exp $");
#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 @@ const db_symformat_t db_symformat_aout = {
/*
* 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 @@ db_aout_sym_init(symsize, vsymtab, vesymtab, name)
(((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;
}
}
if (bad)
@ -150,18 +150,16 @@ db_aout_sym_init(symsize, vsymtab, vesymtab, name)
if (db_add_symbol_table((char *)sym_start, (char *)sym_end, name,
NULL) != -1) {
printf("[ using %ld bytes of %s a.out symbol table ]\n",
(long)vesymtab - (long)vsymtab, name);
printf("[ using %ld bytes of %s a.out symbol table ]\n",
(long)vesymtab - (long)vsymtab, name);
return (TRUE);
}
}
return (FALSE);
}
db_sym_t
db_aout_lookup(stab, symstr)
db_symtab_t *stab;
char * symstr;
static db_sym_t
db_aout_lookup(db_symtab_t *stab, char *symstr)
{
struct nlist *sp, *ep;
@ -169,24 +167,19 @@ db_aout_lookup(stab, symstr)
ep = (struct nlist *)stab->end;
for (; sp < ep; sp++) {
if (sp->n_un.n_name == 0)
continue;
if ((sp->n_type & N_STAB) == 0 &&
sp->n_un.n_name != 0 &&
db_eqname(sp->n_un.n_name, symstr, '_'))
{
return ((db_sym_t)sp);
}
if (sp->n_un.n_name == 0)
continue;
if ((sp->n_type & N_STAB) == 0 &&
sp->n_un.n_name != 0 &&
db_eqname(sp->n_un.n_name, symstr, '_'))
return ((db_sym_t)sp);
}
return ((db_sym_t)0);
}
db_sym_t
db_aout_search_symbol(symtab, off, strategy, diffp)
db_symtab_t * symtab;
db_addr_t off;
db_strategy_t strategy;
db_expr_t *diffp; /* in/out */
static db_sym_t
db_aout_search_symbol(db_symtab_t *symtab, db_addr_t off,
db_strategy_t strategy, db_expr_t *diffp)
{
unsigned int diff = *diffp;
struct nlist *symp = 0;
@ -196,66 +189,58 @@ db_aout_search_symbol(symtab, off, strategy, diffp)
ep = (struct nlist *)symtab->end;
for (; sp < ep; sp++) {
if (sp->n_un.n_name == 0)
continue;
if ((sp->n_type & N_STAB) != 0 || (sp->n_type & N_TYPE) == N_FN)
continue;
if (off >= sp->n_value) {
if (off - sp->n_value < diff) {
diff = off - sp->n_value;
symp = sp;
if (diff == 0 &&
((strategy == DB_STGY_PROC &&
sp->n_type == (N_TEXT|N_EXT)) ||
(strategy == DB_STGY_ANY &&
(sp->n_type & N_EXT))))
break;
if (sp->n_un.n_name == 0)
continue;
if ((sp->n_type & N_STAB) != 0 || (sp->n_type & N_TYPE) == N_FN)
continue;
if (off >= sp->n_value) {
if (off - sp->n_value < diff) {
diff = off - sp->n_value;
symp = sp;
if (diff == 0 &&
((strategy == DB_STGY_PROC &&
sp->n_type == (N_TEXT|N_EXT)) ||
(strategy == DB_STGY_ANY &&
(sp->n_type & N_EXT))))
break;
}
else if (off - sp->n_value == diff) {
if (symp == 0)
symp = sp;
else if ((symp->n_type & N_EXT) == 0 &&
(sp->n_type & N_EXT) != 0)
/* pick the external symbol */
symp = sp;
}
}
else if (off - sp->n_value == diff) {
if (symp == 0)
symp = sp;
else if ((symp->n_type & N_EXT) == 0 &&
(sp->n_type & N_EXT) != 0)
symp = sp; /* pick the external symbol */
}
}
}
if (symp == 0) {
*diffp = off;
}
else {
*diffp = diff;
}
if (symp == 0)
*diffp = off;
else
*diffp = diff;
return ((db_sym_t)symp);
}
/*
* Return the name and value for a symbol.
*/
void
db_aout_symbol_values(symtab, sym, namep, valuep)
db_symtab_t *symtab;
db_sym_t sym;
char **namep;
db_expr_t *valuep;
static void
db_aout_symbol_values(db_symtab_t *symtab, db_sym_t sym, char **namep,
db_expr_t *valuep)
{
struct nlist *sp;
sp = (struct nlist *)sym;
if (namep)
*namep = sp->n_un.n_name;
*namep = sp->n_un.n_name;
if (valuep)
*valuep = sp->n_value;
*valuep = sp->n_value;
}
boolean_t
db_aout_line_at_pc(symtab, cursym, filename, linenum, off)
db_symtab_t * symtab;
db_sym_t cursym;
char **filename;
int *linenum;
db_expr_t off;
static boolean_t
db_aout_line_at_pc(db_symtab_t *symtab, db_sym_t cursym, char **filename,
int *linenum, db_expr_t off)
{
struct nlist *sp, *ep;
unsigned long sodiff = -1UL, lndiff = -1UL, ln = 0;
@ -270,38 +255,38 @@ db_aout_line_at_pc(symtab, cursym, filename, linenum, off)
for (; sp < ep; sp++) {
/*
* Prevent bogus linenumbers in case module not compiled
* with debugging options
*/
/*
* Prevent bogus linenumbers in case module not compiled
* with debugging options
*/
#if 0
if (sp->n_value <= off && (off - sp->n_value) <= sodiff &&
NEWSRC(sp->n_un.n_name)) {
if (sp->n_value <= off && (off - sp->n_value) <= sodiff &&
NEWSRC(sp->n_un.n_name)) {
#endif
if ((sp->n_type & N_TYPE) == N_FN || NEWSRC(sp->n_un.n_name)) {
sodiff = lndiff = -1UL;
ln = 0;
fname = NULL;
}
if (sp->n_type == N_SO) {
if (sp->n_value <= off && (off - sp->n_value) < sodiff) {
sodiff = off - sp->n_value;
fname = sp->n_un.n_name;
if ((sp->n_type & N_TYPE) == N_FN || NEWSRC(sp->n_un.n_name)) {
sodiff = lndiff = -1UL;
ln = 0;
fname = NULL;
}
continue;
}
if (sp->n_type != N_SLINE)
continue;
if (sp->n_type == N_SO) {
if (sp->n_value <= off && (off - sp->n_value) < sodiff) {
sodiff = off - sp->n_value;
fname = sp->n_un.n_name;
}
continue;
}
if (sp->n_value > off)
break;
if (sp->n_type != N_SLINE)
continue;
if (off - sp->n_value < lndiff) {
lndiff = off - sp->n_value;
ln = sp->n_desc;
}
if (sp->n_value > off)
break;
if (off - sp->n_value < lndiff) {
lndiff = off - sp->n_value;
ln = sp->n_desc;
}
}
if (fname != NULL && ln != 0) {
@ -313,12 +298,9 @@ db_aout_line_at_pc(symtab, cursym, filename, linenum, off)
return (FALSE);
}
boolean_t
db_aout_sym_numargs(symtab, cursym, nargp, argnamep)
db_symtab_t * symtab;
db_sym_t cursym;
int *nargp;
char **argnamep;
static boolean_t
db_aout_sym_numargs(db_symtab_t *symtab, db_sym_t cursym, int *nargp,
char **argnamep)
{
struct nlist *sp, *ep;
u_long addr;
@ -332,31 +314,29 @@ db_aout_sym_numargs(symtab, cursym, nargp, argnamep)
ep = (struct nlist *)symtab->end;
for (; sp < ep; sp++) {
if (sp->n_type == N_FUN && sp->n_value == addr) {
while (++sp < ep && sp->n_type == N_PSYM) {
if (nargs >= maxnarg)
break;
nargs++;
*argnamep++ = sp->n_un.n_name?sp->n_un.n_name:"???";
{
/* XXX - remove trailers */
char *cp = *(argnamep-1);
while (*cp != '\0' && *cp != ':') cp++;
if (*cp == ':') *cp = '\0';
if (sp->n_type == N_FUN && sp->n_value == addr) {
while (++sp < ep && sp->n_type == N_PSYM) {
if (nargs >= maxnarg)
break;
nargs++;
*argnamep++ = sp->n_un.n_name ?
sp->n_un.n_name : "???";
{
/* XXX - remove trailers */
char *cp = *(argnamep-1);
while (*cp != '\0' && *cp != ':') cp++;
if (*cp == ':') *cp = '\0';
}
}
*nargp = nargs;
return TRUE;
}
*nargp = nargs;
return TRUE;
}
}
return FALSE;
}
void
db_aout_forall(stab, db_forall_func, arg)
db_symtab_t *stab;
db_forall_func_t db_forall_func;
void *arg;
static void
db_aout_forall(db_symtab_t *stab, db_forall_func_t db_forall_func, void *arg)
{
static char suffix[2];
struct nlist *sp, *ep;
@ -365,35 +345,33 @@ db_aout_forall(stab, db_forall_func, arg)
ep = (struct nlist *)stab->end;
for (; sp < ep; sp++) {
if (sp->n_un.n_name == 0)
continue;
if ((sp->n_type & N_STAB) == 0 && sp->n_un.n_name != 0) {
suffix[1] = '\0';
switch(sp->n_type & N_TYPE) {
case N_ABS:
suffix[0] = '@';
break;
case N_TEXT:
suffix[0] = '*';
break;
case N_DATA:
suffix[0] = '+';
break;
case N_BSS:
suffix[0] = '-';
break;
case N_FN:
suffix[0] = '/';
break;
default:
suffix[0] = '\0';
}
(*db_forall_func)(stab, (db_sym_t)sp, sp->n_un.n_name,
suffix, '_', arg);
}
if (sp->n_un.n_name == 0)
continue;
if ((sp->n_type & N_STAB) == 0 && sp->n_un.n_name != 0) {
suffix[1] = '\0';
switch(sp->n_type & N_TYPE) {
case N_ABS:
suffix[0] = '@';
break;
case N_TEXT:
suffix[0] = '*';
break;
case N_DATA:
suffix[0] = '+';
break;
case N_BSS:
suffix[0] = '-';
break;
case N_FN:
suffix[0] = '/';
break;
default:
suffix[0] = '\0';
}
(*db_forall_func)(stab, (db_sym_t)sp, sp->n_un.n_name,
suffix, '_', arg);
}
}
return;
}
#endif /* DB_AOUT_SYMBOLS */

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_break.c,v 1.16 2001/11/12 22:54:04 lukem Exp $ */
/* $NetBSD: db_break.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
* 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.
*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_break.c,v 1.16 2001/11/12 22:54:04 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_break.c,v 1.17 2002/02/15 07:33:49 simonb Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -48,23 +48,30 @@ __KERNEL_RCSID(0, "$NetBSD: db_break.c,v 1.16 2001/11/12 22:54:04 lukem Exp $");
#include <ddb/db_output.h>
#define NBREAKPOINTS 100
struct db_breakpoint db_break_table[NBREAKPOINTS];
db_breakpoint_t db_next_free_breakpoint = &db_break_table[0];
db_breakpoint_t db_free_breakpoints = 0;
db_breakpoint_t db_breakpoint_list = 0;
static struct db_breakpoint db_break_table[NBREAKPOINTS];
static db_breakpoint_t db_next_free_breakpoint = &db_break_table[0];
static db_breakpoint_t db_free_breakpoints = 0;
static db_breakpoint_t db_breakpoint_list = 0;
db_breakpoint_t
db_breakpoint_alloc()
static db_breakpoint_t db_breakpoint_alloc(void);
static void db_breakpoint_free(db_breakpoint_t);
static void db_delete_breakpoint(struct vm_map *, db_addr_t);
static db_breakpoint_t db_find_breakpoint(struct vm_map *, db_addr_t);
static void db_list_breakpoints(void);
static void db_set_breakpoint(struct vm_map *, db_addr_t, int);
static db_breakpoint_t
db_breakpoint_alloc(void)
{
db_breakpoint_t bkpt;
if ((bkpt = db_free_breakpoints) != 0) {
db_free_breakpoints = bkpt->link;
return (bkpt);
db_free_breakpoints = bkpt->link;
return (bkpt);
}
if (db_next_free_breakpoint == &db_break_table[NBREAKPOINTS]) {
db_printf("All breakpoints used.\n");
return (0);
db_printf("All breakpoints used.\n");
return (0);
}
bkpt = db_next_free_breakpoint;
db_next_free_breakpoint++;
@ -72,31 +79,27 @@ db_breakpoint_alloc()
return (bkpt);
}
void
db_breakpoint_free(bkpt)
db_breakpoint_t bkpt;
static void
db_breakpoint_free(db_breakpoint_t bkpt)
{
bkpt->link = db_free_breakpoints;
db_free_breakpoints = bkpt;
}
void
db_set_breakpoint(map, addr, count)
struct vm_map *map;
db_addr_t addr;
int count;
db_set_breakpoint(struct vm_map *map, db_addr_t addr, int count)
{
db_breakpoint_t bkpt;
if (db_find_breakpoint(map, addr)) {
db_printf("Already set.\n");
return;
db_printf("Already set.\n");
return;
}
bkpt = db_breakpoint_alloc();
if (bkpt == 0) {
db_printf("Too many breakpoints.\n");
return;
db_printf("Too many breakpoints.\n");
return;
}
bkpt->map = map;
@ -109,10 +112,8 @@ db_set_breakpoint(map, addr, count)
db_breakpoint_list = bkpt;
}
void
db_delete_breakpoint(map, addr)
struct vm_map *map;
db_addr_t addr;
static void
db_delete_breakpoint(struct vm_map *map, db_addr_t addr)
{
db_breakpoint_t bkpt;
db_breakpoint_t *prev;
@ -120,83 +121,77 @@ db_delete_breakpoint(map, addr)
for (prev = &db_breakpoint_list;
(bkpt = *prev) != 0;
prev = &bkpt->link) {
if (db_map_equal(bkpt->map, map) &&
(bkpt->address == addr)) {
*prev = bkpt->link;
break;
}
if (db_map_equal(bkpt->map, map) &&
(bkpt->address == addr)) {
*prev = bkpt->link;
break;
}
}
if (bkpt == 0) {
db_printf("Not set.\n");
return;
db_printf("Not set.\n");
return;
}
db_breakpoint_free(bkpt);
}
db_breakpoint_t
db_find_breakpoint(map, addr)
struct vm_map *map;
db_addr_t addr;
db_find_breakpoint(struct vm_map *map, db_addr_t addr)
{
db_breakpoint_t bkpt;
for (bkpt = db_breakpoint_list;
bkpt != 0;
bkpt = bkpt->link)
{
if (db_map_equal(bkpt->map, map) &&
(bkpt->address == addr))
return (bkpt);
}
if (db_map_equal(bkpt->map, map) &&
(bkpt->address == addr))
return (bkpt);
return (0);
}
db_breakpoint_t
db_find_breakpoint_here(addr)
db_addr_t addr;
db_find_breakpoint_here(db_addr_t addr)
{
return db_find_breakpoint(db_map_addr(addr), addr);
return db_find_breakpoint(db_map_addr(addr), addr);
}
boolean_t db_breakpoints_inserted = TRUE;
static boolean_t db_breakpoints_inserted = TRUE;
void
db_set_breakpoints()
db_set_breakpoints(void)
{
db_breakpoint_t bkpt;
if (!db_breakpoints_inserted) {
for (bkpt = db_breakpoint_list;
bkpt != 0;
bkpt = bkpt->link)
if (db_map_current(bkpt->map)) {
bkpt->bkpt_inst = db_get_value(bkpt->address,
BKPT_SIZE,
FALSE);
db_put_value(bkpt->address,
BKPT_SIZE,
BKPT_SET(bkpt->bkpt_inst));
}
db_breakpoints_inserted = TRUE;
for (bkpt = db_breakpoint_list;
bkpt != 0;
bkpt = bkpt->link)
if (db_map_current(bkpt->map)) {
bkpt->bkpt_inst = db_get_value(bkpt->address,
BKPT_SIZE, FALSE);
db_put_value(bkpt->address,
BKPT_SIZE, BKPT_SET(bkpt->bkpt_inst));
}
db_breakpoints_inserted = TRUE;
}
}
void
db_clear_breakpoints()
db_clear_breakpoints(void)
{
db_breakpoint_t bkpt;
if (db_breakpoints_inserted) {
for (bkpt = db_breakpoint_list;
bkpt != 0;
bkpt = bkpt->link)
if (db_map_current(bkpt->map)) {
db_put_value(bkpt->address, BKPT_SIZE, bkpt->bkpt_inst);
}
db_breakpoints_inserted = FALSE;
for (bkpt = db_breakpoint_list;
bkpt != 0;
bkpt = bkpt->link)
if (db_map_current(bkpt->map))
db_put_value(bkpt->address, BKPT_SIZE,
bkpt->bkpt_inst);
db_breakpoints_inserted = FALSE;
}
}
@ -204,51 +199,44 @@ db_clear_breakpoints()
* List breakpoints.
*/
void
db_list_breakpoints()
db_list_breakpoints(void)
{
db_breakpoint_t bkpt;
if (db_breakpoint_list == 0) {
db_printf("No breakpoints set\n");
return;
db_printf("No breakpoints set\n");
return;
}
db_printf(" Map Count Address\n");
for (bkpt = db_breakpoint_list;
bkpt != 0;
bkpt = bkpt->link)
{
db_printf("%s%p %5d ",
db_map_current(bkpt->map) ? "*" : " ",
bkpt->map, bkpt->init_count);
db_printsym(bkpt->address, DB_STGY_PROC, db_printf);
db_printf("\n");
bkpt = bkpt->link) {
db_printf("%s%p %5d ",
db_map_current(bkpt->map) ? "*" : " ",
bkpt->map, bkpt->init_count);
db_printsym(bkpt->address, DB_STGY_PROC, db_printf);
db_printf("\n");
}
}
/* Delete breakpoint */
/*ARGSUSED*/
void
db_delete_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_delete_cmd(db_expr_t addr, int have_addr, db_expr_t count, char * modif)
{
db_delete_breakpoint(db_map_addr(addr), (db_addr_t)addr);
}
/* Set breakpoint with skip count */
/*ARGSUSED*/
void
db_breakpoint_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_breakpoint_cmd(db_expr_t addr, int have_addr, db_expr_t count, char * modif)
{
if (count == -1)
count = 1;
count = 1;
db_set_breakpoint(db_map_addr(addr), (db_addr_t)addr, count);
}
@ -256,12 +244,9 @@ db_breakpoint_cmd(addr, have_addr, count, modif)
/* list breakpoints */
/*ARGSUSED*/
void
db_listbreak_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_listbreak_cmd(db_expr_t addr, int have_addr, db_expr_t count, char * modif)
{
db_list_breakpoints();
}
@ -274,18 +259,16 @@ db_listbreak_cmd(addr, have_addr, count, modif)
*/
boolean_t
db_map_equal(map1, map2)
struct vm_map *map1;
struct vm_map *map2;
db_map_equal(struct vm_map *map1, struct vm_map *map2)
{
return ((map1 == map2) ||
((map1 == NULL) && (map2 == kernel_map)) ||
((map1 == kernel_map) && (map2 == NULL)));
}
boolean_t
db_map_current(map)
struct vm_map *map;
db_map_current(struct vm_map *map)
{
#if 0
thread_t thread;
@ -295,13 +278,13 @@ db_map_current(map)
(((thread = current_thread()) != NULL) &&
(map == thread->task->map)));
#else
return (1);
#endif
}
struct vm_map *
db_map_addr(addr)
vaddr_t addr;
db_map_addr(vaddr_t addr)
{
#if 0
thread_t thread;
@ -312,11 +295,10 @@ db_map_addr(addr)
* kernel tasks with their own maps.
*/
if ((VM_MIN_ADDRESS <= addr) &&
(addr < VM_MAX_ADDRESS) &&
if ((VM_MIN_ADDRESS <= addr) && (addr < VM_MAX_ADDRESS) &&
((thread = current_thread()) != NULL))
return thread->task->map;
return thread->task->map;
else
#endif
return kernel_map;
return kernel_map;
}

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_break.h,v 1.15 2001/06/02 18:09:25 chs Exp $ */
/* $NetBSD: db_break.h,v 1.16 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
* 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.
*
@ -49,20 +49,14 @@ typedef struct db_breakpoint {
struct db_breakpoint *link; /* link in in-use or free chain */
} *db_breakpoint_t;
db_breakpoint_t db_breakpoint_alloc __P((void));
void db_breakpoint_free __P((db_breakpoint_t));
void db_set_breakpoint __P((struct vm_map *, db_addr_t, int));
void db_delete_breakpoint __P((struct vm_map *, db_addr_t));
db_breakpoint_t db_find_breakpoint __P((struct vm_map *, db_addr_t));
db_breakpoint_t db_find_breakpoint_here __P((db_addr_t));
void db_set_breakpoints __P((void));
void db_clear_breakpoints __P((void));
void db_list_breakpoints __P((void));
void db_delete_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_breakpoint_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_listbreak_cmd __P((db_expr_t, int, db_expr_t, char *));
boolean_t db_map_equal __P((struct vm_map *, struct vm_map *));
boolean_t db_map_current __P((struct vm_map *));
struct vm_map *db_map_addr __P((vaddr_t));
db_breakpoint_t db_find_breakpoint_here(db_addr_t);
void db_set_breakpoints(void);
void db_clear_breakpoints(void);
void db_delete_cmd(db_expr_t, int, db_expr_t, char *);
void db_breakpoint_cmd(db_expr_t, int, db_expr_t, char *);
void db_listbreak_cmd(db_expr_t, int, db_expr_t, char *);
boolean_t db_map_equal(struct vm_map *, struct vm_map *);
boolean_t db_map_current(struct vm_map *);
struct vm_map *db_map_addr(vaddr_t);
#endif /* _DDB_DB_BREAK_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_command.h,v 1.21 2001/08/17 01:00:10 thorpej Exp $ */
/* $NetBSD: db_command.h,v 1.22 2002/02/15 07:33:50 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
* 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,34 +32,17 @@
/*
* Command loop declarations.
*/
void db_skip_to_eol __P((void));
struct db_command;
int db_cmd_search __P((const char *, const struct db_command *,
const struct db_command **));
void db_cmd_list __P((const struct db_command *));
void db_command __P((const struct db_command **, const struct db_command *));
void db_map_print_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_malloc_print_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_object_print_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_page_print_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_buf_print_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_vnode_print_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_pool_print_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_namecache_print_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_uvmexp_print_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_command_loop __P((void));
void db_error __P((char *));
void db_fncall __P((db_expr_t, int, db_expr_t, char *));
void db_reboot_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_sifting_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_stack_trace_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_sync_cmd __P((db_expr_t, int, db_expr_t, char *));
db_addr_t db_dot; /* current location */
db_addr_t db_last_addr; /* last explicit address typed */
db_addr_t db_prev; /* last address examined
void db_skip_to_eol(void);
void db_command_loop(void);
void db_error(char *);
extern db_addr_t db_dot; /* current location */
extern db_addr_t db_last_addr; /* last explicit address typed */
extern db_addr_t db_prev; /* last address examined
or written */
db_addr_t db_next; /* next address to be examined
extern db_addr_t db_next; /* next address to be examined
or written */
/*
@ -68,7 +51,7 @@ db_addr_t db_next; /* next address to be examined
struct db_command {
const char *name; /* command name */
/* function to call */
void (*fcn) __P((db_expr_t, int, db_expr_t, char *));
void (*fcn)(db_expr_t, int, db_expr_t, char *);
int flag; /* extra info: */
#define CS_OWN 0x1 /* non-standard syntax */
#define CS_MORE 0x2 /* standard syntax, but may have other

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_elf.c,v 1.19 2001/11/15 09:48:02 lukem Exp $ */
/* $NetBSD: db_elf.c,v 1.20 2002/02/15 07:33:50 simonb Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -38,10 +38,10 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_elf.c,v 1.19 2001/11/15 09:48:02 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_elf.c,v 1.20 2002/02/15 07:33:50 simonb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <machine/db_machdep.h>
@ -60,25 +60,24 @@ __KERNEL_RCSID(0, "$NetBSD: db_elf.c,v 1.19 2001/11/15 09:48:02 lukem Exp $");
#include <sys/exec_elf.h>
static char *db_elf_find_strtab __P((db_symtab_t *));
static char *db_elf_find_strtab(db_symtab_t *);
#define STAB_TO_SYMSTART(stab) ((Elf_Sym *)((stab)->start))
#define STAB_TO_SYMEND(stab) ((Elf_Sym *)((stab)->end))
#define STAB_TO_EHDR(stab) ((Elf_Ehdr *)((stab)->private))
#define STAB_TO_SHDR(stab, e) ((Elf_Shdr *)((stab)->private + (e)->e_shoff))
boolean_t db_elf_sym_init __P((int, void *, void *, const char *));
db_sym_t db_elf_lookup __P((db_symtab_t *, char *));
db_sym_t db_elf_search_symbol __P((db_symtab_t *, db_addr_t,
db_strategy_t, db_expr_t *));
void db_elf_symbol_values __P((db_symtab_t *, db_sym_t,
char **, db_expr_t *));
boolean_t db_elf_line_at_pc __P((db_symtab_t *, db_sym_t,
char **, int *, db_expr_t));
boolean_t db_elf_sym_numargs __P((db_symtab_t *, db_sym_t, int *,
char **));
void db_elf_forall __P((db_symtab_t *,
db_forall_func_t db_forall_func, void *));
static boolean_t db_elf_sym_init(int, void *, void *, const char *);
static db_sym_t db_elf_lookup(db_symtab_t *, char *);
static db_sym_t db_elf_search_symbol(db_symtab_t *, db_addr_t, db_strategy_t,
db_expr_t *);
static void db_elf_symbol_values(db_symtab_t *, db_sym_t, char **,
db_expr_t *);
static boolean_t db_elf_line_at_pc(db_symtab_t *, db_sym_t, char **, int *,
db_expr_t);
static boolean_t db_elf_sym_numargs(db_symtab_t *, db_sym_t, int *, char **);
static void db_elf_forall(db_symtab_t *, db_forall_func_t db_forall_func,
void *);
const db_symformat_t db_symformat_elf = {
"ELF",
@ -94,14 +93,15 @@ const db_symformat_t db_symformat_elf = {
/*
* Find the symbol table and strings; tell ddb about them.
*/
boolean_t
db_elf_sym_init(symsize, symtab, esymtab, name)
int symsize; /* size of symbol table */
void *symtab; /* pointer to start of symbol table */
void *esymtab; /* pointer to end of string table,
static boolean_t
db_elf_sym_init(
int symsize, /* size of symbol table */
void *symtab, /* pointer to start of symbol table */
void *esymtab, /* pointer to end of string table,
for checking - rounded up to integer
boundary */
const char *name;
const char *name
)
{
Elf_Ehdr *elf;
Elf_Shdr *shp;
@ -160,9 +160,9 @@ db_elf_sym_init(symsize, symtab, esymtab, name)
if (shp[i].sh_offset == 0)
continue;
/* Got the symbol table. */
symtab_start = (Elf_Sym *)((char *)symtab +
symtab_start = (Elf_Sym *)((char *)symtab +
shp[i].sh_offset);
symtab_end = (Elf_Sym *)((char *)symtab +
symtab_end = (Elf_Sym *)((char *)symtab +
shp[i].sh_offset + shp[i].sh_size);
/* Find the string table to go with it. */
j = shp[i].sh_link;
@ -193,8 +193,8 @@ db_elf_sym_init(symsize, symtab, esymtab, name)
if (db_add_symbol_table((char *)symtab_start,
(char *)symtab_end, name, (char *)symtab) != -1) {
printf("[ using %lu bytes of %s ELF symbol table ]\n",
(u_long)roundup(((char *)esymtab - (char *)symtab),
sizeof(u_long)), name);
(u_long)roundup(((char *)esymtab - (char *)symtab),
sizeof(u_long)), name);
return (TRUE);
}
@ -210,8 +210,7 @@ db_elf_sym_init(symsize, symtab, esymtab, name)
* for the current symbol table.
*/
static char *
db_elf_find_strtab(stab)
db_symtab_t *stab;
db_elf_find_strtab(db_symtab_t *stab)
{
Elf_Ehdr *elf = STAB_TO_EHDR(stab);
Elf_Shdr *shp = STAB_TO_SHDR(stab, elf);
@ -236,10 +235,8 @@ db_elf_find_strtab(stab)
/*
* Lookup the symbol with the given name.
*/
db_sym_t
db_elf_lookup(stab, symstr)
db_symtab_t *stab;
char *symstr;
static db_sym_t
db_elf_lookup(db_symtab_t *stab, char *symstr)
{
Elf_Sym *symp, *symtab_start, *symtab_end;
char *strtab;
@ -264,12 +261,9 @@ db_elf_lookup(stab, symstr)
* Search for the symbol with the given address (matching within the
* provided threshold).
*/
db_sym_t
db_elf_search_symbol(symtab, off, strategy, diffp)
db_symtab_t *symtab;
db_addr_t off;
db_strategy_t strategy;
db_expr_t *diffp; /* in/out */
static db_sym_t
db_elf_search_symbol(db_symtab_t *symtab, db_addr_t off, db_strategy_t strategy,
db_expr_t *diffp)
{
Elf_Sym *rsymp, *symp, *symtab_start, *symtab_end;
db_expr_t diff = *diffp;
@ -330,12 +324,9 @@ db_elf_search_symbol(symtab, off, strategy, diffp)
/*
* Return the name and value for a symbol.
*/
void
db_elf_symbol_values(symtab, sym, namep, valuep)
db_symtab_t *symtab;
db_sym_t sym;
char **namep;
db_expr_t *valuep;
static void
db_elf_symbol_values(db_symtab_t *symtab, db_sym_t sym, char **namep,
db_expr_t *valuep)
{
Elf_Sym *symp = (Elf_Sym *)sym;
char *strtab;
@ -356,7 +347,7 @@ db_elf_symbol_values(symtab, sym, namep, valuep)
* Return the file and line number of the current program counter
* if we can find the appropriate debugging symbol.
*/
boolean_t
static boolean_t
db_elf_line_at_pc(symtab, cursym, filename, linenum, off)
db_symtab_t *symtab;
db_sym_t cursym;
@ -375,12 +366,9 @@ db_elf_line_at_pc(symtab, cursym, filename, linenum, off)
* Returns the number of arguments to a function and their
* names if we can find the appropriate debugging symbol.
*/
boolean_t
db_elf_sym_numargs(symtab, cursym, nargp, argnamep)
db_symtab_t *symtab;
db_sym_t cursym;
int *nargp;
char **argnamep;
static boolean_t
db_elf_sym_numargs(db_symtab_t *symtab, db_sym_t cursym, int *nargp,
char **argnamep)
{
/*
@ -389,11 +377,8 @@ db_elf_sym_numargs(symtab, cursym, nargp, argnamep)
return (FALSE);
}
void
db_elf_forall(stab, db_forall_func, arg)
db_symtab_t *stab;
db_forall_func_t db_forall_func;
void *arg;
static void
db_elf_forall(db_symtab_t *stab, db_forall_func_t db_forall_func, void *arg)
{
char *strtab;
static char suffix[2];

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_examine.c,v 1.22 2001/11/12 22:54:04 lukem Exp $ */
/* $NetBSD: db_examine.c,v 1.23 2002/02/15 07:33:50 simonb Exp $ */
/*
* Mach Operating System
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_examine.c,v 1.22 2001/11/12 22:54:04 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_examine.c,v 1.23 2002/02/15 07:33:50 simonb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -46,7 +46,10 @@ __KERNEL_RCSID(0, "$NetBSD: db_examine.c,v 1.22 2001/11/12 22:54:04 lukem Exp $"
#include <ddb/db_extern.h>
#include <ddb/db_interface.h>
char db_examine_format[TOK_STRING_SIZE] = "x";
static char db_examine_format[TOK_STRING_SIZE] = "x";
static void db_examine(db_addr_t, char *, int);
static void db_search(db_addr_t, int, db_expr_t, db_expr_t, unsigned int);
/*
* Examine (print) data. Syntax is:
@ -58,11 +61,7 @@ char db_examine_format[TOK_STRING_SIZE] = "x";
*/
/*ARGSUSED*/
void
db_examine_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_examine_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
if (modif[0] != '\0')
db_strcpy(db_examine_format, modif);
@ -73,11 +72,8 @@ db_examine_cmd(addr, have_addr, count, modif)
db_examine((db_addr_t) addr, db_examine_format, count);
}
void
db_examine(addr, fmt, count)
db_addr_t addr;
char * fmt; /* format string */
int count; /* repeat count */
static void
db_examine(db_addr_t addr, char *fmt, int count)
{
int i, c;
db_expr_t value;
@ -130,19 +126,19 @@ db_examine(addr, fmt, count)
db_printf("%-*lx", width, value);
break;
case 'm': /* hex dump */
/*
/*
* Print off in chunks of size. Try to print 16
* bytes at a time into 4 columns. This
* bytes at a time into 4 columns. This
* loops modify's count extra times in order
* to get the nicely formatted lines.
*/
bytes = 0;
do {
for (i = 0; i < size; i++) {
value =
value =
db_get_value(addr+bytes, 1,
FALSE);
FALSE);
db_printf("%02lx", value);
bytes++;
if (!(bytes % 4))
@ -160,7 +156,7 @@ db_examine(addr, fmt, count)
db_printf("%c", (char)value);
else
db_printf(".");
}
}
db_printf("\n");
break;
case 'z': /* signed hex */
@ -223,15 +219,11 @@ db_examine(addr, fmt, count)
/*
* Print value.
*/
char db_print_format = 'x';
static char db_print_format = 'x';
/*ARGSUSED*/
void
db_print_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
db_expr_t value;
@ -282,19 +274,18 @@ db_print_cmd(addr, have_addr, count, modif)
}
void
db_print_loc_and_inst(loc)
db_addr_t loc;
db_print_loc_and_inst(db_addr_t loc)
{
db_printsym(loc, DB_STGY_PROC, db_printf);
db_printf(":\t");
(void) db_disasm(loc, FALSE);
}
void
db_strcpy(dst, src)
char *dst;
char *src;
db_strcpy(char *dst, char *src)
{
while ((*dst++ = *src++) != '\0')
;
}
@ -305,11 +296,7 @@ db_strcpy(dst, src)
*/
/*ARGSUSED*/
void
db_search_cmd(daddr, have_addr, dcount, modif)
db_expr_t daddr;
int have_addr;
db_expr_t dcount;
char * modif;
db_search_cmd(db_expr_t daddr, int have_addr, db_expr_t dcount, char *modif)
{
int t;
db_addr_t addr;
@ -373,13 +360,9 @@ db_search_cmd(daddr, have_addr, dcount, modif)
db_search(addr, size, value, mask, count);
}
void
db_search(addr, size, value, mask, count)
db_addr_t addr;
int size;
db_expr_t value;
db_expr_t mask;
unsigned int count;
static void
db_search(db_addr_t addr, int size, db_expr_t value, db_expr_t mask,
unsigned int count)
{
while (count-- != 0) {
db_prev = addr;

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_expr.c,v 1.12 2001/11/12 22:54:05 lukem Exp $ */
/* $NetBSD: db_expr.c,v 1.13 2002/02/15 07:33:50 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
* 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,212 +30,213 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_expr.c,v 1.12 2001/11/12 22:54:05 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_expr.c,v 1.13 2002/02/15 07:33:50 simonb Exp $");
#include <sys/param.h>
#include <sys/proc.h>
#include <machine/db_machdep.h>
#include <ddb/db_lex.h>
#include <ddb/db_access.h>
#include <ddb/db_command.h>
#include <ddb/db_sym.h>
#include <ddb/db_extern.h>
#include <ddb/db_lex.h>
#include <ddb/db_output.h>
#include <ddb/db_sym.h>
#include <ddb/db_variables.h>
boolean_t
db_term(valuep)
db_expr_t *valuep;
static boolean_t db_term(db_expr_t *);
static boolean_t db_unary(db_expr_t *);
static boolean_t db_mult_expr(db_expr_t *);
static boolean_t db_add_expr(db_expr_t *);
static boolean_t db_shift_expr(db_expr_t *);
static boolean_t
db_term(db_expr_t *valuep)
{
int t;
t = db_read_token();
if (t == tIDENT) {
if (!db_value_of_name(db_tok_string, valuep)) {
extern int db_radix;
db_expr_t v = 0;
int i, c, byte;
if (!db_value_of_name(db_tok_string, valuep)) {
db_expr_t v = 0;
int i, c, byte;
/* See if we can make a number out of all of it */
for (i = 0; (c = db_tok_string[i]) != '\0'; i++) {
byte = 0;
if (c >= '0' && c <= '9')
byte = c - '0';
else if (db_radix == 16 && c >= 'a' && c <= 'f')
byte = c - 'a' + 10;
else if (db_radix == 16 && c >= 'A' && c <= 'F')
byte = c - 'A' + 10;
else
db_error("Symbol not found\n");
/*NOTREACHED*/
v = v * db_radix + byte;
/* See if we can make a number out of all of it */
for (i = 0; (c = db_tok_string[i]) != '\0'; i++) {
byte = 0;
if (c >= '0' && c <= '9')
byte = c - '0';
else if (db_radix == 16 && c >= 'a' && c <= 'f')
byte = c - 'a' + 10;
else if (db_radix == 16 && c >= 'A' && c <= 'F')
byte = c - 'A' + 10;
else
db_error("Symbol not found\n");
/*NOTREACHED*/
v = v * db_radix + byte;
}
*valuep = (db_expr_t)v;
}
*valuep = (db_expr_t)v;
}
return (TRUE);
return (TRUE);
}
if (t == tNUMBER) {
*valuep = (db_expr_t)db_tok_number;
return (TRUE);
*valuep = (db_expr_t)db_tok_number;
return (TRUE);
}
if (t == tDOT) {
*valuep = (db_expr_t)db_dot;
return (TRUE);
*valuep = (db_expr_t)db_dot;
return (TRUE);
}
if (t == tDOTDOT) {
*valuep = (db_expr_t)db_prev;
return (TRUE);
*valuep = (db_expr_t)db_prev;
return (TRUE);
}
if (t == tPLUS) {
*valuep = (db_expr_t) db_next;
return (TRUE);
*valuep = (db_expr_t) db_next;
return (TRUE);
}
if (t == tDITTO) {
*valuep = (db_expr_t)db_last_addr;
return (TRUE);
*valuep = (db_expr_t)db_last_addr;
return (TRUE);
}
if (t == tDOLLAR) {
if (!db_get_variable(valuep))
return (FALSE);
return (TRUE);
if (!db_get_variable(valuep))
return (FALSE);
return (TRUE);
}
if (t == tLPAREN) {
if (!db_expression(valuep)) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
t = db_read_token();
if (t != tRPAREN) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
return (TRUE);
if (!db_expression(valuep)) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
t = db_read_token();
if (t != tRPAREN) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
return (TRUE);
}
db_unread_token(t);
return (FALSE);
}
boolean_t
db_unary(valuep)
db_expr_t *valuep;
static boolean_t
db_unary(db_expr_t *valuep)
{
int t;
t = db_read_token();
if (t == tMINUS) {
if (!db_unary(valuep)) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
*valuep = -*valuep;
return (TRUE);
if (!db_unary(valuep)) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
*valuep = -*valuep;
return (TRUE);
}
if (t == tSTAR) {
/* indirection */
if (!db_unary(valuep)) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
*valuep = db_get_value((db_addr_t)*valuep, sizeof(db_expr_t),
FALSE);
return (TRUE);
/* indirection */
if (!db_unary(valuep)) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
*valuep = db_get_value((db_addr_t)*valuep, sizeof(db_expr_t),
FALSE);
return (TRUE);
}
db_unread_token(t);
return (db_term(valuep));
}
boolean_t
db_mult_expr(valuep)
db_expr_t *valuep;
static boolean_t
db_mult_expr(db_expr_t *valuep)
{
db_expr_t lhs, rhs;
int t;
if (!db_unary(&lhs))
return (FALSE);
return (FALSE);
t = db_read_token();
while (t == tSTAR || t == tSLASH || t == tPCT || t == tHASH) {
if (!db_term(&rhs)) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
if (t == tSTAR)
lhs *= rhs;
else {
if (rhs == 0) {
db_error("Divide by 0\n");
/*NOTREACHED*/
if (!db_term(&rhs)) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
if (t == tSLASH)
lhs /= rhs;
else if (t == tPCT)
lhs %= rhs;
else
lhs = ((lhs+rhs-1)/rhs)*rhs;
}
t = db_read_token();
if (t == tSTAR)
lhs *= rhs;
else {
if (rhs == 0) {
db_error("Divide by 0\n");
/*NOTREACHED*/
}
if (t == tSLASH)
lhs /= rhs;
else if (t == tPCT)
lhs %= rhs;
else
lhs = ((lhs+rhs-1)/rhs)*rhs;
}
t = db_read_token();
}
db_unread_token(t);
*valuep = lhs;
return (TRUE);
}
boolean_t
db_add_expr(valuep)
db_expr_t *valuep;
static boolean_t
db_add_expr(db_expr_t *valuep)
{
db_expr_t lhs, rhs;
int t;
if (!db_mult_expr(&lhs))
return (FALSE);
return (FALSE);
t = db_read_token();
while (t == tPLUS || t == tMINUS) {
if (!db_mult_expr(&rhs)) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
if (t == tPLUS)
lhs += rhs;
else
lhs -= rhs;
t = db_read_token();
if (!db_mult_expr(&rhs)) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
if (t == tPLUS)
lhs += rhs;
else
lhs -= rhs;
t = db_read_token();
}
db_unread_token(t);
*valuep = lhs;
return (TRUE);
}
boolean_t
db_shift_expr(valuep)
db_expr_t *valuep;
static boolean_t
db_shift_expr(db_expr_t *valuep)
{
db_expr_t lhs, rhs;
int t;
if (!db_add_expr(&lhs))
return (FALSE);
return (FALSE);
t = db_read_token();
while (t == tSHIFT_L || t == tSHIFT_R) {
if (!db_add_expr(&rhs)) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
if (rhs < 0) {
db_error("Negative shift amount\n");
/*NOTREACHED*/
}
if (t == tSHIFT_L)
lhs <<= rhs;
else {
/* Shift right is unsigned */
lhs = (unsigned long) lhs >> rhs;
}
t = db_read_token();
if (!db_add_expr(&rhs)) {
db_error("Syntax error\n");
/*NOTREACHED*/
}
if (rhs < 0) {
db_error("Negative shift amount\n");
/*NOTREACHED*/
}
if (t == tSHIFT_L)
lhs <<= rhs;
else {
/* Shift right is unsigned */
lhs = (unsigned long) lhs >> rhs;
}
t = db_read_token();
}
db_unread_token(t);
*valuep = lhs;
@ -243,8 +244,8 @@ db_shift_expr(valuep)
}
int
db_expression(valuep)
db_expr_t *valuep;
db_expression(db_expr_t *valuep)
{
return (db_shift_expr(valuep));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_extern.h,v 1.7 2000/07/17 19:57:50 jeffs Exp $ */
/* $NetBSD: db_extern.h,v 1.8 2002/02/15 07:33:50 simonb Exp $ */
/*-
* Copyright (c) 1995 The NetBSD Foundation, Inc.
@ -40,44 +40,35 @@
#define _DDB_DB_EXTERN_H_
/* db_sym.c */
void ddb_init __P((int, void *, void *));
void ddb_init(int, void *, void *);
/* db_command.c */
extern int db_cmd_loop_done;
/* db_examine.c */
void db_examine_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_examine __P((db_addr_t, char *, int));
void db_print_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_print_loc_and_inst __P((db_addr_t));
void db_strcpy __P((char *, char *));
void db_search_cmd __P((db_expr_t, boolean_t, db_expr_t, char *));
void db_search __P((db_addr_t, int, db_expr_t, db_expr_t, unsigned int));
void db_examine_cmd(db_expr_t, int, db_expr_t, char *);
void db_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_print_loc_and_inst(db_addr_t);
void db_strcpy(char *, char *);
void db_search_cmd(db_expr_t, boolean_t, db_expr_t, char *);
/* db_expr.c */
boolean_t db_term __P((db_expr_t *));
boolean_t db_unary __P((db_expr_t *));
boolean_t db_mult_expr __P((db_expr_t *));
boolean_t db_add_expr __P((db_expr_t *));
boolean_t db_shift_expr __P((db_expr_t *));
int db_expression __P((db_expr_t *));
int db_expression(db_expr_t *);
/* db_input.c */
void db_putstring __P((char *, int));
void db_putnchars __P((int, int));
void db_delete __P((int, int));
void db_delete_line __P((void));
int db_inputchar __P((int));
int db_readline __P((char *, int));
void db_check_interrupt __P((void));
int db_readline(char *, int);
void db_check_interrupt(void);
/* db_print.c */
void db_show_regs __P((db_expr_t, boolean_t, db_expr_t, char *));
void db_show_regs(db_expr_t, boolean_t, db_expr_t, char *);
/* db_trap.c */
void db_trap(int, int);
void db_trap(int, int);
/* db_write_cmd.c */
void db_write_cmd __P((db_expr_t, boolean_t, db_expr_t, char *));
void db_write_cmd(db_expr_t, boolean_t, db_expr_t, char *);
/* Callback for MD platform code to manage watchdogs, etc. */
void (*db_trap_callback)(int);
extern void (*db_trap_callback)(int);
#endif /* _DDB_DB_EXTERN_H_ */

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_input.c,v 1.16 2001/11/20 08:43:44 lukem Exp $ */
/* $NetBSD: db_input.c,v 1.17 2002/02/15 07:33:51 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
* 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_input.c,v 1.16 2001/11/20 08:43:44 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_input.c,v 1.17 2002/02/15 07:33:51 simonb Exp $");
#include "opt_ddb.h"
@ -59,42 +59,45 @@ __KERNEL_RCSID(0, "$NetBSD: db_input.c,v 1.16 2001/11/20 08:43:44 lukem Exp $");
* since input always ends with a new-line. We just
* reset the line position at the end.
*/
char * db_lbuf_start; /* start of input line buffer */
char * db_lbuf_end; /* end of input line buffer */
char * db_lc; /* current character */
char * db_le; /* one past last character */
static char *db_lbuf_start; /* start of input line buffer */
static char *db_lbuf_end; /* end of input line buffer */
static char *db_lc; /* current character */
static char *db_le; /* one past last character */
#if DDB_HISTORY_SIZE != 0
char db_history[DDB_HISTORY_SIZE]; /* start of history buffer */
int db_history_size = DDB_HISTORY_SIZE;/* size of history buffer */
char * db_history_curr = db_history; /* start of current line */
char * db_history_last = db_history; /* start of last line */
char * db_history_prev = (char *) 0; /* start of previous line */
static char db_history[DDB_HISTORY_SIZE]; /* start of history buffer */
static int db_history_size = DDB_HISTORY_SIZE;/* size of history buffer */
static char *db_history_curr = db_history; /* start of current line */
static char *db_history_last = db_history; /* start of last line */
static char *db_history_prev = (char *) 0; /* start of previous line */
#endif
#define CTRL(c) ((c) & 0x1f)
#define isspace(c) ((c) == ' ' || (c) == '\t')
#define BLANK ' '
#define BACKUP '\b'
static int cnmaygetc __P((void));
static int cnmaygetc(void);
static void db_putstring(char *, int);
static void db_putnchars(int, int);
static void db_delete(int, int);
static void db_delete_line(void);
static int db_inputchar(int);
void
db_putstring(s, count)
char *s;
int count;
static void
db_putstring(char *s, int count)
{
while (--count >= 0)
cnputc(*s++);
cnputc(*s++);
}
void
db_putnchars(c, count)
int c;
int count;
static void
db_putnchars(int c, int count)
{
while (--count >= 0)
cnputc(c);
cnputc(c);
}
/*
@ -102,29 +105,28 @@ db_putnchars(c, count)
*/
#define DEL_FWD 0
#define DEL_BWD 1
void
db_delete(n, bwd)
int n;
int bwd;
static void
db_delete(int n, int bwd)
{
char *p;
if (bwd) {
db_lc -= n;
db_putnchars(BACKUP, n);
db_lc -= n;
db_putnchars(BACKUP, n);
}
for (p = db_lc; p < db_le-n; p++) {
*p = *(p+n);
cnputc(*p);
*p = *(p+n);
cnputc(*p);
}
db_putnchars(BLANK, n);
db_putnchars(BACKUP, db_le - db_lc);
db_le -= n;
}
void
db_delete_line()
static void
db_delete_line(void)
{
db_delete(db_le - db_lc, DEL_FWD);
db_delete(db_lc - db_lbuf_start, DEL_BWD);
db_le = db_lc = db_lbuf_start;
@ -132,104 +134,102 @@ db_delete_line()
#if DDB_HISTORY_SIZE != 0
#define INC_DB_CURR() \
do { \
db_history_curr++; \
if (db_history_curr > \
db_history + db_history_size - 1) \
db_history_curr = db_history; \
} while (0)
do { \
db_history_curr++; \
if (db_history_curr > db_history + db_history_size - 1) \
db_history_curr = db_history; \
} while (0)
#define DEC_DB_CURR() \
do { \
db_history_curr--; \
if (db_history_curr < db_history) \
db_history_curr = db_history + \
db_history_size - 1; \
} while (0)
do { \
db_history_curr--; \
if (db_history_curr < db_history) \
db_history_curr = db_history + \
db_history_size - 1; \
} while (0)
#endif
/* returns TRUE at end-of-line */
int
db_inputchar(c)
int c;
static int
db_inputchar(int c)
{
switch (c) {
case CTRL('b'):
case CTRL('b'):
/* back up one character */
if (db_lc > db_lbuf_start) {
cnputc(BACKUP);
db_lc--;
cnputc(BACKUP);
db_lc--;
}
break;
case CTRL('f'):
case CTRL('f'):
/* forward one character */
if (db_lc < db_le) {
cnputc(*db_lc);
db_lc++;
cnputc(*db_lc);
db_lc++;
}
break;
case CTRL('a'):
case CTRL('a'):
/* beginning of line */
while (db_lc > db_lbuf_start) {
cnputc(BACKUP);
db_lc--;
cnputc(BACKUP);
db_lc--;
}
break;
case CTRL('e'):
case CTRL('e'):
/* end of line */
while (db_lc < db_le) {
cnputc(*db_lc);
db_lc++;
cnputc(*db_lc);
db_lc++;
}
break;
case CTRL('h'):
case 0177:
case CTRL('h'):
case 0177:
/* erase previous character */
if (db_lc > db_lbuf_start)
db_delete(1, DEL_BWD);
db_delete(1, DEL_BWD);
break;
case CTRL('d'):
case CTRL('d'):
/* erase next character */
if (db_lc < db_le)
db_delete(1, DEL_FWD);
db_delete(1, DEL_FWD);
break;
case CTRL('k'):
case CTRL('k'):
/* delete to end of line */
if (db_lc < db_le)
db_delete(db_le - db_lc, DEL_FWD);
db_delete(db_le - db_lc, DEL_FWD);
break;
case CTRL('u'):
case CTRL('u'):
/* delete line */
db_delete_line();
db_delete_line();
break;
case CTRL('t'):
case CTRL('t'):
/* twiddle last 2 characters */
if (db_lc >= db_lbuf_start + 1) {
if (db_lc < db_le) {
c = db_lc[-1];
db_lc[-1] = db_lc[0];
db_lc[0] = c;
cnputc(BACKUP);
cnputc(db_lc[-1]);
cnputc(db_lc[0]);
db_lc++;
} else if (db_lc >= db_lbuf_start + 2) {
c = db_lc[-2];
db_lc[-2] = db_lc[-1];
db_lc[-1] = c;
cnputc(BACKUP);
cnputc(BACKUP);
cnputc(db_lc[-2]);
cnputc(db_lc[-1]);
}
if (db_lc < db_le) {
c = db_lc[-1];
db_lc[-1] = db_lc[0];
db_lc[0] = c;
cnputc(BACKUP);
cnputc(db_lc[-1]);
cnputc(db_lc[0]);
db_lc++;
} else if (db_lc >= db_lbuf_start + 2) {
c = db_lc[-2];
db_lc[-2] = db_lc[-1];
db_lc[-1] = c;
cnputc(BACKUP);
cnputc(BACKUP);
cnputc(db_lc[-2]);
cnputc(db_lc[-1]);
}
}
break;
#if DDB_HISTORY_SIZE != 0
case CTRL('p'):
DEC_DB_CURR();
while (db_history_curr != db_history_last) {
case CTRL('p'):
DEC_DB_CURR();
while (db_history_curr != db_history_last) {
DEC_DB_CURR();
if (*db_history_curr == '\0')
break;
break;
}
db_delete_line();
if (db_history_curr == db_history_last) {
@ -249,10 +249,10 @@ db_inputchar(c)
}
db_putstring(db_lbuf_start, db_le - db_lbuf_start);
break;
case CTRL('n'):
while (db_history_curr != db_history_last) {
case CTRL('n'):
while (db_history_curr != db_history_last) {
if (*db_history_curr == '\0')
break;
break;
INC_DB_CURR();
}
if (db_history_curr != db_history_last) {
@ -274,15 +274,15 @@ db_inputchar(c)
}
break;
#endif
case CTRL('r'):
case CTRL('r'):
db_putstring("^R\n", 3);
if (db_le > db_lbuf_start) {
db_putstring(db_lbuf_start, db_le - db_lbuf_start);
db_putnchars(BACKUP, db_le - db_lc);
db_putstring(db_lbuf_start, db_le - db_lbuf_start);
db_putnchars(BACKUP, db_le - db_lc);
}
break;
case '\n':
case '\r':
case '\n':
case '\r':
#if DDB_HISTORY_SIZE != 0
/* Check if it same than previous line */
if (db_history_curr == db_history_prev) {
@ -292,7 +292,7 @@ db_inputchar(c)
for (pp = db_history_prev, pc = db_lbuf_start;
pc != db_le && *pp; pp++, pc++) {
if (*pp != *pc)
break;
break;
if (++pp == db_history + db_history_size) {
pp = db_history;
}
@ -323,20 +323,20 @@ db_inputchar(c)
#endif
*db_le++ = c;
return (1);
default:
default:
if (db_le == db_lbuf_end) {
cnputc('\007');
cnputc('\007');
}
else if (c >= ' ' && c <= '~') {
char *p;
char *p;
for (p = db_le; p > db_lc; p--)
*p = *(p-1);
*db_lc++ = c;
db_le++;
cnputc(c);
db_putstring(db_lc, db_le - db_lc);
db_putnchars(BACKUP, db_le - db_lc);
for (p = db_le; p > db_lc; p--)
*p = *(p-1);
*db_lc++ = c;
db_le++;
cnputc(c);
db_putstring(db_lc, db_le - db_lc);
db_putnchars(BACKUP, db_le - db_lc);
}
break;
}
@ -344,9 +344,7 @@ db_inputchar(c)
}
int
db_readline(lstart, lsize)
char * lstart;
int lsize;
db_readline(char *lstart, int lsize)
{
db_force_whitespace(); /* synch output position */
@ -356,7 +354,7 @@ db_readline(lstart, lsize)
db_le = lstart;
while (!db_inputchar(cngetc()))
continue;
continue;
db_putchar('\n'); /* synch output position */
@ -365,37 +363,38 @@ db_readline(lstart, lsize)
}
void
db_check_interrupt()
db_check_interrupt(void)
{
int c;
c = cnmaygetc();
switch (c) {
case -1: /* no character */
case -1: /* no character */
return;
case CTRL('c'):
case CTRL('c'):
db_error((char *)0);
/*NOTREACHED*/
case CTRL('s'):
case CTRL('s'):
do {
c = cnmaygetc();
if (c == CTRL('c')) {
db_error((char *)0);
/*NOTREACHED*/
}
c = cnmaygetc();
if (c == CTRL('c')) {
db_error((char *)0);
/*NOTREACHED*/
}
} while (c != CTRL('q'));
break;
default:
default:
/* drop on floor */
break;
}
}
static int
cnmaygetc ()
cnmaygetc(void)
{
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_interface.h,v 1.8 2001/11/09 06:52:23 thorpej Exp $ */
/* $NetBSD: db_interface.h,v 1.9 2002/02/15 07:33:51 simonb Exp $ */
/*-
* Copyright (c) 1995 The NetBSD Foundation, Inc.
@ -40,7 +40,7 @@
#define _DDB_DB_INTERFACE_H_
/* arch/<arch>/<arch>/db_disasm.c */
db_addr_t db_disasm __P((db_addr_t, boolean_t));
db_addr_t db_disasm(db_addr_t, boolean_t);
/* arch/<arch>/<arch>/db_interface.c */
#ifdef DB_MACHINE_COMMANDS
@ -49,20 +49,20 @@ extern const struct db_command db_machine_command_table[];
/* arch/<arch>/<arch>/db_trace.c */
/* arch/vax/vax/db_machdep.c */
void db_stack_trace_print __P((db_expr_t, int, db_expr_t, char *,
void (*)(const char *, ...)));
void db_stack_trace_print(db_expr_t, int, db_expr_t, char *,
void (*)(const char *, ...));
/* kern/kern_proc.c */
void db_kill_proc __P((db_expr_t, int, db_expr_t, char *));
void db_show_all_procs __P((db_expr_t, int, db_expr_t, char *));
void db_kill_proc(db_expr_t, int, db_expr_t, char *);
void db_show_all_procs(db_expr_t, int, db_expr_t, char *);
/* kern/kern_clock.c */
void db_show_callout __P((db_expr_t, int, db_expr_t, char *));
void db_show_callout(db_expr_t, int, db_expr_t, char *);
/* kern/subr_log.c */
void db_dmesg __P((db_expr_t, int, db_expr_t, char *));
void db_dmesg(db_expr_t, int, db_expr_t, char *);
/* netinet/if_arp.c */
void db_show_arptab __P((db_expr_t, int, db_expr_t, char *));
void db_show_arptab(db_expr_t, int, db_expr_t, char *);
#endif /* _DDB_DB_INTERFACE_H_ */

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_lex.c,v 1.15 2001/11/12 22:54:05 lukem Exp $ */
/* $NetBSD: db_lex.c,v 1.16 2002/02/15 07:33:51 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
* 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.
*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.15 2001/11/12 22:54:05 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.16 2002/02/15 07:33:51 simonb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -47,74 +47,82 @@ __KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.15 2001/11/12 22:54:05 lukem Exp $");
#include <ddb/db_sym.h>
#include <ddb/db_extern.h>
char db_line[120];
char * db_lp, *db_endlp;
db_expr_t db_tok_number;
char db_tok_string[TOK_STRING_SIZE];
static char db_line[120];
static char *db_lp, *db_endlp;
static int db_look_char = 0;
static int db_look_token = 0;
static void db_flush_line(void);
static int db_read_char(void);
static void db_unread_char(int);
static int db_lex(void);
int
db_read_line()
db_read_line(void)
{
int i;
i = db_readline(db_line, sizeof(db_line));
if (i == 0)
return (0); /* EOI */
return (0); /* EOI */
db_lp = db_line;
db_endlp = db_lp + i;
return (i);
}
void
db_flush_line()
static void
db_flush_line(void)
{
db_lp = db_line;
db_endlp = db_line;
}
int db_look_char = 0;
int
db_read_char()
static int
db_read_char(void)
{
int c;
if (db_look_char != 0) {
c = db_look_char;
db_look_char = 0;
c = db_look_char;
db_look_char = 0;
}
else if (db_lp >= db_endlp)
c = -1;
else
c = *db_lp++;
c = -1;
else
c = *db_lp++;
return (c);
}
void
db_unread_char(c)
int c;
static void
db_unread_char(int c)
{
db_look_char = c;
}
int db_look_token = 0;
void
db_unread_token(t)
int t;
db_unread_token(int t)
{
db_look_token = t;
}
int
db_read_token()
db_read_token(void)
{
int t;
if (db_look_token) {
t = db_look_token;
db_look_token = 0;
t = db_look_token;
db_look_token = 0;
}
else
t = db_lex();
t = db_lex();
return (t);
}
@ -124,12 +132,11 @@ int db_radix = 16;
* Convert the number to a string in the current radix.
* This replaces the non-standard %n printf() format.
*/
char *
db_num_to_str(val)
db_expr_t val;
db_num_to_str(db_expr_t val)
{
/*
/*
* 2 chars for "0x", 1 for a sign ("-")
* up to 21 chars for a 64-bit number:
* % echo 2^64 | bc | wc -c
@ -149,164 +156,161 @@ db_expr_t val;
}
void
db_flush_lex()
db_flush_lex(void)
{
db_flush_line();
db_look_char = 0;
db_look_token = 0;
}
int
db_lex()
static int
db_lex(void)
{
int c;
c = db_read_char();
while (c <= ' ' || c > '~') {
if (c == '\n' || c == -1)
return (tEOL);
c = db_read_char();
if (c == '\n' || c == -1)
return (tEOL);
c = db_read_char();
}
if (c >= '0' && c <= '9') {
/* number */
db_expr_t r, digit = 0;
/* number */
db_expr_t r, digit = 0;
if (c > '0')
r = db_radix;
else {
c = db_read_char();
if (c == 'O' || c == 'o')
r = 8;
else if (c == 'T' || c == 't')
r = 10;
else if (c == 'X' || c == 'x')
r = 16;
if (c > '0')
r = db_radix;
else {
r = db_radix;
db_unread_char(c);
c = db_read_char();
if (c == 'O' || c == 'o')
r = 8;
else if (c == 'T' || c == 't')
r = 10;
else if (c == 'X' || c == 'x')
r = 16;
else {
r = db_radix;
db_unread_char(c);
}
c = db_read_char();
}
c = db_read_char();
}
db_tok_number = 0;
for (;;) {
if (c >= '0' && c <= ((r == 8) ? '7' : '9'))
digit = c - '0';
else if (r == 16 && ((c >= 'A' && c <= 'F') ||
(c >= 'a' && c <= 'f'))) {
if (c >= 'a')
digit = c - 'a' + 10;
else if (c >= 'A')
digit = c - 'A' + 10;
db_tok_number = 0;
for (;;) {
if (c >= '0' && c <= ((r == 8) ? '7' : '9'))
digit = c - '0';
else if (r == 16 && ((c >= 'A' && c <= 'F') ||
(c >= 'a' && c <= 'f'))) {
if (c >= 'a')
digit = c - 'a' + 10;
else if (c >= 'A')
digit = c - 'A' + 10;
}
else
break;
db_tok_number = db_tok_number * r + digit;
c = db_read_char();
}
else
break;
db_tok_number = db_tok_number * r + digit;
c = db_read_char();
}
if ((c >= '0' && c <= '9') ||
(c >= 'A' && c <= 'Z') ||
(c >= 'a' && c <= 'z') ||
(c == '_'))
{
db_error("Bad character in number\n");
/*NOTREACHED*/
}
db_unread_char(c);
return (tNUMBER);
if ((c >= '0' && c <= '9') ||
(c >= 'A' && c <= 'Z') ||
(c >= 'a' && c <= 'z') ||
(c == '_')) {
db_error("Bad character in number\n");
/*NOTREACHED*/
}
db_unread_char(c);
return (tNUMBER);
}
if ((c >= 'A' && c <= 'Z') ||
(c >= 'a' && c <= 'z') ||
c == '_' || c == '\\')
{
/* string */
char *cp;
c == '_' || c == '\\') {
/* string */
char *cp;
cp = db_tok_string;
if (c == '\\') {
c = db_read_char();
if (c == '\n' || c == -1) {
db_error("Bad escape\n");
/*NOTREACHED*/
}
}
*cp++ = c;
while (1) {
c = db_read_char();
if ((c >= 'A' && c <= 'Z') ||
(c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9') ||
c == '_' || c == '\\' || c == ':')
{
if (c == '\\') {
cp = db_tok_string;
if (c == '\\') {
c = db_read_char();
if (c == '\n' || c == -1) {
db_error("Bad escape\n");
/*NOTREACHED*/
db_error("Bad escape\n");
/*NOTREACHED*/
}
}
*cp++ = c;
if (cp == db_tok_string+sizeof(db_tok_string)) {
db_error("String too long\n");
/*NOTREACHED*/
}
continue;
}
else {
*cp = '\0';
break;
*cp++ = c;
while (1) {
c = db_read_char();
if ((c >= 'A' && c <= 'Z') ||
(c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9') ||
c == '_' || c == '\\' || c == ':') {
if (c == '\\') {
c = db_read_char();
if (c == '\n' || c == -1) {
db_error("Bad escape\n");
/*NOTREACHED*/
}
}
*cp++ = c;
if (cp == db_tok_string+sizeof(db_tok_string)) {
db_error("String too long\n");
/*NOTREACHED*/
}
continue;
} else {
*cp = '\0';
break;
}
}
}
db_unread_char(c);
return (tIDENT);
db_unread_char(c);
return (tIDENT);
}
switch (c) {
case '+':
case '+':
return (tPLUS);
case '-':
case '-':
return (tMINUS);
case '.':
case '.':
c = db_read_char();
if (c == '.')
return (tDOTDOT);
return (tDOTDOT);
db_unread_char(c);
return (tDOT);
case '*':
case '*':
return (tSTAR);
case '/':
case '/':
return (tSLASH);
case '=':
case '=':
return (tEQ);
case '%':
case '%':
return (tPCT);
case '#':
case '#':
return (tHASH);
case '(':
case '(':
return (tLPAREN);
case ')':
case ')':
return (tRPAREN);
case ',':
case ',':
return (tCOMMA);
case '"':
case '"':
return (tDITTO);
case '$':
case '$':
return (tDOLLAR);
case '!':
case '!':
return (tEXCL);
case '<':
case '<':
c = db_read_char();
if (c == '<')
return (tSHIFT_L);
return (tSHIFT_L);
db_unread_char(c);
break;
case '>':
case '>':
c = db_read_char();
if (c == '>')
return (tSHIFT_R);
return (tSHIFT_R);
db_unread_char(c);
break;
case -1:
case -1:
return (tEOF);
}
db_printf("Bad character\n");

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_lex.h,v 1.12 2000/06/06 05:06:25 jhawk Exp $ */
/* $NetBSD: db_lex.h,v 1.13 2002/02/15 07:33:51 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
* 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,19 +32,15 @@
/*
* Lexical analyzer.
*/
int db_read_line __P((void));
void db_flush_line __P((void));
int db_read_char __P((void));
void db_unread_char __P((int));
void db_unread_token __P((int));
int db_read_token __P((void));
char *db_num_to_str __P((db_expr_t));
void db_flush_lex __P((void));
int db_lex __P((void));
void db_flush_lex(void);
char *db_num_to_str(db_expr_t);
int db_read_line(void);
int db_read_token(void);
void db_unread_token(int);
db_expr_t db_tok_number;
#define TOK_STRING_SIZE 120
char db_tok_string[TOK_STRING_SIZE];
extern db_expr_t db_tok_number;
#define TOK_STRING_SIZE 120
extern char db_tok_string[];
#define tEOF (-1)
#define tEOL 1
@ -67,7 +63,3 @@ char db_tok_string[TOK_STRING_SIZE];
#define tSHIFT_L 18
#define tSHIFT_R 19
#define tDOTDOT 20

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_output.c,v 1.26 2001/11/12 22:54:05 lukem Exp $ */
/* $NetBSD: db_output.c,v 1.27 2002/02/15 07:33:51 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
* 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.
*/
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_output.c,v 1.26 2001/11/12 22:54:05 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_output.c,v 1.27 2002/02/15 07:33:51 simonb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -72,67 +72,67 @@ __KERNEL_RCSID(0, "$NetBSD: db_output.c,v 1.26 2001/11/12 22:54:05 lukem Exp $")
#define DB_MIN_MAX_LINE 3 /* minimum max line */
#define CTRL(c) ((c) & 0xff)
int db_output_position = 0; /* output column */
int db_output_line = 0; /* output line number */
int db_last_non_space = 0; /* last non-space character */
int db_tab_stop_width = 8; /* how wide are tab stops? */
int db_max_line = DB_MAX_LINE; /* output max lines */
int db_max_width = DB_MAX_WIDTH; /* output line width */
int db_output_line = 0; /* output line number */
int db_tab_stop_width = 8; /* how wide are tab stops? */
int db_max_line = DB_MAX_LINE; /* output max lines */
int db_max_width = DB_MAX_WIDTH; /* output line width */
static void db_more __P((void));
static int db_output_position = 0; /* output column */
static int db_last_non_space = 0; /* last non-space character */
static void db_more(void);
/*
* Force pending whitespace.
*/
void
db_force_whitespace()
db_force_whitespace(void)
{
int last_print, next_tab;
last_print = db_last_non_space;
while (last_print < db_output_position) {
next_tab = DB_NEXT_TAB(last_print);
if (next_tab <= db_output_position) {
while (last_print < next_tab) { /* DON'T send a tab!!! */
next_tab = DB_NEXT_TAB(last_print);
if (next_tab <= db_output_position) {
while (last_print < next_tab) { /* DON'T send a tab!! */
cnputc(' ');
last_print++;
}
} else {
cnputc(' ');
last_print++;
}
}
else {
cnputc(' ');
last_print++;
}
}
db_last_non_space = db_output_position;
}
static void
db_more()
db_more(void)
{
char *p;
int quit_output = 0;
for (p = "--db_more--"; *p; p++)
cnputc(*p);
cnputc(*p);
switch(cngetc()) {
case ' ':
db_output_line = 0;
break;
db_output_line = 0;
break;
case 'q':
case CTRL('c'):
db_output_line = 0;
quit_output = 1;
break;
db_output_line = 0;
quit_output = 1;
break;
default:
db_output_line--;
break;
db_output_line--;
break;
}
p = "\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b";
while (*p)
cnputc(*p++);
cnputc(*p++);
if (quit_output) {
db_error(0);
/* NOTREACHED */
db_error(0);
/* NOTREACHED */
}
}
@ -140,49 +140,44 @@ db_more()
* Output character. Buffer whitespace.
*/
void
db_putchar(c)
int c; /* character to output */
db_putchar(int c)
{
if (db_max_line >= DB_MIN_MAX_LINE && db_output_line >= db_max_line-1)
db_more();
db_more();
if (c > ' ' && c <= '~') {
/*
* Printing character.
* If we have spaces to print, print them first.
* Use tabs if possible.
*/
db_force_whitespace();
cnputc(c);
db_output_position++;
if (db_max_width >= DB_MIN_MAX_WIDTH
&& db_output_position >= db_max_width) {
/* auto new line */
cnputc('\n');
/*
* Printing character.
* If we have spaces to print, print them first.
* Use tabs if possible.
*/
db_force_whitespace();
cnputc(c);
db_output_position++;
if (db_max_width >= DB_MIN_MAX_WIDTH
&& db_output_position >= db_max_width) {
/* auto new line */
cnputc('\n');
db_output_position = 0;
db_last_non_space = 0;
db_output_line++;
}
db_last_non_space = db_output_position;
} else if (c == '\n') {
/* Return */
cnputc(c);
db_output_position = 0;
db_last_non_space = 0;
db_output_line++;
}
db_last_non_space = db_output_position;
}
else if (c == '\n') {
/* Return */
cnputc(c);
db_output_position = 0;
db_last_non_space = 0;
db_output_line++;
db_check_interrupt();
}
else if (c == '\t') {
/* assume tabs every 8 positions */
db_output_position = DB_NEXT_TAB(db_output_position);
}
else if (c == ' ') {
/* space */
db_output_position++;
}
else if (c == '\007') {
/* bell */
cnputc(c);
db_check_interrupt();
} else if (c == '\t') {
/* assume tabs every 8 positions */
db_output_position = DB_NEXT_TAB(db_output_position);
} else if (c == ' ') {
/* space */
db_output_position++;
} else if (c == '\007') {
/* bell */
cnputc(c);
}
/* other characters are assumed non-printing */
}
@ -191,8 +186,9 @@ db_putchar(c)
* Return output position
*/
int
db_print_position()
db_print_position(void)
{
return (db_output_position);
}
@ -200,21 +196,18 @@ db_print_position()
* End line if too long.
*/
void
db_end_line()
db_end_line(void)
{
if (db_output_position >= db_max_width)
db_printf("\n");
db_printf("\n");
}
/*
* Replacement for old '%r' kprintf format.
*/
void
db_format_radix(buf, bufsiz, val, altflag)
char *buf;
size_t bufsiz;
quad_t val;
int altflag;
db_format_radix(char *buf, size_t bufsiz, quad_t val, int altflag)
{
const char *fmt;
@ -240,11 +233,7 @@ db_format_radix(buf, bufsiz, val, altflag)
* Replacement for old '%z' kprintf format.
*/
void
db_format_hex(buf, bufsiz, val, altflag)
char *buf;
size_t bufsiz;
quad_t val;
int altflag;
db_format_hex(char *buf, size_t bufsiz, quad_t val, int altflag)
{
/* Only use alternate form if val is nonzero. */
const char *fmt = (altflag && val) ? "-%#qx" : "-%qx";

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_output.h,v 1.15 2000/08/09 19:51:46 tv Exp $ */
/* $NetBSD: db_output.h,v 1.16 2002/02/15 07:33:51 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
* 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,19 +32,20 @@
/*
* Printing routines for kernel debugger.
*/
void db_force_whitespace __P((void));
void db_putchar __P((int));
int db_print_position __P((void));
void db_printf __P((const char *, ...))
__attribute__((__format__(__printf__,1,2)));
void db_format_radix __P((char *, size_t, quad_t, int));
void db_format_hex __P((char *, size_t, quad_t, int));
void db_end_line __P((void));
void db_force_whitespace(void);
void db_putchar(int);
int db_print_position(void);
void db_printf(const char *, ...)
__attribute__((__format__(__printf__,1,2)));
void db_format_radix(char *, size_t, quad_t, int);
void db_format_hex(char *, size_t, quad_t, int);
void db_end_line(void);
extern int db_radix;
extern int db_max_width;
extern int db_tab_stop_width;
extern int db_max_line;
extern int db_max_width;
extern int db_output_line;
extern int db_radix;
extern int db_tab_stop_width;
#define DB_NEXT_TAB(i) \
((((i) + db_tab_stop_width) / db_tab_stop_width) * db_tab_stop_width)

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_print.c,v 1.17 2001/11/12 22:54:06 lukem Exp $ */
/* $NetBSD: db_print.c,v 1.18 2002/02/15 07:33:52 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
* 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.
*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_print.c,v 1.17 2001/11/12 22:54:06 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_print.c,v 1.18 2002/02/15 07:33:52 simonb Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -49,34 +49,29 @@ __KERNEL_RCSID(0, "$NetBSD: db_print.c,v 1.17 2001/11/12 22:54:06 lukem Exp $");
/*ARGSUSED*/
void
db_show_regs(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_show_regs(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
const struct db_variable *regp;
struct db_variable vs;
db_expr_t value, offset;
char * name;
db_expr_t value, offset;
char *name;
for (regp = db_regs; regp < db_eregs; regp++) {
vs = *regp;
vs.modif = modif;
db_read_variable(&vs, &value);
db_printf("%-12s%s", vs.name, db_num_to_str(value));
db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset);
if (name != 0 && offset <= db_maxoff && offset != value) {
db_printf("\t%s", name);
if (offset != 0) {
char tbuf[24];
vs = *regp;
vs.modif = modif;
db_read_variable(&vs, &value);
db_printf("%-12s%s", vs.name, db_num_to_str(value));
db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset);
if (name != 0 && offset <= db_maxoff && offset != value) {
db_printf("\t%s", name);
if (offset != 0) {
char tbuf[24];
db_format_radix(tbuf, 24, offset, TRUE);
db_printf("+%s", tbuf);
db_format_radix(tbuf, 24, offset, TRUE);
db_printf("+%s", tbuf);
}
}
}
db_printf("\n");
db_printf("\n");
}
db_print_loc_and_inst(PC_REGS(DDB_REGS));
}

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_run.c,v 1.21 2001/11/12 22:54:06 lukem Exp $ */
/* $NetBSD: db_run.c,v 1.22 2002/02/15 07:33:52 simonb Exp $ */
/*
/*
* Mach Operating System
* Copyright (c) 1993-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
* 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.
*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_run.c,v 1.21 2001/11/12 22:54:06 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_run.c,v 1.22 2002/02/15 07:33:52 simonb Exp $");
#include "opt_ddb.h"
@ -47,9 +47,13 @@ __KERNEL_RCSID(0, "$NetBSD: db_run.c,v 1.21 2001/11/12 22:54:06 lukem Exp $");
#include <ddb/db_access.h>
#include <ddb/db_break.h>
int db_inst_count;
int db_load_count;
int db_store_count;
#ifdef SOFTWARE_SSTEP
static void db_set_temp_breakpoint __P((db_breakpoint_t, db_addr_t));
static void db_delete_temp_breakpoint __P((db_breakpoint_t));
static void db_set_temp_breakpoint(db_breakpoint_t, db_addr_t);
static void db_delete_temp_breakpoint(db_breakpoint_t);
static struct db_breakpoint db_not_taken_bkpt;
static struct db_breakpoint db_taken_bkpt;
#endif
@ -61,7 +65,7 @@ static struct db_breakpoint db_taken_bkpt;
#include <ddb/db_sym.h>
#include <ddb/db_extern.h>
int db_run_mode;
static int db_run_mode;
#define STEP_NONE 0
#define STEP_ONCE 1
#define STEP_RETURN 2
@ -70,14 +74,12 @@ int db_run_mode;
#define STEP_INVISIBLE 5
#define STEP_COUNT 6
boolean_t db_sstep_print;
int db_loop_count;
int db_call_depth;
static boolean_t db_sstep_print;
static int db_loop_count;
static int db_call_depth;
boolean_t
db_stop_at_pc(regs, is_breakpoint)
db_regs_t *regs;
boolean_t *is_breakpoint;
db_stop_at_pc(db_regs_t *regs, boolean_t *is_breakpoint)
{
db_addr_t pc;
db_breakpoint_t bkpt;
@ -113,11 +115,11 @@ db_stop_at_pc(regs, is_breakpoint)
*/
bkpt = db_find_breakpoint_here(pc);
if (bkpt) {
if (--bkpt->count == 0) {
bkpt->count = bkpt->init_count;
*is_breakpoint = TRUE;
return (TRUE); /* stop here */
}
if (--bkpt->count == 0) {
bkpt->count = bkpt->init_count;
*is_breakpoint = TRUE;
return (TRUE); /* stop here */
}
} else if (*is_breakpoint) {
#ifdef PC_ADVANCE
PC_ADVANCE(regs);
@ -125,149 +127,140 @@ db_stop_at_pc(regs, is_breakpoint)
PC_REGS(regs) += BKPT_SIZE;
#endif
}
*is_breakpoint = FALSE;
if (db_run_mode == STEP_INVISIBLE) {
db_run_mode = STEP_CONTINUE;
return (FALSE); /* continue */
db_run_mode = STEP_CONTINUE;
return (FALSE); /* continue */
}
if (db_run_mode == STEP_COUNT) {
return (FALSE); /* continue */
return (FALSE); /* continue */
}
if (db_run_mode == STEP_ONCE) {
if (--db_loop_count > 0) {
if (db_sstep_print) {
db_printf("\t\t");
db_print_loc_and_inst(pc);
db_printf("\n");
if (--db_loop_count > 0) {
if (db_sstep_print) {
db_printf("\t\t");
db_print_loc_and_inst(pc);
db_printf("\n");
}
return (FALSE); /* continue */
}
return (FALSE); /* continue */
}
}
if (db_run_mode == STEP_RETURN) {
db_expr_t ins = db_get_value(pc, sizeof(int), FALSE);
db_expr_t ins = db_get_value(pc, sizeof(int), FALSE);
/* continue until matching return */
/* continue until matching return */
if (!inst_trap_return(ins) &&
(!inst_return(ins) || --db_call_depth != 0)) {
if (db_sstep_print) {
if (inst_call(ins) || inst_return(ins)) {
int i;
if (!inst_trap_return(ins) &&
(!inst_return(ins) || --db_call_depth != 0)) {
if (db_sstep_print) {
if (inst_call(ins) || inst_return(ins)) {
int i;
db_printf("[after %6d] ", db_inst_count);
for (i = db_call_depth; --i > 0; )
db_printf(" ");
db_print_loc_and_inst(pc);
db_printf("\n");
}
db_printf("[after %6d] ",
db_inst_count);
for (i = db_call_depth; --i > 0; )
db_printf(" ");
db_print_loc_and_inst(pc);
db_printf("\n");
}
}
if (inst_call(ins))
db_call_depth++;
return (FALSE); /* continue */
}
if (inst_call(ins))
db_call_depth++;
return (FALSE); /* continue */
}
}
if (db_run_mode == STEP_CALLT) {
db_expr_t ins = db_get_value(pc, sizeof(int), FALSE);
db_expr_t ins = db_get_value(pc, sizeof(int), FALSE);
/* continue until call or return */
/* continue until call or return */
if (!inst_call(ins) &&
!inst_return(ins) &&
!inst_trap_return(ins)) {
return (FALSE); /* continue */
}
if (!inst_call(ins) &&
!inst_return(ins) &&
!inst_trap_return(ins)) {
return (FALSE); /* continue */
}
}
db_run_mode = STEP_NONE;
return (TRUE);
}
void
db_restart_at_pc(regs, watchpt)
db_regs_t *regs;
boolean_t watchpt;
db_restart_at_pc(db_regs_t *regs, boolean_t watchpt)
{
db_addr_t pc = PC_REGS(regs);
#ifdef SOFTWARE_SSTEP
db_addr_t brpc;
#endif
if ((db_run_mode == STEP_COUNT) ||
(db_run_mode == STEP_RETURN) ||
(db_run_mode == STEP_CALLT)) {
db_expr_t ins;
db_expr_t ins;
/*
* We are about to execute this instruction,
* so count it now.
*/
ins = db_get_value(pc, sizeof(int), FALSE);
db_inst_count++;
db_load_count += inst_load(ins);
db_store_count += inst_store(ins);
/*
* We are about to execute this instruction,
* so count it now.
*/
ins = db_get_value(pc, sizeof(int), FALSE);
db_inst_count++;
db_load_count += inst_load(ins);
db_store_count += inst_store(ins);
#ifdef SOFTWARE_SSTEP
/*
* Account for instructions in delay slots.
*/
{
db_addr_t brpc;
/*
* Account for instructions in delay slots.
*/
brpc = next_instr_address(pc, TRUE);
if ((brpc != pc) &&
(inst_branch(ins) || inst_call(ins) || inst_return(ins))) {
ins = db_get_value(brpc, sizeof(int), FALSE);
db_inst_count++;
db_load_count += inst_load(ins);
db_store_count += inst_store(ins);
ins = db_get_value(brpc, sizeof(int), FALSE);
db_inst_count++;
db_load_count += inst_load(ins);
db_store_count += inst_store(ins);
}
}
#endif
}
if (db_run_mode == STEP_CONTINUE) {
if (watchpt || db_find_breakpoint_here(pc)) {
/*
* Step over breakpoint/watchpoint.
*/
db_run_mode = STEP_INVISIBLE;
db_set_single_step(regs);
} else {
db_set_breakpoints();
db_set_watchpoints();
}
if (watchpt || db_find_breakpoint_here(pc)) {
/*
* Step over breakpoint/watchpoint.
*/
db_run_mode = STEP_INVISIBLE;
db_set_single_step(regs);
} else {
db_set_breakpoints();
db_set_watchpoints();
}
} else {
db_set_single_step(regs);
db_set_single_step(regs);
}
}
void
db_single_step(regs)
db_regs_t *regs;
db_single_step(db_regs_t *regs)
{
if (db_run_mode == STEP_CONTINUE) {
db_run_mode = STEP_INVISIBLE;
db_set_single_step(regs);
db_run_mode = STEP_INVISIBLE;
db_set_single_step(regs);
}
}
extern int db_cmd_loop_done;
/* single-step */
/*ARGSUSED*/
void
db_single_step_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_single_step_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
boolean_t print = FALSE;
boolean_t print = FALSE;
if (count == -1)
count = 1;
count = 1;
if (modif[0] == 'p')
print = TRUE;
print = TRUE;
db_run_mode = STEP_ONCE;
db_loop_count = count;
@ -282,16 +275,13 @@ db_single_step_cmd(addr, have_addr, count, modif)
/* trace and print until call/return */
/*ARGSUSED*/
void
db_trace_until_call_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_trace_until_call_cmd(db_expr_t addr, int have_addr, db_expr_t count,
char *modif)
{
boolean_t print = FALSE;
boolean_t print = FALSE;
if (modif[0] == 'p')
print = TRUE;
print = TRUE;
db_run_mode = STEP_CALLT;
db_sstep_print = print;
@ -304,16 +294,13 @@ db_trace_until_call_cmd(addr, have_addr, count, modif)
/*ARGSUSED*/
void
db_trace_until_matching_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_trace_until_matching_cmd(db_expr_t addr, int have_addr, db_expr_t count,
char *modif)
{
boolean_t print = FALSE;
boolean_t print = FALSE;
if (modif[0] == 'p')
print = TRUE;
print = TRUE;
db_run_mode = STEP_RETURN;
db_call_depth = 1;
@ -328,16 +315,13 @@ db_trace_until_matching_cmd(addr, have_addr, count, modif)
/* continue */
/*ARGSUSED*/
void
db_continue_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_continue_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
if (modif[0] == 'c')
db_run_mode = STEP_COUNT;
db_run_mode = STEP_COUNT;
else
db_run_mode = STEP_CONTINUE;
db_run_mode = STEP_CONTINUE;
db_inst_count = 0;
db_load_count = 0;
db_store_count = 0;
@ -377,7 +361,7 @@ db_continue_cmd(addr, have_addr, count, modif)
* If one of these addresses does not already have a breakpoint,
* we allocate a breakpoint and save it here.
* These breakpoints are deleted on return.
*/
*/
#if !defined(DDB)
/* XXX - don't check for existing breakpoints in KGDB-only case */
@ -385,8 +369,7 @@ db_continue_cmd(addr, have_addr, count, modif)
#endif
void
db_set_single_step(regs)
db_regs_t *regs;
db_set_single_step(db_regs_t *regs)
{
db_addr_t pc = PC_REGS(regs), brpc = pc;
boolean_t unconditional;
@ -439,8 +422,7 @@ db_set_single_step(regs)
}
void
db_clear_single_step(regs)
db_regs_t *regs;
db_clear_single_step(db_regs_t *regs)
{
if (db_taken_bkpt.address != 0)
@ -451,9 +433,7 @@ db_clear_single_step(regs)
}
void
db_set_temp_breakpoint(bkpt, addr)
db_breakpoint_t bkpt;
db_addr_t addr;
db_set_temp_breakpoint(db_breakpoint_t bkpt, db_addr_t addr)
{
bkpt->map = NULL;
@ -467,11 +447,10 @@ db_set_temp_breakpoint(bkpt, addr)
}
void
db_delete_temp_breakpoint(bkpt)
db_breakpoint_t bkpt;
db_delete_temp_breakpoint(db_breakpoint_t bkpt)
{
db_put_value(bkpt->address, BKPT_SIZE, bkpt->bkpt_inst);
bkpt->address = 0;
}
#endif /* SOFTWARE_SSTEP */

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_run.h,v 1.6 2001/02/15 21:59:38 cgd Exp $ */
/* $NetBSD: db_run.h,v 1.7 2002/02/15 07:33:52 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
* 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.
*
@ -35,22 +35,22 @@
/*
* Commands to run process.
*/
int db_inst_count;
int db_load_count;
int db_store_count;
extern int db_inst_count;
extern int db_load_count;
extern int db_store_count;
boolean_t db_stop_at_pc __P((db_regs_t *, boolean_t *));
void db_restart_at_pc __P((db_regs_t *, boolean_t));
void db_single_step __P((db_regs_t *));
boolean_t db_stop_at_pc(db_regs_t *, boolean_t *);
void db_restart_at_pc(db_regs_t *, boolean_t);
void db_single_step(db_regs_t *);
#ifndef db_set_single_step
void db_set_single_step __P((db_regs_t *));
void db_set_single_step(db_regs_t *);
#endif
#ifndef db_clear_single_step
void db_clear_single_step __P((db_regs_t *));
void db_clear_single_step(db_regs_t *);
#endif
void db_single_step_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_trace_until_call_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_trace_until_matching_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_continue_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_single_step_cmd(db_expr_t, int, db_expr_t, char *);
void db_trace_until_call_cmd(db_expr_t, int, db_expr_t, char *);
void db_trace_until_matching_cmd(db_expr_t, int, db_expr_t, char *);
void db_continue_cmd(db_expr_t, int, db_expr_t, char *);
#endif /* _DDB_DB_RUN_ */

View File

@ -1,33 +1,33 @@
/* $NetBSD: db_sym.c,v 1.30 2002/01/05 20:09:52 jhawk Exp $ */
/* $NetBSD: db_sym.c,v 1.31 2002/02/15 07:33:52 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
* 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_sym.c,v 1.30 2002/01/05 20:09:52 jhawk Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.31 2002/02/15 07:33:52 simonb Exp $");
#include "opt_ddb.h"
@ -54,7 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.30 2002/01/05 20:09:52 jhawk Exp $");
#define MAXNOSYMTABS MAXLKMS+1 /* Room for kernel + LKM's */
#endif
db_symtab_t db_symtabs[MAXNOSYMTABS] = {{0,},};
static db_symtab_t db_symtabs[MAXNOSYMTABS] = {{0,},};
db_symtab_t *db_last_symtab;
@ -65,13 +65,16 @@ char db_symtab[SYMTAB_SPACE] = SYMTAB_FILLER;
int db_symtabsize = SYMTAB_SPACE;
#endif
static char *db_qualify __P((db_sym_t, const char *));
static char *db_qualify(db_sym_t, const char *);
static boolean_t db_line_at_pc(db_sym_t, char **, int *, db_expr_t);
static db_sym_t db_lookup(char *);
static db_forall_func_t db_sift;
/*
* Put the most picky symbol table formats at the top!
*/
const db_symformat_t * const db_symformats[] = {
static const db_symformat_t * const db_symformats[] = {
#ifdef DB_ELF_SYMBOLS
&db_symformat_elf,
#endif
@ -83,18 +86,17 @@ const db_symformat_t * const db_symformats[] = {
const db_symformat_t *db_symformat;
boolean_t X_db_sym_init __P((int, void *, void *, const char *));
db_sym_t X_db_lookup __P((db_symtab_t *, char *));
db_sym_t X_db_search_symbol __P((db_symtab_t *, db_addr_t,
db_strategy_t, db_expr_t *));
void X_db_symbol_values __P((db_symtab_t *, db_sym_t, char **,
db_expr_t *));
boolean_t X_db_line_at_pc __P((db_symtab_t *, db_sym_t, char **,
int *, db_expr_t));
int X_db_sym_numargs __P((db_symtab_t *, db_sym_t, int *,
char **));
void X_db_forall __P((db_symtab_t *,
db_forall_func_t db_forall_func, void *));
static boolean_t X_db_sym_init(int, void *, void *, const char *);
static db_sym_t X_db_lookup(db_symtab_t *, char *);
static db_sym_t X_db_search_symbol(db_symtab_t *, db_addr_t, db_strategy_t,
db_expr_t *);
static void X_db_symbol_values(db_symtab_t *, db_sym_t, char **,
db_expr_t *);
static boolean_t X_db_line_at_pc(db_symtab_t *, db_sym_t, char **, int *,
db_expr_t);
static int X_db_sym_numargs(db_symtab_t *, db_sym_t, int *, char **);
static void X_db_forall(db_symtab_t *, db_forall_func_t db_forall_func,
void *);
/*
* Initialize the kernel debugger by initializing the master symbol
@ -102,9 +104,7 @@ void X_db_forall __P((db_symtab_t *,
* no other symbol tables can be loaded.
*/
void
ddb_init(symsize, vss, vse)
int symsize;
void *vss, *vse;
ddb_init(int symsize, void *vss, void *vse)
{
const db_symformat_t * const *symf;
const char *name = "netbsd";
@ -150,11 +150,7 @@ ddb_init(symsize, vss, vse)
* Add symbol table, with given name, to list of symbol tables.
*/
int
db_add_symbol_table(start, end, name, ref)
char *start;
char *end;
const char *name;
char *ref;
db_add_symbol_table(char *start, char *end, const char *name, char *ref)
{
int slot;
@ -179,8 +175,7 @@ db_add_symbol_table(start, end, name, ref)
* Delete a symbol table. Caller is responsible for freeing storage.
*/
void
db_del_symbol_table(name)
char *name;
db_del_symbol_table(char *name)
{
int slot;
@ -207,12 +202,10 @@ db_del_symbol_table(name)
* overwritten by each call... but in practice this seems okay.
*/
static char *
db_qualify(sym, symtabname)
db_sym_t sym;
const char *symtabname;
db_qualify(db_sym_t sym, const char *symtabname)
{
char *symname;
static char tmp[256];
static char tmp[256];
char *s;
db_symbol_values(sym, &symname, 0);
@ -227,28 +220,24 @@ db_qualify(sym, symtabname)
boolean_t
db_eqname(src, dst, c)
char *src;
char *dst;
int c;
db_eqname(char *src, char *dst, int c)
{
if (!strcmp(src, dst))
return (TRUE);
return (TRUE);
if (src[0] == c)
return (!strcmp(src+1,dst));
return (!strcmp(src+1,dst));
return (FALSE);
}
boolean_t
db_value_of_name(name, valuep)
char *name;
db_expr_t *valuep;
db_value_of_name(char *name, db_expr_t *valuep)
{
db_sym_t sym;
sym = db_lookup(name);
if (sym == DB_SYM_NULL)
return (FALSE);
return (FALSE);
db_symbol_values(sym, &name, valuep);
return (TRUE);
}
@ -260,9 +249,8 @@ db_value_of_name(name, valuep)
* then only the specified symbol table will be searched;
* otherwise, all symbol tables will be searched.
*/
db_sym_t
db_lookup(symstr)
char *symstr;
static db_sym_t
db_lookup(char *symstr)
{
db_sym_t sp;
int i;
@ -298,7 +286,7 @@ db_lookup(symstr)
* Return on first match.
*/
for (i = symtab_start; i < symtab_end; i++) {
if (db_symtabs[i].name &&
if (db_symtabs[i].name &&
(sp = X_db_lookup(&db_symtabs[i], symstr))) {
db_last_symtab = &db_symtabs[i];
return sp;
@ -319,13 +307,8 @@ struct db_sift_args {
* criteria.
*/
static void
db_sift(stab, sym, name, suffix, prefix, arg)
db_symtab_t *stab;
db_sym_t sym;
char *name;
char *suffix;
int prefix;
void *arg;
db_sift(db_symtab_t *stab, db_sym_t sym, char *name, char *suffix, int prefix,
void *arg)
{
char c, sc;
char *find, *p;
@ -336,7 +319,7 @@ db_sift(stab, sym, name, suffix, prefix, arg)
find = dsa->symstr; /* String we're looking for. */
p = name; /* String we're searching within. */
/* Matching algorithm cribbed from strstr(), which is not
in the kernel. */
if ((c = *find++) != 0) {
@ -364,9 +347,7 @@ db_sift(stab, sym, name, suffix, prefix, arg)
* "mode" is how-to-display, set from modifiers.
*/
void
db_sifting(symstr, mode)
char *symstr;
int mode;
db_sifting(char *symstr, int mode)
{
char *cp;
int i;
@ -422,8 +403,7 @@ db_sifting(symstr, mode)
boolean_t db_qualify_ambiguous_names = FALSE;
boolean_t
db_symbol_is_ambiguous(sym)
db_sym_t sym;
db_symbol_is_ambiguous(db_sym_t sym)
{
char *sym_name;
int i;
@ -449,10 +429,7 @@ db_symbol_is_ambiguous(sym)
* and the difference between val and the symbol found.
*/
db_sym_t
db_search_symbol( val, strategy, offp)
db_addr_t val;
db_strategy_t strategy;
db_expr_t *offp;
db_search_symbol(db_addr_t val, db_strategy_t strategy, db_expr_t *offp)
{
unsigned int diff;
db_expr_t newdiff;
@ -462,14 +439,15 @@ db_search_symbol( val, strategy, offp)
newdiff = diff = ~0;
db_last_symtab = 0;
for (i = 0; i < MAXNOSYMTABS; i++) {
if (!db_symtabs[i].name)
continue;
sym = X_db_search_symbol(&db_symtabs[i], val, strategy, &newdiff);
if (newdiff < diff) {
db_last_symtab = &db_symtabs[i];
diff = newdiff;
ret = sym;
}
if (!db_symtabs[i].name)
continue;
sym = X_db_search_symbol(&db_symtabs[i], val, strategy,
&newdiff);
if (newdiff < diff) {
db_last_symtab = &db_symtabs[i];
diff = newdiff;
ret = sym;
}
}
*offp = diff;
return ret;
@ -479,10 +457,7 @@ db_search_symbol( val, strategy, offp)
* Return name and value of a symbol
*/
void
db_symbol_values(sym, namep, valuep)
db_sym_t sym;
char **namep;
db_expr_t *valuep;
db_symbol_values(db_sym_t sym, char **namep, db_expr_t *valuep)
{
db_expr_t value;
@ -523,10 +498,7 @@ unsigned long db_lastsym = (unsigned long)end;
unsigned int db_maxoff = 0x10000000;
void
db_symstr(buf, off, strategy)
char *buf;
db_expr_t off;
db_strategy_t strategy;
db_symstr(char *buf, db_expr_t off, db_strategy_t strategy)
{
db_expr_t d;
char *filename;
@ -558,10 +530,8 @@ db_symstr(buf, off, strategy)
}
void
db_printsym(off, strategy, pr)
db_expr_t off;
db_strategy_t strategy;
void (*pr) __P((const char *, ...));
db_printsym(db_expr_t off, db_strategy_t strategy,
void (*pr)(const char *, ...))
{
db_expr_t d;
char *filename;
@ -593,30 +563,22 @@ db_printsym(off, strategy, pr)
}
boolean_t
db_line_at_pc( sym, filename, linenum, pc)
db_sym_t sym;
char **filename;
int *linenum;
db_expr_t pc;
static boolean_t
db_line_at_pc(db_sym_t sym, char **filename, int *linenum, db_expr_t pc)
{
return X_db_line_at_pc( db_last_symtab, sym, filename, linenum, pc);
}
int
db_sym_numargs(sym, nargp, argnames)
db_sym_t sym;
int *nargp;
char **argnames;
db_sym_numargs(db_sym_t sym, int *nargp, char **argnames)
{
return X_db_sym_numargs(db_last_symtab, sym, nargp, argnames);
}
boolean_t
X_db_sym_init(symsize, vss, vse, name)
int symsize;
void *vss, *vse;
const char *name;
static boolean_t
X_db_sym_init(int symsize, void *vss, void *vse, const char *name)
{
if (db_symformat != NULL)
@ -624,10 +586,8 @@ X_db_sym_init(symsize, vss, vse, name)
return (FALSE);
}
db_sym_t
X_db_lookup(stab, symstr)
db_symtab_t *stab;
char *symstr;
static db_sym_t
X_db_lookup(db_symtab_t *stab, char *symstr)
{
if (db_symformat != NULL)
@ -635,12 +595,9 @@ X_db_lookup(stab, symstr)
return ((db_sym_t)0);
}
db_sym_t
X_db_search_symbol(stab, off, strategy, diffp)
db_symtab_t *stab;
db_addr_t off;
db_strategy_t strategy;
db_expr_t *diffp;
static db_sym_t
X_db_search_symbol(db_symtab_t *stab, db_addr_t off, db_strategy_t strategy,
db_expr_t *diffp)
{
if (db_symformat != NULL)
@ -649,25 +606,18 @@ X_db_search_symbol(stab, off, strategy, diffp)
return ((db_sym_t)0);
}
void
X_db_symbol_values(stab, sym, namep, valuep)
db_symtab_t *stab;
db_sym_t sym;
char **namep;
db_expr_t *valuep;
static void
X_db_symbol_values(db_symtab_t *stab, db_sym_t sym, char **namep,
db_expr_t *valuep)
{
if (db_symformat != NULL)
if (db_symformat != NULL)
(*db_symformat->sym_value)(stab, sym, namep, valuep);
}
boolean_t
X_db_line_at_pc(stab, cursym, filename, linenum, off)
db_symtab_t *stab;
db_sym_t cursym;
char **filename;
int *linenum;
db_expr_t off;
static boolean_t
X_db_line_at_pc(db_symtab_t *stab, db_sym_t cursym, char **filename,
int *linenum, db_expr_t off)
{
if (db_symformat != NULL)
@ -676,12 +626,9 @@ X_db_line_at_pc(stab, cursym, filename, linenum, off)
return (FALSE);
}
boolean_t
X_db_sym_numargs(stab, cursym, nargp, argnamep)
db_symtab_t *stab;
db_sym_t cursym;
int *nargp;
char **argnamep;
static boolean_t
X_db_sym_numargs(db_symtab_t *stab, db_sym_t cursym, int *nargp,
char **argnamep)
{
if (db_symformat != NULL)
@ -690,12 +637,10 @@ X_db_sym_numargs(stab, cursym, nargp, argnamep)
return (FALSE);
}
void
X_db_forall(stab, db_forall_func, arg)
db_symtab_t *stab;
db_forall_func_t db_forall_func;
void *arg;
static void
X_db_forall(db_symtab_t *stab, db_forall_func_t db_forall_func, void *arg)
{
if (db_symformat != NULL)
(*db_symformat->sym_forall)(stab, db_forall_func, arg);
}

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_sym.h,v 1.15 2002/01/05 20:09:52 jhawk Exp $ */
/* $NetBSD: db_sym.h,v 1.16 2002/02/15 07:33:53 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
* 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.
*
@ -73,26 +73,25 @@ typedef int db_strategy_t; /* search strategy */
* in a.out), and arg an opaque argument to be passed in.
*/
typedef void (db_forall_func_t)
__P((db_symtab_t *, db_sym_t, char *, char *, int, void *));
(db_symtab_t *, db_sym_t, char *, char *, int, void *);
/*
* A symbol table may be in one of many formats. All symbol tables
* must be of the same format as the master kernel symbol table.
*/
typedef struct {
const char *sym_format;
boolean_t (*sym_init) __P((int, void *, void *, const char *));
db_sym_t (*sym_lookup) __P((db_symtab_t *, char *));
db_sym_t (*sym_search) __P((db_symtab_t *, db_addr_t, db_strategy_t,
db_expr_t *));
void (*sym_value) __P((db_symtab_t *, db_sym_t, char **,
db_expr_t *));
boolean_t (*sym_line_at_pc) __P((db_symtab_t *, db_sym_t,
char **, int *, db_expr_t));
boolean_t (*sym_numargs) __P((db_symtab_t *, db_sym_t, int *,
char **));
void (*sym_forall) __P((db_symtab_t *,
db_forall_func_t *db_forall_func, void *));
const char *sym_format;
boolean_t (*sym_init)(int, void *, void *, const char *);
db_sym_t (*sym_lookup)(db_symtab_t *, char *);
db_sym_t (*sym_search)(db_symtab_t *, db_addr_t, db_strategy_t,
db_expr_t *);
void (*sym_value)(db_symtab_t *, db_sym_t, char **,
db_expr_t *);
boolean_t (*sym_line_at_pc)(db_symtab_t *, db_sym_t, char **,
int *, db_expr_t);
boolean_t (*sym_numargs)(db_symtab_t *, db_sym_t, int *, char **);
void (*sym_forall)(db_symtab_t *,
db_forall_func_t *db_forall_func, void *);
} db_symformat_t;
extern boolean_t db_qualify_ambiguous_names;
@ -101,32 +100,31 @@ extern boolean_t db_qualify_ambiguous_names;
* Might slow down quite a bit */
extern unsigned int db_maxoff; /* like gdb's "max-symbolic-offset" */
/*
* Functions exported by the symtable module
*/
int db_add_symbol_table __P((char *, char *, const char *, char *));
int db_add_symbol_table(char *, char *, const char *, char *);
/* extend the list of symbol tables */
void db_del_symbol_table __P((char *));
void db_del_symbol_table(char *);
/* remove a symbol table from list */
boolean_t db_eqname __P((char *, char *, int));
boolean_t db_eqname(char *, char *, int);
/* strcmp, modulo leading char */
int db_value_of_name __P((char *, db_expr_t *));
int db_value_of_name(char *, db_expr_t *);
/* find symbol value given name */
db_sym_t db_lookup __P((char *));
void db_sifting __P((char *, int));
void db_sifting(char *, int);
/* print partially matching symbol names */
boolean_t db_symbol_is_ambiguous __P((db_sym_t));
boolean_t db_symbol_is_ambiguous(db_sym_t);
db_sym_t db_search_symbol __P((db_addr_t, db_strategy_t, db_expr_t *));
db_sym_t db_search_symbol(db_addr_t, db_strategy_t, db_expr_t *);
/* find symbol given value */
void db_symbol_values __P((db_sym_t, char **, db_expr_t *));
void db_symbol_values(db_sym_t, char **, db_expr_t *);
/* return name and value of symbol */
#define db_find_sym_and_offset(val,namep,offp) \
@ -137,13 +135,12 @@ void db_symbol_values __P((db_sym_t, char **, db_expr_t *));
db_symbol_values(db_search_symbol(val,DB_STGY_XTRN,offp),namep,0)
/* ditto, but no locals */
void db_symstr(char *, db_expr_t, db_strategy_t);
void db_printsym __P((db_expr_t, db_strategy_t, void(*)(const char *, ...)));
void db_symstr(char *, db_expr_t, db_strategy_t);
void db_printsym(db_expr_t, db_strategy_t,
void(*)(const char *, ...));
/* print closest symbol to a value */
boolean_t db_line_at_pc __P((db_sym_t, char **, int *, db_expr_t));
int db_sym_numargs __P((db_sym_t, int *, char **));
int db_sym_numargs(db_sym_t, int *, char **);
#ifdef DB_AOUT_SYMBOLS
extern const db_symformat_t db_symformat_aout;

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_trap.c,v 1.18 2001/11/12 22:54:07 lukem Exp $ */
/* $NetBSD: db_trap.c,v 1.19 2002/02/15 07:33:53 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
* 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.
*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_trap.c,v 1.18 2001/11/12 22:54:07 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_trap.c,v 1.19 2002/02/15 07:33:53 simonb Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -55,8 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_trap.c,v 1.18 2001/11/12 22:54:07 lukem Exp $");
void (*db_trap_callback)(int);
void
db_trap(type, code)
int type, code;
db_trap(int type, int code)
{
boolean_t bkpt;
boolean_t watchpt;
@ -67,32 +66,34 @@ db_trap(type, code)
if (db_trap_callback) db_trap_callback(1);
if (db_stop_at_pc(DDB_REGS, &bkpt)) {
if (db_inst_count) {
db_printf("After %d instructions (%d loads, %d stores),\n",
db_inst_count, db_load_count, db_store_count);
}
if (curproc != NULL) {
if (bkpt)
db_printf("Breakpoint");
if (db_inst_count) {
db_printf("After %d instructions "
"(%d loads, %d stores),\n",
db_inst_count, db_load_count, db_store_count);
}
if (curproc != NULL) {
if (bkpt)
db_printf("Breakpoint");
else if (watchpt)
db_printf("Watchpoint");
else
db_printf("Stopped");
db_printf(" in pid %d (%s) at\t", curproc->p_pid,
curproc->p_comm);
} else if (bkpt)
db_printf("Breakpoint at\t");
else if (watchpt)
db_printf("Watchpoint");
db_printf("Watchpoint at\t");
else
db_printf("Stopped");
db_printf(" in pid %d (%s) at\t", curproc->p_pid,
curproc->p_comm);
} else if (bkpt)
db_printf("Breakpoint at\t");
else if (watchpt)
db_printf("Watchpoint at\t");
else
db_printf("Stopped at\t");
db_dot = PC_REGS(DDB_REGS);
db_print_loc_and_inst(db_dot);
db_printf("Stopped at\t");
db_dot = PC_REGS(DDB_REGS);
db_print_loc_and_inst(db_dot);
db_command_loop();
db_command_loop();
}
db_restart_at_pc(DDB_REGS, watchpt);
if (db_trap_callback) db_trap_callback(0);
if (db_trap_callback)
db_trap_callback(0);
}

View File

@ -1,33 +1,33 @@
/* $NetBSD: db_variables.c,v 1.23 2001/11/20 08:43:44 lukem Exp $ */
/* $NetBSD: db_variables.c,v 1.24 2002/02/15 07:33:53 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
* 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_variables.c,v 1.23 2001/11/20 08:43:44 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_variables.c,v 1.24 2002/02/15 07:33:53 simonb Exp $");
#include "opt_ddb.h"
@ -65,9 +65,9 @@ int db_onpanic = DDB_ONPANIC;
#endif
int db_fromconsole = DDB_FROMCONSOLE;
static int db_rw_internal_variable __P((const struct db_variable *,
db_expr_t *, int));
static int db_rw_internal_variable(const struct db_variable *, db_expr_t *,
int);
static int db_find_variable(const struct db_variable **);
/* XXX must all be ints for sysctl. */
const struct db_variable db_vars[] = {
@ -85,17 +85,13 @@ const struct db_variable * const db_evars = db_vars + sizeof(db_vars)/sizeof(db_
* ddb command line access to the DDB variables defined above.
*/
static int
db_rw_internal_variable(vp, valp, rw)
const struct db_variable *vp;
db_expr_t *valp;
int rw;
db_rw_internal_variable(const struct db_variable *vp, db_expr_t *valp, int rw)
{
if (rw == DB_VAR_GET) {
if (rw == DB_VAR_GET)
*valp = *(int *)vp->valuep;
} else {
else
*(int *)vp->valuep = *valp;
}
return (0);
}
@ -103,14 +99,8 @@ db_rw_internal_variable(vp, valp, rw)
* sysctl(3) access to the DDB variables defined above.
*/
int
ddb_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
void *oldp;
size_t *oldlenp;
void *newp;
size_t newlen;
struct proc *p;
ddb_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen, struct proc *p)
{
/* All sysctl names at this level are terminal. */
@ -146,26 +136,25 @@ ddb_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
}
int
db_find_variable(varp)
const struct db_variable **varp;
db_find_variable(const struct db_variable **varp)
{
int t;
const struct db_variable *vp;
t = db_read_token();
if (t == tIDENT) {
for (vp = db_vars; vp < db_evars; vp++) {
if (!strcmp(db_tok_string, vp->name)) {
*varp = vp;
return (1);
for (vp = db_vars; vp < db_evars; vp++) {
if (!strcmp(db_tok_string, vp->name)) {
*varp = vp;
return (1);
}
}
}
for (vp = db_regs; vp < db_eregs; vp++) {
if (!strcmp(db_tok_string, vp->name)) {
*varp = vp;
return (1);
for (vp = db_regs; vp < db_eregs; vp++) {
if (!strcmp(db_tok_string, vp->name)) {
*varp = vp;
return (1);
}
}
}
}
db_error("Unknown variable\n");
/*NOTREACHED*/
@ -173,13 +162,12 @@ db_find_variable(varp)
}
int
db_get_variable(valuep)
db_expr_t *valuep;
db_get_variable(db_expr_t *valuep)
{
const struct db_variable *vp;
if (!db_find_variable(&vp))
return (0);
return (0);
db_read_variable(vp, valuep);
@ -187,13 +175,12 @@ db_get_variable(valuep)
}
int
db_set_variable(value)
db_expr_t value;
db_set_variable(db_expr_t value)
{
const struct db_variable *vp;
if (!db_find_variable(&vp))
return (0);
return (0);
db_write_variable(vp, &value);
@ -202,38 +189,30 @@ db_set_variable(value)
void
db_read_variable(vp, valuep)
const struct db_variable *vp;
db_expr_t *valuep;
db_read_variable(const struct db_variable *vp, db_expr_t *valuep)
{
int (*func) __P((const struct db_variable *, db_expr_t *, int)) = vp->fcn;
int (*func)(const struct db_variable *, db_expr_t *, int) = vp->fcn;
if (func == FCN_NULL)
*valuep = *(vp->valuep);
*valuep = *(vp->valuep);
else
(*func)(vp, valuep, DB_VAR_GET);
(*func)(vp, valuep, DB_VAR_GET);
}
void
db_write_variable(vp, valuep)
const struct db_variable *vp;
db_expr_t *valuep;
db_write_variable(const struct db_variable *vp, db_expr_t *valuep)
{
int (*func) __P((const struct db_variable *, db_expr_t *, int)) = vp->fcn;
int (*func)(const struct db_variable *, db_expr_t *, int) = vp->fcn;
if (func == FCN_NULL)
*(vp->valuep) = *valuep;
*(vp->valuep) = *valuep;
else
(*func)(vp, valuep, DB_VAR_SET);
(*func)(vp, valuep, DB_VAR_SET);
}
/*ARGSUSED*/
void
db_set_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_set_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
db_expr_t value;
db_expr_t old_value;
@ -242,25 +221,25 @@ db_set_cmd(addr, have_addr, count, modif)
t = db_read_token();
if (t != tDOLLAR) {
db_error("Unknown variable\n");
/*NOTREACHED*/
db_error("Unknown variable\n");
/*NOTREACHED*/
}
if (!db_find_variable(&vp)) {
db_error("Unknown variable\n");
/*NOTREACHED*/
db_error("Unknown variable\n");
/*NOTREACHED*/
}
t = db_read_token();
if (t != tEQ)
db_unread_token(t);
db_unread_token(t);
if (!db_expression(&value)) {
db_error("No value\n");
/*NOTREACHED*/
db_error("No value\n");
/*NOTREACHED*/
}
if (db_read_token() != tEOL) {
db_error("?\n");
/*NOTREACHED*/
db_error("?\n");
/*NOTREACHED*/
}
db_read_variable(vp, &old_value);

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_variables.h,v 1.11 2001/05/13 01:38:53 ross Exp $ */
/* $NetBSD: db_variables.h,v 1.12 2002/02/15 07:33:54 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
* 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.
*
@ -39,23 +39,22 @@ struct db_variable {
const char *name; /* Name of variable */
long *valuep; /* value of variable */
/* function to call when reading/writing */
int (*fcn) __P((const struct db_variable *, db_expr_t *, int));
int (*fcn)(const struct db_variable *, db_expr_t *, int);
char *modif;
#define DB_VAR_GET 0
#define DB_VAR_SET 1
};
#define FCN_NULL ((int (*) __P((const struct db_variable *, db_expr_t *, int)))0)
#define FCN_NULL ((int (*)(const struct db_variable *, db_expr_t *, int))0)
extern const struct db_variable db_vars[]; /* debugger variables */
extern const struct db_variable * const db_evars;
extern const struct db_variable db_regs[]; /* machine registers */
extern const struct db_variable * const db_eregs;
int db_find_variable __P((const struct db_variable **));
int db_get_variable __P((db_expr_t *));
int db_set_variable __P((db_expr_t));
void db_read_variable __P((const struct db_variable *, db_expr_t *));
void db_write_variable __P((const struct db_variable *, db_expr_t *));
void db_set_cmd __P((db_expr_t, int, db_expr_t, char *));
int db_get_variable(db_expr_t *);
int db_set_variable(db_expr_t);
void db_read_variable(const struct db_variable *, db_expr_t *);
void db_write_variable(const struct db_variable *, db_expr_t *);
void db_set_cmd(db_expr_t, int, db_expr_t, char *);
#endif /* _DB_VARIABLES_H_ */

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_watch.c,v 1.18 2001/11/12 22:54:07 lukem Exp $ */
/* $NetBSD: db_watch.c,v 1.19 2002/02/15 07:33:54 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
* 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_watch.c,v 1.18 2001/11/12 22:54:07 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_watch.c,v 1.19 2002/02/15 07:33:54 simonb Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -51,26 +51,32 @@ __KERNEL_RCSID(0, "$NetBSD: db_watch.c,v 1.18 2001/11/12 22:54:07 lukem Exp $");
* Watchpoints.
*/
boolean_t db_watchpoints_inserted = TRUE;
static boolean_t db_watchpoints_inserted = TRUE;
#define NWATCHPOINTS 100
struct db_watchpoint db_watch_table[NWATCHPOINTS];
db_watchpoint_t db_next_free_watchpoint = &db_watch_table[0];
db_watchpoint_t db_free_watchpoints = 0;
db_watchpoint_t db_watchpoint_list = 0;
static struct db_watchpoint db_watch_table[NWATCHPOINTS];
static db_watchpoint_t db_next_free_watchpoint = &db_watch_table[0];
static db_watchpoint_t db_free_watchpoints = 0;
static db_watchpoint_t db_watchpoint_list = 0;
static void db_delete_watchpoint(struct vm_map *, db_addr_t);
static void db_list_watchpoints(void);
static void db_set_watchpoint(struct vm_map *, db_addr_t, vsize_t);
static db_watchpoint_t db_watchpoint_alloc(void);
static void db_watchpoint_free(db_watchpoint_t);
db_watchpoint_t
db_watchpoint_alloc()
db_watchpoint_alloc(void)
{
db_watchpoint_t watch;
if ((watch = db_free_watchpoints) != 0) {
db_free_watchpoints = watch->link;
return (watch);
db_free_watchpoints = watch->link;
return (watch);
}
if (db_next_free_watchpoint == &db_watch_table[NWATCHPOINTS]) {
db_printf("All watchpoints used.\n");
return (0);
db_printf("All watchpoints used.\n");
return (0);
}
watch = db_next_free_watchpoint;
db_next_free_watchpoint++;
@ -79,44 +85,38 @@ db_watchpoint_alloc()
}
void
db_watchpoint_free(watch)
db_watchpoint_t watch;
db_watchpoint_free(db_watchpoint_t watch)
{
watch->link = db_free_watchpoints;
db_free_watchpoints = watch;
}
void
db_set_watchpoint(map, addr, size)
struct vm_map *map;
db_addr_t addr;
vsize_t size;
db_set_watchpoint(struct vm_map *map, db_addr_t addr, vsize_t size)
{
db_watchpoint_t watch;
if (map == NULL) {
db_printf("No map.\n");
return;
db_printf("No map.\n");
return;
}
/*
* Should we do anything fancy with overlapping regions?
*/
for (watch = db_watchpoint_list;
watch != 0;
watch = watch->link)
if (db_map_equal(watch->map, map) &&
(watch->loaddr == addr) &&
(watch->hiaddr == addr+size)) {
db_printf("Already set.\n");
return;
}
for (watch = db_watchpoint_list; watch != 0; watch = watch->link)
if (db_map_equal(watch->map, map) &&
(watch->loaddr == addr) &&
(watch->hiaddr == addr+size)) {
db_printf("Already set.\n");
return;
}
watch = db_watchpoint_alloc();
if (watch == 0) {
db_printf("Too many watchpoints.\n");
return;
db_printf("Too many watchpoints.\n");
return;
}
watch->map = map;
@ -129,10 +129,8 @@ db_set_watchpoint(map, addr, size)
db_watchpoints_inserted = FALSE;
}
void
db_delete_watchpoint(map, addr)
struct vm_map *map;
db_addr_t addr;
static void
db_delete_watchpoint(struct vm_map *map, db_addr_t addr)
{
db_watchpoint_t watch;
db_watchpoint_t *prev;
@ -140,65 +138,56 @@ db_delete_watchpoint(map, addr)
for (prev = &db_watchpoint_list;
(watch = *prev) != 0;
prev = &watch->link)
if (db_map_equal(watch->map, map) &&
(watch->loaddr <= addr) &&
(addr < watch->hiaddr)) {
*prev = watch->link;
db_watchpoint_free(watch);
return;
}
if (db_map_equal(watch->map, map) &&
(watch->loaddr <= addr) &&
(addr < watch->hiaddr)) {
*prev = watch->link;
db_watchpoint_free(watch);
return;
}
db_printf("Not set.\n");
}
void
db_list_watchpoints()
db_list_watchpoints(void)
{
db_watchpoint_t watch;
if (db_watchpoint_list == 0) {
db_printf("No watchpoints set\n");
return;
db_printf("No watchpoints set\n");
return;
}
db_printf(" Map Address Size\n");
for (watch = db_watchpoint_list;
watch != 0;
watch = watch->link)
db_printf("%s%p %8lx %lx\n",
db_map_current(watch->map) ? "*" : " ",
watch->map, watch->loaddr,
watch->hiaddr - watch->loaddr);
for (watch = db_watchpoint_list; watch != 0; watch = watch->link)
db_printf("%s%p %8lx %lx\n",
db_map_current(watch->map) ? "*" : " ",
watch->map, watch->loaddr,
watch->hiaddr - watch->loaddr);
}
/* Delete watchpoint */
/*ARGSUSED*/
void
db_deletewatch_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_deletewatch_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
db_delete_watchpoint(db_map_addr(addr), addr);
}
/* Set watchpoint */
/*ARGSUSED*/
void
db_watchpoint_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_watchpoint_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
vsize_t size;
db_expr_t value;
vsize_t size;
db_expr_t value;
if (db_expression(&value))
size = (vsize_t) value;
size = (vsize_t) value;
else
size = 4;
size = 4;
db_skip_to_eol();
db_set_watchpoint(db_map_addr(addr), addr, size);
@ -207,72 +196,35 @@ db_watchpoint_cmd(addr, have_addr, count, modif)
/* list watchpoints */
/*ARGSUSED*/
void
db_listwatch_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
db_listwatch_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
{
db_list_watchpoints();
}
void
db_set_watchpoints()
db_set_watchpoints(void)
{
db_watchpoint_t watch;
if (!db_watchpoints_inserted) {
for (watch = db_watchpoint_list;
watch != 0;
watch = watch->link) {
pmap_protect(watch->map->pmap,
trunc_page(watch->loaddr),
round_page(watch->hiaddr),
VM_PROT_READ);
pmap_update(watch->map->pmap);
}
for (watch = db_watchpoint_list;
watch != 0;
watch = watch->link) {
pmap_protect(watch->map->pmap,
trunc_page(watch->loaddr),
round_page(watch->hiaddr),
VM_PROT_READ);
pmap_update(watch->map->pmap);
}
db_watchpoints_inserted = TRUE;
db_watchpoints_inserted = TRUE;
}
}
void
db_clear_watchpoints()
db_clear_watchpoints(void)
{
db_watchpoints_inserted = FALSE;
}
boolean_t
db_find_watchpoint(map, addr, regs)
struct vm_map *map;
db_addr_t addr;
db_regs_t *regs;
{
db_watchpoint_t watch;
db_watchpoint_t found = 0;
for (watch = db_watchpoint_list;
watch != 0;
watch = watch->link)
if (db_map_equal(watch->map, map)) {
if ((watch->loaddr <= addr) &&
(addr < watch->hiaddr))
return (TRUE);
else if ((trunc_page(watch->loaddr) <= addr) &&
(addr < round_page(watch->hiaddr)))
found = watch;
}
/*
* We didn't hit exactly on a watchpoint, but we are
* in a protected region. We want to single-step
* and then re-protect.
*/
if (found) {
db_watchpoints_inserted = FALSE;
db_single_step(regs);
}
return (FALSE);
}

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_watch.h,v 1.14 2001/06/02 18:09:25 chs Exp $ */
/* $NetBSD: db_watch.h,v 1.15 2002/02/15 07:33:54 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
* 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.
*
@ -42,16 +42,10 @@ typedef struct db_watchpoint {
struct db_watchpoint *link; /* link in in-use or free chain */
} *db_watchpoint_t;
db_watchpoint_t db_watchpoint_alloc __P((void));
void db_watchpoint_free __P((db_watchpoint_t));
void db_set_watchpoint __P((struct vm_map *, db_addr_t, vsize_t));
void db_delete_watchpoint __P((struct vm_map *, db_addr_t));
void db_list_watchpoints __P((void));
void db_deletewatch_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_watchpoint_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_listwatch_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_set_watchpoints __P((void));
void db_clear_watchpoints __P((void));
boolean_t db_find_watchpoint __P((struct vm_map *, db_addr_t, db_regs_t *));
void db_deletewatch_cmd(db_expr_t, int, db_expr_t, char *);
void db_watchpoint_cmd(db_expr_t, int, db_expr_t, char *);
void db_listwatch_cmd(db_expr_t, int, db_expr_t, char *);
void db_set_watchpoints(void);
void db_clear_watchpoints(void);
#endif /* _DDB_DB_WATCH_ */

View File

@ -1,27 +1,27 @@
/* $NetBSD: db_write_cmd.c,v 1.15 2001/11/12 22:54:07 lukem Exp $ */
/* $NetBSD: db_write_cmd.c,v 1.16 2002/02/15 07:33:54 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
* 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_write_cmd.c,v 1.15 2001/11/12 22:54:07 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_write_cmd.c,v 1.16 2002/02/15 07:33:54 simonb Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -49,11 +49,8 @@ __KERNEL_RCSID(0, "$NetBSD: db_write_cmd.c,v 1.15 2001/11/12 22:54:07 lukem Exp
*/
/*ARGSUSED*/
void
db_write_cmd(address, have_addr, count, modif)
db_expr_t address;
boolean_t have_addr;
db_expr_t count;
char * modif;
db_write_cmd(db_expr_t address, boolean_t have_addr, db_expr_t count,
char *modif)
{
db_addr_t addr;
db_expr_t old_value;
@ -64,36 +61,36 @@ db_write_cmd(address, have_addr, count, modif)
addr = (db_addr_t) address;
switch (modif[0]) {
case 'b':
case 'b':
size = 1;
break;
case 'h':
case 'h':
size = 2;
break;
case 'l':
case '\0':
case 'l':
case '\0':
size = 4;
break;
default:
default:
size = -1;
db_error("Unknown size\n");
/*NOTREACHED*/
}
while (db_expression(&new_value)) {
old_value = db_get_value(addr, size, FALSE);
db_printsym(addr, DB_STGY_ANY, db_printf);
db_printf("\t\t%s = ", db_num_to_str(old_value));
db_printf("%s\n", db_num_to_str(new_value));
db_put_value(addr, size, new_value);
addr += size;
old_value = db_get_value(addr, size, FALSE);
db_printsym(addr, DB_STGY_ANY, db_printf);
db_printf("\t\t%s = ", db_num_to_str(old_value));
db_printf("%s\n", db_num_to_str(new_value));
db_put_value(addr, size, new_value);
addr += size;
wrote_one = TRUE;
wrote_one = TRUE;
}
if (!wrote_one) {
db_error("Nothing written.\n");
/*NOTREACHED*/
db_error("Nothing written.\n");
/*NOTREACHED*/
}
db_next = addr;
@ -101,4 +98,3 @@ db_write_cmd(address, have_addr, count, modif)
db_skip_to_eol();
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_xxx.c,v 1.15 2001/11/12 22:54:07 lukem Exp $ */
/* $NetBSD: db_xxx.c,v 1.16 2002/02/15 07:33:54 simonb Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.15 2001/11/12 22:54:07 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.16 2002/02/15 07:33:54 simonb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -64,11 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.15 2001/11/12 22:54:07 lukem Exp $");
#include <ddb/db_extern.h>
void
db_kill_proc(addr, haddr, count, modif)
db_expr_t addr;
int haddr;
db_expr_t count;
char *modif;
db_kill_proc(db_expr_t addr, int haddr, db_expr_t count, char *modif)
{
struct proc *p;
db_expr_t pid, sig;
@ -77,7 +73,7 @@ db_kill_proc(addr, haddr, count, modif)
/* What pid? */
if (!db_expression(&pid)) {
db_error("pid?\n");
/*NOTREACHED*/
/*NOTREACHED*/
}
/* What sig? */
t = db_read_token();
@ -91,31 +87,27 @@ db_kill_proc(addr, haddr, count, modif)
sig = 15;
}
if (db_read_token() != tEOL) {
db_error("?\n");
/*NOTREACHED*/
db_error("?\n");
/*NOTREACHED*/
}
p = pfind((pid_t)pid);
if (p == NULL) {
db_error("no such proc\n");
/*NOTREACHED*/
/*NOTREACHED*/
}
psignal(p, (int)sig);
}
void
db_show_all_procs(addr, haddr, count, modif)
db_expr_t addr;
int haddr;
db_expr_t count;
char *modif;
db_show_all_procs(db_expr_t addr, int haddr, db_expr_t count, char *modif)
{
int i;
char *mode;
struct proc *p, *pp;
struct timeval tv[2];
const struct proclist_desc *pd;
if (modif[0] == 0)
modif[0] = 'n'; /* default == normal mode */
@ -127,9 +119,8 @@ db_show_all_procs(addr, haddr, count, modif)
db_printf("\t/w == show process wait/emul info\n");
return;
}
switch (*mode) {
switch (*mode) {
case 'a':
db_printf(" PID %10s %18s %18s %18s\n",
"COMMAND", "STRUCT PROC *", "UAREA *", "VMSPACE/VM_MAP");
@ -194,14 +185,8 @@ db_show_all_procs(addr, haddr, count, modif)
}
void
db_show_callout(addr, haddr, count, modif)
db_expr_t addr;
int haddr;
db_expr_t count;
char *modif;
db_show_callout(db_expr_t addr, int haddr, db_expr_t count, char *modif)
{
extern struct callout_queue *callwheel;
extern int callwheelsize;
uint64_t hint;
int i;
@ -231,11 +216,7 @@ db_show_callout(addr, haddr, count, modif)
}
void
db_dmesg(addr, haddr, count, modif)
db_expr_t addr;
int haddr;
db_expr_t count;
char *modif;
db_dmesg(db_expr_t addr, int haddr, db_expr_t count, char *modif)
{
struct kern_msgbuf *mbp;
int ch, newl, skip, i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ddbvar.h,v 1.2 1998/10/29 21:22:33 jonathan Exp $ */
/* $NetBSD: ddbvar.h,v 1.3 2002/02/15 07:33:55 simonb Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -46,9 +46,7 @@
extern int db_onpanic;
extern int db_fromconsole;
int ddb_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));
int read_symtab_from_file __P((struct proc *,struct vnode *,const char *));
int ddb_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
int read_symtab_from_file(struct proc *,struct vnode *,const char *);
#endif /* !_DDBVAR_H_ */