1) Changed ddb into a option rather than a pseudo-device (use options DDB

in your kernel config now).
2) Added ps ddb function from 1.1.5. Cleaned it up a bit and moved into its
   own file.
3) Added \r handing in db_printf.
4) Added missing memory usage stats to statclock().
5) Added dummy function to pseudo_set so it will be emitted if there
   are no other pseudo declarations.
This commit is contained in:
David Greenman 1994-08-27 16:14:39 +00:00
parent eb3ae6fd94
commit 8a129caed5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2320
25 changed files with 130 additions and 126 deletions

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.55 1994/08/20 16:02:57 davidg Exp $ * $Id: machdep.c,v 1.56 1994/08/24 11:45:19 sos Exp $
*/ */
#include "npx.h" #include "npx.h"
@ -1181,8 +1181,7 @@ init386(first)
lldt(_default_ldt); lldt(_default_ldt);
currentldt = _default_ldt; currentldt = _default_ldt;
#include "ddb.h" #ifdef DDB
#if NDDB > 0
kdb_init(); kdb_init();
if (boothowto & RB_KDB) if (boothowto & RB_KDB)
Debugger("Boot flags requested debugger"); Debugger("Boot flags requested debugger");
@ -1482,8 +1481,7 @@ set_regs (struct proc *p, struct reg *regs) {
return 0; return 0;
} }
#include "ddb.h" #ifndef DDB
#if NDDB <= 0
void void
Debugger(const char *msg) Debugger(const char *msg)
{ {

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91
* $Id: trap.c,v 1.29 1994/08/18 22:34:43 wollman Exp $ * $Id: trap.c,v 1.30 1994/08/24 11:52:21 sos Exp $
*/ */
/* /*
@ -67,7 +67,6 @@
#include "isa.h" #include "isa.h"
#include "npx.h" #include "npx.h"
#include "ddb.h"
int trap_pfault __P((struct trapframe *, int)); int trap_pfault __P((struct trapframe *, int));
void trap_fatal __P((struct trapframe *)); void trap_fatal __P((struct trapframe *));
@ -225,7 +224,7 @@ trap(frame)
#if NISA > 0 #if NISA > 0
case T_NMI: case T_NMI:
#if NDDB > 0 #ifdef DDB
/* NMI can be hooked up to a pushbutton for debugging */ /* NMI can be hooked up to a pushbutton for debugging */
printf ("NMI ... going to debugger\n"); printf ("NMI ... going to debugger\n");
if (kdb_trap (type, 0, &frame)) if (kdb_trap (type, 0, &frame))
@ -286,7 +285,7 @@ trap(frame)
} }
break; break;
#if NDDB > 0 #ifdef DDB
case T_BPTFLT: case T_BPTFLT:
case T_TRCTRAP: case T_TRCTRAP:
if (kdb_trap (type, 0, &frame)) if (kdb_trap (type, 0, &frame))
@ -301,7 +300,7 @@ trap(frame)
#if NISA > 0 #if NISA > 0
case T_NMI: case T_NMI:
#if NDDB > 0 #ifdef DDB
/* NMI can be hooked up to a pushbutton for debugging */ /* NMI can be hooked up to a pushbutton for debugging */
printf ("NMI ... going to debugger\n"); printf ("NMI ... going to debugger\n");
if (kdb_trap (type, 0, &frame)) if (kdb_trap (type, 0, &frame))
@ -505,7 +504,7 @@ trap_fatal(frame)
if (kdb_trap(&psl)) if (kdb_trap(&psl))
return; return;
#endif #endif
#if NDDB > 0 #ifdef DDB
if (kdb_trap (type, 0, frame)) if (kdb_trap (type, 0, frame))
return; return;
#endif #endif

View File

@ -8,6 +8,7 @@ ddb/db_input.c optional ddb
ddb/db_lex.c optional ddb ddb/db_lex.c optional ddb
ddb/db_output.c optional ddb ddb/db_output.c optional ddb
ddb/db_print.c optional ddb ddb/db_print.c optional ddb
ddb/db_ps.c optional ddb
ddb/db_run.c optional ddb ddb/db_run.c optional ddb
ddb/db_sym.c optional ddb ddb/db_sym.c optional ddb
ddb/db_trap.c optional ddb ddb/db_trap.c optional ddb

View File

@ -23,7 +23,7 @@
* any improvements or extensions that they make and grant Carnegie the * any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes. * rights to redistribute these changes.
* *
* $Id: db_command.c,v 1.6 1994/08/13 03:49:16 wollman Exp $ * $Id: db_command.c,v 1.7 1994/08/18 22:34:20 wollman Exp $
*/ */
/* /*
@ -306,15 +306,15 @@ db_command(last_cmdp, cmd_table)
extern void db_show_one_thread(), db_show_all_threads(); extern void db_show_one_thread(), db_show_all_threads();
extern void vm_page_print(); extern void vm_page_print();
/* extern void db_ps(); */ extern void db_ps();
extern void ipc_port_print(); extern void ipc_port_print();
void db_show_help(); void db_show_help();
struct command db_show_all_cmds[] = { struct command db_show_all_cmds[] = {
#if 0 #if 0
{ "threads", db_show_all_threads, 0, 0 }, { "threads", db_show_all_threads, 0, 0 },
{ "procs", db_ps, 0, 0 },
#endif #endif
{ "procs", db_ps, 0, 0 },
{ (char *)0 } { (char *)0 }
}; };
@ -363,9 +363,7 @@ struct command db_command_table[] = {
{ "trace", db_stack_trace_cmd, 0, 0 }, { "trace", db_stack_trace_cmd, 0, 0 },
{ "call", db_fncall, CS_OWN, 0 }, { "call", db_fncall, CS_OWN, 0 },
{ "show", 0, 0, db_show_cmds }, { "show", 0, 0, db_show_cmds },
#if 0
{ "ps", db_ps, 0, 0 }, { "ps", db_ps, 0, 0 },
#endif
{ (char *)0, } { (char *)0, }
}; };

View File

@ -23,7 +23,7 @@
* any improvements or extensions that they make and grant Carnegie the * any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes. * rights to redistribute these changes.
* *
* $Id: db_output.c,v 1.6 1993/12/19 00:49:45 wollman Exp $ * $Id: db_output.c,v 1.7 1994/08/13 03:49:21 wollman Exp $
*/ */
/* /*
@ -107,6 +107,13 @@ db_putchar(c)
db_last_non_space = db_output_position; db_last_non_space = db_output_position;
} }
else if (c == '\n') { else if (c == '\n') {
/* Newline */
cnputc(c);
db_output_position = 0;
db_last_non_space = 0;
db_check_interrupt();
}
else if (c == '\r') {
/* Return */ /* Return */
cnputc(c); cnputc(c);
db_output_position = 0; db_output_position = 0;

View File

@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: syscons.c,v 1.51 1994/08/17 19:32:23 sos Exp $ * $Id: syscons.c,v 1.52 1994/08/20 03:48:42 davidg Exp $
*/ */
#include "sc.h" #include "sc.h"
@ -278,10 +278,6 @@ struct tty pccons[NCONS+1];
#define timeout_t timeout_func_t #define timeout_t timeout_func_t
#define MONO_BUF (KERNBASE+0xB0000) #define MONO_BUF (KERNBASE+0xB0000)
#define CGA_BUF (KERNBASE+0xB8000) #define CGA_BUF (KERNBASE+0xB8000)
#include "ddb.h"
#if NDDB > 0
#define DDB 1
#endif
u_short *Crtat = (u_short *)MONO_BUF; u_short *Crtat = (u_short *)MONO_BUF;
void consinit(void) {scinit();} void consinit(void) {scinit();}
@ -2412,7 +2408,7 @@ scgetc(int noblock)
shutdown_nice(); shutdown_nice();
break; break;
case DBG: case DBG:
#if DDB > 0 /* try to switch to console 0 */ #ifdef DDB /* try to switch to console 0 */
if (cur_console->smode.mode == VT_AUTO && if (cur_console->smode.mode == VT_AUTO &&
console[0].smode.mode == VT_AUTO) console[0].smode.mode == VT_AUTO)
switch_scr(0); switch_scr(0);

View File

@ -14,7 +14,7 @@
* *
* commenced: Sun Sep 27 18:14:01 PDT 1992 * commenced: Sun Sep 27 18:14:01 PDT 1992
* *
* $Id: aha1742.c,v 1.18 1994/08/20 03:48:38 davidg Exp $ * $Id: aha1742.c,v 1.19 1994/08/23 07:52:04 paul Exp $
*/ */
#include <sys/types.h> #include <sys/types.h>
@ -38,15 +38,11 @@
/* */ /* */
#ifdef KERNEL #ifdef KERNEL
# ifdef NetBSD # ifdef DDB
# ifdef DDB
int Debugger(); int Debugger();
# else /* DDB */ # else /* DDB */
#define Debugger() panic("should call debugger here (adaptec.c)") #define Debugger() panic("should call debugger here (adaptec.c)")
# endif /* DDB */ # endif /* DDB */
# else
#include "ddb.h"
#endif /* netbsd */
#else /* KERNEL */ #else /* KERNEL */
#define NAHB 1 #define NAHB 1
#endif /* kernel */ #endif /* kernel */
@ -512,11 +508,7 @@ int
ahb_attach(dev) ahb_attach(dev)
struct isa_device *dev; struct isa_device *dev;
{ {
#ifdef NetBSD
int unit = dev->id_masunit;
#else
int unit = dev->id_unit; int unit = dev->id_unit;
#endif
struct ahb_data *ahb = ahbdata[unit]; struct ahb_data *ahb = ahbdata[unit];
/* /*

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.55 1994/08/20 16:02:57 davidg Exp $ * $Id: machdep.c,v 1.56 1994/08/24 11:45:19 sos Exp $
*/ */
#include "npx.h" #include "npx.h"
@ -1181,8 +1181,7 @@ init386(first)
lldt(_default_ldt); lldt(_default_ldt);
currentldt = _default_ldt; currentldt = _default_ldt;
#include "ddb.h" #ifdef DDB
#if NDDB > 0
kdb_init(); kdb_init();
if (boothowto & RB_KDB) if (boothowto & RB_KDB)
Debugger("Boot flags requested debugger"); Debugger("Boot flags requested debugger");
@ -1482,8 +1481,7 @@ set_regs (struct proc *p, struct reg *regs) {
return 0; return 0;
} }
#include "ddb.h" #ifndef DDB
#if NDDB <= 0
void void
Debugger(const char *msg) Debugger(const char *msg)
{ {

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91
* $Id: trap.c,v 1.29 1994/08/18 22:34:43 wollman Exp $ * $Id: trap.c,v 1.30 1994/08/24 11:52:21 sos Exp $
*/ */
/* /*
@ -67,7 +67,6 @@
#include "isa.h" #include "isa.h"
#include "npx.h" #include "npx.h"
#include "ddb.h"
int trap_pfault __P((struct trapframe *, int)); int trap_pfault __P((struct trapframe *, int));
void trap_fatal __P((struct trapframe *)); void trap_fatal __P((struct trapframe *));
@ -225,7 +224,7 @@ trap(frame)
#if NISA > 0 #if NISA > 0
case T_NMI: case T_NMI:
#if NDDB > 0 #ifdef DDB
/* NMI can be hooked up to a pushbutton for debugging */ /* NMI can be hooked up to a pushbutton for debugging */
printf ("NMI ... going to debugger\n"); printf ("NMI ... going to debugger\n");
if (kdb_trap (type, 0, &frame)) if (kdb_trap (type, 0, &frame))
@ -286,7 +285,7 @@ trap(frame)
} }
break; break;
#if NDDB > 0 #ifdef DDB
case T_BPTFLT: case T_BPTFLT:
case T_TRCTRAP: case T_TRCTRAP:
if (kdb_trap (type, 0, &frame)) if (kdb_trap (type, 0, &frame))
@ -301,7 +300,7 @@ trap(frame)
#if NISA > 0 #if NISA > 0
case T_NMI: case T_NMI:
#if NDDB > 0 #ifdef DDB
/* NMI can be hooked up to a pushbutton for debugging */ /* NMI can be hooked up to a pushbutton for debugging */
printf ("NMI ... going to debugger\n"); printf ("NMI ... going to debugger\n");
if (kdb_trap (type, 0, &frame)) if (kdb_trap (type, 0, &frame))
@ -505,7 +504,7 @@ trap_fatal(frame)
if (kdb_trap(&psl)) if (kdb_trap(&psl))
return; return;
#endif #endif
#if NDDB > 0 #ifdef DDB
if (kdb_trap (type, 0, frame)) if (kdb_trap (type, 0, frame))
return; return;
#endif #endif

View File

@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct * on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances. * functioning of this software in any circumstances.
* *
* $Id: aha1542.c,v 1.32 1994/08/20 03:48:37 davidg Exp $ * $Id: aha1542.c,v 1.33 1994/08/23 07:52:00 paul Exp $
*/ */
/* /*
@ -37,7 +37,6 @@
#include <scsi/scsiconf.h> #include <scsi/scsiconf.h>
#ifdef KERNEL #ifdef KERNEL
#include "ddb.h"
#include <sys/kernel.h> #include <sys/kernel.h>
#else /*KERNEL */ #else /*KERNEL */
#define NAHA 1 #define NAHA 1

View File

@ -14,7 +14,7 @@
* *
* commenced: Sun Sep 27 18:14:01 PDT 1992 * commenced: Sun Sep 27 18:14:01 PDT 1992
* *
* $Id: aha1742.c,v 1.18 1994/08/20 03:48:38 davidg Exp $ * $Id: aha1742.c,v 1.19 1994/08/23 07:52:04 paul Exp $
*/ */
#include <sys/types.h> #include <sys/types.h>
@ -38,15 +38,11 @@
/* */ /* */
#ifdef KERNEL #ifdef KERNEL
# ifdef NetBSD # ifdef DDB
# ifdef DDB
int Debugger(); int Debugger();
# else /* DDB */ # else /* DDB */
#define Debugger() panic("should call debugger here (adaptec.c)") #define Debugger() panic("should call debugger here (adaptec.c)")
# endif /* DDB */ # endif /* DDB */
# else
#include "ddb.h"
#endif /* netbsd */
#else /* KERNEL */ #else /* KERNEL */
#define NAHB 1 #define NAHB 1
#endif /* kernel */ #endif /* kernel */
@ -512,11 +508,7 @@ int
ahb_attach(dev) ahb_attach(dev)
struct isa_device *dev; struct isa_device *dev;
{ {
#ifdef NetBSD
int unit = dev->id_masunit;
#else
int unit = dev->id_unit; int unit = dev->id_unit;
#endif
struct ahb_data *ahb = ahbdata[unit]; struct ahb_data *ahb = ahbdata[unit];
/* /*

View File

@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct * on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances. * functioning of this software in any circumstances.
* *
* $Id: bt742a.c,v 1.20 1994/08/21 20:16:13 paul Exp $ * $Id: bt742a.c,v 1.21 1994/08/23 07:52:07 paul Exp $
*/ */
/* /*
@ -38,7 +38,6 @@
#include <scsi/scsiconf.h> #include <scsi/scsiconf.h>
#ifdef KERNEL #ifdef KERNEL
#include "ddb.h"
#include <sys/kernel.h> #include <sys/kernel.h>
#else /*KERNEL */ #else /*KERNEL */
#define NBT 1 #define NBT 1

View File

@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: syscons.c,v 1.51 1994/08/17 19:32:23 sos Exp $ * $Id: syscons.c,v 1.52 1994/08/20 03:48:42 davidg Exp $
*/ */
#include "sc.h" #include "sc.h"
@ -278,10 +278,6 @@ struct tty pccons[NCONS+1];
#define timeout_t timeout_func_t #define timeout_t timeout_func_t
#define MONO_BUF (KERNBASE+0xB0000) #define MONO_BUF (KERNBASE+0xB0000)
#define CGA_BUF (KERNBASE+0xB8000) #define CGA_BUF (KERNBASE+0xB8000)
#include "ddb.h"
#if NDDB > 0
#define DDB 1
#endif
u_short *Crtat = (u_short *)MONO_BUF; u_short *Crtat = (u_short *)MONO_BUF;
void consinit(void) {scinit();} void consinit(void) {scinit();}
@ -2412,7 +2408,7 @@ scgetc(int noblock)
shutdown_nice(); shutdown_nice();
break; break;
case DBG: case DBG:
#if DDB > 0 /* try to switch to console 0 */ #ifdef DDB /* try to switch to console 0 */
if (cur_console->smode.mode == VT_AUTO && if (cur_console->smode.mode == VT_AUTO &&
console[0].smode.mode == VT_AUTO) console[0].smode.mode == VT_AUTO)
switch_scr(0); switch_scr(0);

View File

@ -22,7 +22,7 @@
* today: Fri Jun 2 17:21:03 EST 1994 * today: Fri Jun 2 17:21:03 EST 1994
* added 24F support ++sg * added 24F support ++sg
* *
* $Id: ultra14f.c,v 1.21 1994/08/18 23:36:40 phk Exp $ * $Id: ultra14f.c,v 1.22 1994/08/19 00:32:52 jkh Exp $
*/ */
#include <sys/types.h> #include <sys/types.h>
@ -47,9 +47,7 @@
/* */ /* */
#ifdef KERNEL #ifndef KERNEL
#include "ddb.h"
#else /*KERNEL */
#define NUHA 1 #define NUHA 1
#endif /*KERNEL */ #endif /*KERNEL */

View File

@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: syscons.c,v 1.51 1994/08/17 19:32:23 sos Exp $ * $Id: syscons.c,v 1.52 1994/08/20 03:48:42 davidg Exp $
*/ */
#include "sc.h" #include "sc.h"
@ -278,10 +278,6 @@ struct tty pccons[NCONS+1];
#define timeout_t timeout_func_t #define timeout_t timeout_func_t
#define MONO_BUF (KERNBASE+0xB0000) #define MONO_BUF (KERNBASE+0xB0000)
#define CGA_BUF (KERNBASE+0xB8000) #define CGA_BUF (KERNBASE+0xB8000)
#include "ddb.h"
#if NDDB > 0
#define DDB 1
#endif
u_short *Crtat = (u_short *)MONO_BUF; u_short *Crtat = (u_short *)MONO_BUF;
void consinit(void) {scinit();} void consinit(void) {scinit();}
@ -2412,7 +2408,7 @@ scgetc(int noblock)
shutdown_nice(); shutdown_nice();
break; break;
case DBG: case DBG:
#if DDB > 0 /* try to switch to console 0 */ #ifdef DDB /* try to switch to console 0 */
if (cur_console->smode.mode == VT_AUTO && if (cur_console->smode.mode == VT_AUTO &&
console[0].smode.mode == VT_AUTO) console[0].smode.mode == VT_AUTO)
switch_scr(0); switch_scr(0);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)init_main.c 8.9 (Berkeley) 1/21/94 * @(#)init_main.c 8.9 (Berkeley) 1/21/94
* $Id: init_main.c,v 1.5 1994/08/18 22:34:57 wollman Exp $ * $Id: init_main.c,v 1.6 1994/08/24 11:50:37 sos Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -103,6 +103,10 @@ void __main() {}
* This table is filled in by the linker with functions that need to be * This table is filled in by the linker with functions that need to be
* called to initialize various pseudo-devices and whatnot. * called to initialize various pseudo-devices and whatnot.
*/ */
static void dummyinit() {}
TEXT_SET(pseudo_set, dummyinit);
typedef void (*pseudo_func_t)(void); typedef void (*pseudo_func_t)(void);
extern const struct linker_set pseudo_set; extern const struct linker_set pseudo_set;
static const pseudo_func_t *pseudos = static const pseudo_func_t *pseudos =

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
* $Id: kern_clock.c,v 1.3 1994/08/02 07:41:54 davidg Exp $ * $Id: kern_clock.c,v 1.4 1994/08/18 22:34:58 wollman Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -46,6 +46,7 @@
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/proc.h> #include <sys/proc.h>
#include <sys/resourcevar.h> #include <sys/resourcevar.h>
#include <vm/vm.h>
#include <machine/cpu.h> #include <machine/cpu.h>
@ -431,11 +432,28 @@ statclock(frame)
#ifdef GPROF #ifdef GPROF
register struct gmonparam *g; register struct gmonparam *g;
#endif #endif
register struct proc *p; register struct proc *p = curproc;
register int i; register int i;
if (p) {
struct pstats *pstats;
struct rusage *ru;
struct vmspace *vm;
/* bump the resource usage of integral space use */
if ((pstats = p->p_stats) && (ru = &pstats->p_ru) && (vm = p->p_vmspace)) {
ru->ru_ixrss += vm->vm_tsize * PAGE_SIZE / 1024;
ru->ru_idrss += vm->vm_dsize * PAGE_SIZE / 1024;
ru->ru_isrss += vm->vm_ssize * PAGE_SIZE / 1024;
if ((vm->vm_pmap.pm_stats.resident_count * PAGE_SIZE / 1024) >
ru->ru_maxrss) {
ru->ru_maxrss =
vm->vm_pmap.pm_stats.resident_count * PAGE_SIZE / 1024;
}
}
}
if (CLKF_USERMODE(frame)) { if (CLKF_USERMODE(frame)) {
p = curproc;
if (p->p_flag & P_PROFIL) if (p->p_flag & P_PROFIL)
addupc_intr(p, CLKF_PC(frame), 1); addupc_intr(p, CLKF_PC(frame), 1);
if (--pscnt > 0) if (--pscnt > 0)
@ -477,7 +495,6 @@ statclock(frame)
* so that we know how much of its real time was spent * so that we know how much of its real time was spent
* in ``non-process'' (i.e., interrupt) work. * in ``non-process'' (i.e., interrupt) work.
*/ */
p = curproc;
if (CLKF_INTR(frame)) { if (CLKF_INTR(frame)) {
if (p != NULL) if (p != NULL)
p->p_iticks++; p->p_iticks++;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
* $Id: kern_clock.c,v 1.3 1994/08/02 07:41:54 davidg Exp $ * $Id: kern_clock.c,v 1.4 1994/08/18 22:34:58 wollman Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -46,6 +46,7 @@
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/proc.h> #include <sys/proc.h>
#include <sys/resourcevar.h> #include <sys/resourcevar.h>
#include <vm/vm.h>
#include <machine/cpu.h> #include <machine/cpu.h>
@ -431,11 +432,28 @@ statclock(frame)
#ifdef GPROF #ifdef GPROF
register struct gmonparam *g; register struct gmonparam *g;
#endif #endif
register struct proc *p; register struct proc *p = curproc;
register int i; register int i;
if (p) {
struct pstats *pstats;
struct rusage *ru;
struct vmspace *vm;
/* bump the resource usage of integral space use */
if ((pstats = p->p_stats) && (ru = &pstats->p_ru) && (vm = p->p_vmspace)) {
ru->ru_ixrss += vm->vm_tsize * PAGE_SIZE / 1024;
ru->ru_idrss += vm->vm_dsize * PAGE_SIZE / 1024;
ru->ru_isrss += vm->vm_ssize * PAGE_SIZE / 1024;
if ((vm->vm_pmap.pm_stats.resident_count * PAGE_SIZE / 1024) >
ru->ru_maxrss) {
ru->ru_maxrss =
vm->vm_pmap.pm_stats.resident_count * PAGE_SIZE / 1024;
}
}
}
if (CLKF_USERMODE(frame)) { if (CLKF_USERMODE(frame)) {
p = curproc;
if (p->p_flag & P_PROFIL) if (p->p_flag & P_PROFIL)
addupc_intr(p, CLKF_PC(frame), 1); addupc_intr(p, CLKF_PC(frame), 1);
if (--pscnt > 0) if (--pscnt > 0)
@ -477,7 +495,6 @@ statclock(frame)
* so that we know how much of its real time was spent * so that we know how much of its real time was spent
* in ``non-process'' (i.e., interrupt) work. * in ``non-process'' (i.e., interrupt) work.
*/ */
p = curproc;
if (CLKF_INTR(frame)) { if (CLKF_INTR(frame)) {
if (p != NULL) if (p != NULL)
p->p_iticks++; p->p_iticks++;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
* $Id: kern_clock.c,v 1.3 1994/08/02 07:41:54 davidg Exp $ * $Id: kern_clock.c,v 1.4 1994/08/18 22:34:58 wollman Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -46,6 +46,7 @@
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/proc.h> #include <sys/proc.h>
#include <sys/resourcevar.h> #include <sys/resourcevar.h>
#include <vm/vm.h>
#include <machine/cpu.h> #include <machine/cpu.h>
@ -431,11 +432,28 @@ statclock(frame)
#ifdef GPROF #ifdef GPROF
register struct gmonparam *g; register struct gmonparam *g;
#endif #endif
register struct proc *p; register struct proc *p = curproc;
register int i; register int i;
if (p) {
struct pstats *pstats;
struct rusage *ru;
struct vmspace *vm;
/* bump the resource usage of integral space use */
if ((pstats = p->p_stats) && (ru = &pstats->p_ru) && (vm = p->p_vmspace)) {
ru->ru_ixrss += vm->vm_tsize * PAGE_SIZE / 1024;
ru->ru_idrss += vm->vm_dsize * PAGE_SIZE / 1024;
ru->ru_isrss += vm->vm_ssize * PAGE_SIZE / 1024;
if ((vm->vm_pmap.pm_stats.resident_count * PAGE_SIZE / 1024) >
ru->ru_maxrss) {
ru->ru_maxrss =
vm->vm_pmap.pm_stats.resident_count * PAGE_SIZE / 1024;
}
}
}
if (CLKF_USERMODE(frame)) { if (CLKF_USERMODE(frame)) {
p = curproc;
if (p->p_flag & P_PROFIL) if (p->p_flag & P_PROFIL)
addupc_intr(p, CLKF_PC(frame), 1); addupc_intr(p, CLKF_PC(frame), 1);
if (--pscnt > 0) if (--pscnt > 0)
@ -477,7 +495,6 @@ statclock(frame)
* so that we know how much of its real time was spent * so that we know how much of its real time was spent
* in ``non-process'' (i.e., interrupt) work. * in ``non-process'' (i.e., interrupt) work.
*/ */
p = curproc;
if (CLKF_INTR(frame)) { if (CLKF_INTR(frame)) {
if (p != NULL) if (p != NULL)
p->p_iticks++; p->p_iticks++;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)subr_prf.c 8.3 (Berkeley) 1/21/94 * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
* $Id: subr_prf.c,v 1.3 1994/08/02 07:42:30 davidg Exp $ * $Id: subr_prf.c,v 1.4 1994/08/13 14:21:51 davidg Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -122,8 +122,7 @@ panic(fmt, va_alist)
if (boothowto & RB_KDB) if (boothowto & RB_KDB)
kdbpanic(); kdbpanic();
#endif #endif
#include "ddb.h" #ifdef DDB
#if NDDB > 0
Debugger ("panic"); Debugger ("panic");
#endif #endif
boot(bootopt); boot(bootopt);

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91
* $Id: trap.c,v 1.29 1994/08/18 22:34:43 wollman Exp $ * $Id: trap.c,v 1.30 1994/08/24 11:52:21 sos Exp $
*/ */
/* /*
@ -67,7 +67,6 @@
#include "isa.h" #include "isa.h"
#include "npx.h" #include "npx.h"
#include "ddb.h"
int trap_pfault __P((struct trapframe *, int)); int trap_pfault __P((struct trapframe *, int));
void trap_fatal __P((struct trapframe *)); void trap_fatal __P((struct trapframe *));
@ -225,7 +224,7 @@ trap(frame)
#if NISA > 0 #if NISA > 0
case T_NMI: case T_NMI:
#if NDDB > 0 #ifdef DDB
/* NMI can be hooked up to a pushbutton for debugging */ /* NMI can be hooked up to a pushbutton for debugging */
printf ("NMI ... going to debugger\n"); printf ("NMI ... going to debugger\n");
if (kdb_trap (type, 0, &frame)) if (kdb_trap (type, 0, &frame))
@ -286,7 +285,7 @@ trap(frame)
} }
break; break;
#if NDDB > 0 #ifdef DDB
case T_BPTFLT: case T_BPTFLT:
case T_TRCTRAP: case T_TRCTRAP:
if (kdb_trap (type, 0, &frame)) if (kdb_trap (type, 0, &frame))
@ -301,7 +300,7 @@ trap(frame)
#if NISA > 0 #if NISA > 0
case T_NMI: case T_NMI:
#if NDDB > 0 #ifdef DDB
/* NMI can be hooked up to a pushbutton for debugging */ /* NMI can be hooked up to a pushbutton for debugging */
printf ("NMI ... going to debugger\n"); printf ("NMI ... going to debugger\n");
if (kdb_trap (type, 0, &frame)) if (kdb_trap (type, 0, &frame))
@ -505,7 +504,7 @@ trap_fatal(frame)
if (kdb_trap(&psl)) if (kdb_trap(&psl))
return; return;
#endif #endif
#if NDDB > 0 #ifdef DDB
if (kdb_trap (type, 0, frame)) if (kdb_trap (type, 0, frame))
return; return;
#endif #endif

View File

@ -14,7 +14,7 @@
* *
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
* *
* $Id: cd.c,v 1.18 1994/04/20 07:06:51 davidg Exp $ * $Id: cd.c,v 1.19 1994/05/25 09:13:15 rgrimes Exp $
*/ */
#define SPLCD splbio #define SPLCD splbio
@ -50,11 +50,10 @@ static errval cd_read_toc(u_int32, u_int32, u_int32, struct cd_toc_entry *,
int32 cdstrats, cdqueues; int32 cdstrats, cdqueues;
#include <ddb.h> #ifdef DDB
#if NDDB > 0 #else /* DDB */
#else /* NDDB > 0 */
#define Debugger() #define Debugger()
#endif /* NDDB > 0 */ #endif /* DDB */
#define PAGESIZ 4096 #define PAGESIZ 4096
#define SECSIZE 2048 /* XXX */ /* default only */ #define SECSIZE 2048 /* XXX */ /* default only */

View File

@ -8,7 +8,7 @@
* file. * file.
* *
* Written by Julian Elischer (julian@dialix.oz.au) * Written by Julian Elischer (julian@dialix.oz.au)
* $Id: scsi_base.c,v 1.9 1994/05/25 09:13:20 rgrimes Exp $ * $Id: scsi_base.c,v 1.10 1994/08/20 03:48:58 davidg Exp $
*/ */
#define SPLSD splbio #define SPLSD splbio
@ -28,19 +28,11 @@
static errval sc_err1(struct scsi_xfer *); static errval sc_err1(struct scsi_xfer *);
static errval scsi_interpret_sense(struct scsi_xfer *); static errval scsi_interpret_sense(struct scsi_xfer *);
#ifdef NetBSD
#ifdef DDB #ifdef DDB
int Debugger(); int Debugger();
#else /* DDB */ #else /* DDB */
#define Debugger() #define Debugger()
#endif /* DDB */ #endif /* DDB */
#else /* NetBSD */
#include "ddb.h"
#if NDDB > 0
#else /* NDDB > 0 */
#define Debugger()
#endif /* NDDB > 0 */
#endif
struct scsi_xfer *next_free_xs; struct scsi_xfer *next_free_xs;

View File

@ -14,7 +14,7 @@
* *
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992 * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
* *
* $Id: sd.c,v 1.23 1994/04/20 07:06:57 davidg Exp $ * $Id: sd.c,v 1.24 1994/05/25 09:13:32 rgrimes Exp $
*/ */
#define SPLSD splbio #define SPLSD splbio
@ -42,19 +42,11 @@
u_int32 sdstrats, sdqueues; u_int32 sdstrats, sdqueues;
#ifdef NetBSD
#ifdef DDB #ifdef DDB
int Debugger(); int Debugger();
#else /* DDB */ #else /* DDB */
#define Debugger() #define Debugger()
#endif /* DDB */ #endif /* DDB */
#else /* NetBSD */
#include <ddb.h>
#if NDDB > 0
#else /* NDDB > 0 */
#define Debugger(s)
#endif /* NDDB > 0 */
#endif
#define PAGESIZ 4096 #define PAGESIZ 4096
#define SECSIZE 512 #define SECSIZE 512

View File

@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the * any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes. * rights to redistribute these changes.
* *
* $Id: vm_object.c,v 1.4 1994/08/07 13:10:40 davidg Exp $ * $Id: vm_object.c,v 1.5 1994/08/18 22:36:06 wollman Exp $
*/ */
/* /*
@ -1605,7 +1605,7 @@ vm_object_page_lookup(object, offset)
} }
#define DEBUG #define DEBUG
#if defined(DEBUG) || (NDDB > 0) #if defined(DEBUG) || defined(DDB)
/* /*
* vm_object_print: [ debug ] * vm_object_print: [ debug ]
*/ */
@ -1652,4 +1652,4 @@ void vm_object_print(object, full)
printf("\n"); printf("\n");
indent -= 2; indent -= 2;
} }
#endif /* defined(DEBUG) || (NDDB > 0) */ #endif /* defined(DEBUG) || defined(DDB) */