mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-03 09:00:21 +00:00
Attached vm ddb commands show map',
show vmochk', `show object',
`show vmopag', `show page' and `show pageq'. Moved all vm ddb stuff to the ends of the vm source files. Changed printf() to db_printf(), `indent' to db_indent, and iprintf() to db_iprintf() in ddb commands. Moved db_indent and db_iprintf() from vm to ddb. vm_page.c: Don't use __pure. Staticized. db_output.c: Reduced page width from 80 to 79 to inhibit double spacing for long lines (there are still some problems if words are printed across column 79).
This commit is contained in:
parent
831031ce00
commit
c7c34a24a3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=18298
@ -23,7 +23,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: db_output.c,v 1.17 1996/01/23 21:17:59 phk Exp $
|
||||
* $Id: db_output.c,v 1.18 1996/05/08 04:28:35 gpalmer Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -61,7 +61,7 @@ static int db_last_non_space = 0; /* last non-space character */
|
||||
int db_tab_stop_width = 8; /* how wide are tab stops? */
|
||||
#define NEXT_TAB(i) \
|
||||
((((i) + db_tab_stop_width) / db_tab_stop_width) * db_tab_stop_width)
|
||||
int db_max_width = 80; /* output line width */
|
||||
int db_max_width = 79; /* output line width */
|
||||
|
||||
static void db_putchar __P((int c, void *arg));
|
||||
|
||||
@ -154,6 +154,24 @@ void
|
||||
db_printf(const char *fmt, ...)
|
||||
{
|
||||
va_list listp;
|
||||
|
||||
va_start(listp, fmt);
|
||||
kvprintf (fmt, db_putchar, NULL, db_radix, listp);
|
||||
va_end(listp);
|
||||
}
|
||||
|
||||
int db_indent;
|
||||
|
||||
void
|
||||
db_iprintf(const char *fmt,...)
|
||||
{
|
||||
register int i;
|
||||
va_list listp;
|
||||
|
||||
for (i = db_indent; i >= 8; i -= 8)
|
||||
db_printf("\t");
|
||||
while (--i >= 0)
|
||||
db_printf(" ");
|
||||
va_start(listp, fmt);
|
||||
kvprintf (fmt, db_putchar, NULL, db_radix, listp);
|
||||
va_end(listp);
|
||||
@ -168,4 +186,3 @@ db_end_line()
|
||||
if (db_output_position >= db_max_width)
|
||||
db_printf("\n");
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vm_extern.h 8.2 (Berkeley) 1/12/94
|
||||
* $Id: vm_extern.h,v 1.24 1996/02/23 18:49:23 peter Exp $
|
||||
* $Id: vm_extern.h,v 1.25 1996/05/02 09:34:50 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _VM_EXTERN_H_
|
||||
@ -45,7 +45,6 @@ struct mount;
|
||||
struct vnode;
|
||||
|
||||
#ifdef KERNEL
|
||||
extern int indent;
|
||||
|
||||
#ifdef TYPEDEF_FOR_UAP
|
||||
int getpagesize __P((struct proc * p, void *, int *));
|
||||
@ -59,7 +58,6 @@ int sbrk __P((struct proc *, void *, int *));
|
||||
int smmap __P((struct proc *, void *, int *));
|
||||
int sstk __P((struct proc *, void *, int *));
|
||||
int swapon __P((struct proc *, void *, int *));
|
||||
|
||||
#endif
|
||||
|
||||
void faultin __P((struct proc *p));
|
||||
@ -84,7 +82,6 @@ void vm_fault_copy_entry __P((vm_map_t, vm_map_t, vm_map_entry_t, vm_map_entry_t
|
||||
void vm_fault_unwire __P((vm_map_t, vm_offset_t, vm_offset_t));
|
||||
int vm_fault_wire __P((vm_map_t, vm_offset_t, vm_offset_t));
|
||||
int vm_fork __P((struct proc *, struct proc *));
|
||||
void vm_map_print __P((/* db_expr_t */ int, boolean_t, /* db_expr_t */ int, char *));
|
||||
int vm_mmap __P((vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, vm_prot_t, int, caddr_t, vm_ooffset_t));
|
||||
vm_offset_t vm_page_alloc_contig __P((vm_offset_t, vm_offset_t, vm_offset_t, vm_offset_t));
|
||||
void vm_set_page_size __P((void));
|
||||
|
@ -61,13 +61,12 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_map.c,v 1.55 1996/09/08 16:57:53 dyson Exp $
|
||||
* $Id: vm_map.c,v 1.56 1996/09/08 23:49:47 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Virtual memory mapping module.
|
||||
*/
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -2363,77 +2362,80 @@ vm_map_simplify(map, start)
|
||||
vm_map_unlock(map);
|
||||
}
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#ifdef DDB
|
||||
#include <sys/kernel.h>
|
||||
|
||||
#include <ddb/ddb.h>
|
||||
|
||||
/*
|
||||
* vm_map_print: [ debug ]
|
||||
*/
|
||||
void
|
||||
vm_map_print(imap, full, dummy3, dummy4)
|
||||
/* db_expr_t */ int imap;
|
||||
boolean_t full;
|
||||
/* db_expr_t */ int dummy3;
|
||||
char *dummy4;
|
||||
DB_SHOW_COMMAND(map, vm_map_print)
|
||||
{
|
||||
register vm_map_entry_t entry;
|
||||
register vm_map_t map = (vm_map_t)imap; /* XXX */
|
||||
/* XXX convert args. */
|
||||
register vm_map_t map = (vm_map_t)addr;
|
||||
boolean_t full = have_addr;
|
||||
|
||||
iprintf("%s map 0x%x: pmap=0x%x,ref=%d,nentries=%d,version=%d\n",
|
||||
register vm_map_entry_t entry;
|
||||
|
||||
db_iprintf("%s map 0x%x: pmap=0x%x,ref=%d,nentries=%d,version=%d\n",
|
||||
(map->is_main_map ? "Task" : "Share"),
|
||||
(int) map, (int) (map->pmap), map->ref_count, map->nentries,
|
||||
map->timestamp);
|
||||
|
||||
if (!full && indent)
|
||||
if (!full && db_indent)
|
||||
return;
|
||||
|
||||
indent += 2;
|
||||
db_indent += 2;
|
||||
for (entry = map->header.next; entry != &map->header;
|
||||
entry = entry->next) {
|
||||
iprintf("map entry 0x%x: start=0x%x, end=0x%x, ",
|
||||
db_iprintf("map entry 0x%x: start=0x%x, end=0x%x, ",
|
||||
(int) entry, (int) entry->start, (int) entry->end);
|
||||
if (map->is_main_map) {
|
||||
static char *inheritance_name[4] =
|
||||
{"share", "copy", "none", "donate_copy"};
|
||||
|
||||
printf("prot=%x/%x/%s, ",
|
||||
db_printf("prot=%x/%x/%s, ",
|
||||
entry->protection,
|
||||
entry->max_protection,
|
||||
inheritance_name[entry->inheritance]);
|
||||
if (entry->wired_count != 0)
|
||||
printf("wired, ");
|
||||
db_printf("wired, ");
|
||||
}
|
||||
if (entry->is_a_map || entry->is_sub_map) {
|
||||
printf("share=0x%x, offset=0x%x\n",
|
||||
db_printf("share=0x%x, offset=0x%x\n",
|
||||
(int) entry->object.share_map,
|
||||
(int) entry->offset);
|
||||
if ((entry->prev == &map->header) ||
|
||||
(!entry->prev->is_a_map) ||
|
||||
(entry->prev->object.share_map !=
|
||||
entry->object.share_map)) {
|
||||
indent += 2;
|
||||
db_indent += 2;
|
||||
vm_map_print((int)entry->object.share_map,
|
||||
full, 0, (char *)0);
|
||||
indent -= 2;
|
||||
db_indent -= 2;
|
||||
}
|
||||
} else {
|
||||
printf("object=0x%x, offset=0x%x",
|
||||
db_printf("object=0x%x, offset=0x%x",
|
||||
(int) entry->object.vm_object,
|
||||
(int) entry->offset);
|
||||
if (entry->copy_on_write)
|
||||
printf(", copy (%s)",
|
||||
db_printf(", copy (%s)",
|
||||
entry->needs_copy ? "needed" : "done");
|
||||
printf("\n");
|
||||
db_printf("\n");
|
||||
|
||||
if ((entry->prev == &map->header) ||
|
||||
(entry->prev->is_a_map) ||
|
||||
(entry->prev->object.vm_object !=
|
||||
entry->object.vm_object)) {
|
||||
indent += 2;
|
||||
db_indent += 2;
|
||||
vm_object_print((int)entry->object.vm_object,
|
||||
full, 0, (char *)0);
|
||||
indent -= 2;
|
||||
db_indent -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
indent -= 2;
|
||||
db_indent -= 2;
|
||||
}
|
||||
#endif
|
||||
#endif /* DDB */
|
||||
|
@ -61,13 +61,12 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_object.c,v 1.79 1996/08/21 21:56:19 dyson Exp $
|
||||
* $Id: vm_object.c,v 1.80 1996/09/08 20:44:41 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Virtual memory object module.
|
||||
*/
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -93,16 +92,7 @@
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
#ifdef DDB
|
||||
static void DDB_vm_object_check __P((void));
|
||||
#endif
|
||||
|
||||
static void _vm_object_allocate __P((objtype_t, vm_size_t, vm_object_t));
|
||||
#ifdef DDB
|
||||
static int _vm_object_in_map __P((vm_map_t map, vm_object_t object,
|
||||
vm_map_entry_t entry));
|
||||
static int vm_object_in_map __P((vm_object_t object));
|
||||
#endif
|
||||
static void vm_object_qcollapse __P((vm_object_t object));
|
||||
#ifdef not_used
|
||||
static void vm_object_deactivate_pages __P((vm_object_t));
|
||||
@ -1334,7 +1324,17 @@ vm_object_coalesce(prev_object, prev_pindex, prev_size, next_size)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#ifdef DDB
|
||||
#include <sys/kernel.h>
|
||||
|
||||
#include <machine/cons.h>
|
||||
|
||||
#include <ddb/ddb.h>
|
||||
|
||||
static int _vm_object_in_map __P((vm_map_t map, vm_object_t object,
|
||||
vm_map_entry_t entry));
|
||||
static int vm_object_in_map __P((vm_object_t object));
|
||||
|
||||
static int
|
||||
_vm_object_in_map(map, object, entry)
|
||||
@ -1408,10 +1408,7 @@ vm_object_in_map( object)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DDB
|
||||
static void
|
||||
DDB_vm_object_check()
|
||||
DB_SHOW_COMMAND(vmochk, vm_object_check)
|
||||
{
|
||||
vm_object_t object;
|
||||
|
||||
@ -1425,11 +1422,11 @@ DDB_vm_object_check()
|
||||
if (object->handle == NULL &&
|
||||
(object->type == OBJT_DEFAULT || object->type == OBJT_SWAP)) {
|
||||
if (object->ref_count == 0) {
|
||||
printf("vmochk: internal obj has zero ref count: %d\n",
|
||||
db_printf("vmochk: internal obj has zero ref count: %d\n",
|
||||
object->size);
|
||||
}
|
||||
if (!vm_object_in_map(object)) {
|
||||
printf("vmochk: internal obj is not in a map: "
|
||||
db_printf("vmochk: internal obj is not in a map: "
|
||||
"ref: %d, size: %d: 0x%x, backing_object: 0x%x\n",
|
||||
object->ref_count, object->size,
|
||||
object->size, object->backing_object);
|
||||
@ -1437,61 +1434,74 @@ DDB_vm_object_check()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* DDB */
|
||||
|
||||
/*
|
||||
* vm_object_print: [ debug ]
|
||||
*/
|
||||
void
|
||||
vm_object_print(iobject, full, dummy3, dummy4)
|
||||
/* db_expr_t */ int iobject;
|
||||
boolean_t full;
|
||||
/* db_expr_t */ int dummy3;
|
||||
char *dummy4;
|
||||
DB_SHOW_COMMAND(object, vm_object_print_static)
|
||||
{
|
||||
vm_object_t object = (vm_object_t)iobject; /* XXX */
|
||||
/* XXX convert args. */
|
||||
vm_object_t object = (vm_object_t)addr;
|
||||
boolean_t full = have_addr;
|
||||
|
||||
register vm_page_t p;
|
||||
|
||||
/* XXX count is an (unused) arg. Avoid shadowing it. */
|
||||
#define count was_count
|
||||
|
||||
register int count;
|
||||
|
||||
if (object == NULL)
|
||||
return;
|
||||
|
||||
iprintf("Object 0x%x: size=0x%x, res=%d, ref=%d, ",
|
||||
db_iprintf("Object 0x%x: size=0x%x, res=%d, ref=%d, ",
|
||||
(int) object, (int) object->size,
|
||||
object->resident_page_count, object->ref_count);
|
||||
printf("offset=0x%x, backing_object=(0x%x)+0x%x\n",
|
||||
db_printf("offset=0x%x, backing_object=(0x%x)+0x%x\n",
|
||||
(int) object->paging_offset,
|
||||
(int) object->backing_object, (int) object->backing_object_offset);
|
||||
printf("cache: next=%p, prev=%p\n",
|
||||
db_printf("cache: next=%p, prev=%p\n",
|
||||
TAILQ_NEXT(object, cached_list), TAILQ_PREV(object, cached_list));
|
||||
|
||||
if (!full)
|
||||
return;
|
||||
|
||||
indent += 2;
|
||||
db_indent += 2;
|
||||
count = 0;
|
||||
for (p = TAILQ_FIRST(&object->memq); p != NULL; p = TAILQ_NEXT(p, listq)) {
|
||||
if (count == 0)
|
||||
iprintf("memory:=");
|
||||
db_iprintf("memory:=");
|
||||
else if (count == 6) {
|
||||
printf("\n");
|
||||
iprintf(" ...");
|
||||
db_printf("\n");
|
||||
db_iprintf(" ...");
|
||||
count = 0;
|
||||
} else
|
||||
printf(",");
|
||||
db_printf(",");
|
||||
count++;
|
||||
|
||||
printf("(off=0x%lx,page=0x%lx)",
|
||||
db_printf("(off=0x%lx,page=0x%lx)",
|
||||
(u_long) p->pindex, (u_long) VM_PAGE_TO_PHYS(p));
|
||||
}
|
||||
if (count != 0)
|
||||
printf("\n");
|
||||
indent -= 2;
|
||||
db_printf("\n");
|
||||
db_indent -= 2;
|
||||
}
|
||||
|
||||
/* XXX. */
|
||||
#undef count
|
||||
|
||||
/* XXX need this non-static entry for calling from vm_map_print. */
|
||||
void
|
||||
vm_object_print_pages()
|
||||
vm_object_print(addr, have_addr, count, modif)
|
||||
db_expr_t addr;
|
||||
boolean_t have_addr;
|
||||
db_expr_t count;
|
||||
char *modif;
|
||||
{
|
||||
vm_object_print_static(addr, have_addr, count, modif);
|
||||
}
|
||||
|
||||
DB_SHOW_COMMAND(vmopag, vm_object_print_pages)
|
||||
{
|
||||
vm_object_t object;
|
||||
int nl = 0;
|
||||
@ -1577,5 +1587,4 @@ vm_object_print_pages()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* DDB */
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91
|
||||
* $Id: vm_page.c,v 1.62 1996/07/30 03:08:15 dyson Exp $
|
||||
* $Id: vm_page.c,v 1.63 1996/09/08 20:44:44 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -67,7 +67,6 @@
|
||||
/*
|
||||
* Resident memory management module.
|
||||
*/
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -87,11 +86,10 @@
|
||||
#include <vm/vm_pageout.h>
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
#ifdef DDB
|
||||
extern void DDB_print_page_info __P((void));
|
||||
#endif
|
||||
|
||||
static void vm_page_queue_init(void);
|
||||
static void vm_page_queue_init __P((void));
|
||||
static vm_page_t
|
||||
vm_page_select_free __P((vm_object_t object, vm_pindex_t pindex,
|
||||
int prefqueue));
|
||||
|
||||
/*
|
||||
* Associated with page of user-allocatable memory is a
|
||||
@ -163,10 +161,8 @@ static u_short vm_page_dev_bsize_chunks[] = {
|
||||
0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff, 0xffff
|
||||
};
|
||||
|
||||
static inline __pure int
|
||||
vm_page_hash __P((vm_object_t object, vm_pindex_t pindex))
|
||||
__pure2;
|
||||
|
||||
static inline int vm_page_hash __P((vm_object_t object, vm_pindex_t pindex))
|
||||
__pure2;
|
||||
static int vm_page_freechk_and_unqueue __P((vm_page_t m));
|
||||
static void vm_page_free_wakeup __P((void));
|
||||
|
||||
@ -392,7 +388,7 @@ vm_page_startup(starta, enda, vaddr)
|
||||
*
|
||||
* NOTE: This macro depends on vm_page_bucket_count being a power of 2.
|
||||
*/
|
||||
static inline __pure int
|
||||
static inline int
|
||||
vm_page_hash(object, pindex)
|
||||
vm_object_t object;
|
||||
vm_pindex_t pindex;
|
||||
@ -628,7 +624,7 @@ vm_page_list_find(basequeue, index)
|
||||
/*
|
||||
* Find a free or zero page, with specified preference.
|
||||
*/
|
||||
vm_page_t
|
||||
static vm_page_t
|
||||
vm_page_select_free(object, pindex, prefqueue)
|
||||
vm_object_t object;
|
||||
vm_pindex_t pindex;
|
||||
@ -1334,46 +1330,50 @@ vm_page_alloc_contig(size, low, high, alignment)
|
||||
return ((vm_offset_t)contigmalloc(size, M_DEVBUF, M_NOWAIT, low, high,
|
||||
alignment, 0ul));
|
||||
}
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#ifdef DDB
|
||||
void
|
||||
DDB_print_page_info(void)
|
||||
#include <sys/kernel.h>
|
||||
|
||||
#include <ddb/ddb.h>
|
||||
|
||||
DB_SHOW_COMMAND(page, vm_page_print_page_info)
|
||||
{
|
||||
printf("cnt.v_free_count: %d\n", cnt.v_free_count);
|
||||
printf("cnt.v_cache_count: %d\n", cnt.v_cache_count);
|
||||
printf("cnt.v_inactive_count: %d\n", cnt.v_inactive_count);
|
||||
printf("cnt.v_active_count: %d\n", cnt.v_active_count);
|
||||
printf("cnt.v_wire_count: %d\n", cnt.v_wire_count);
|
||||
printf("cnt.v_free_reserved: %d\n", cnt.v_free_reserved);
|
||||
printf("cnt.v_free_min: %d\n", cnt.v_free_min);
|
||||
printf("cnt.v_free_target: %d\n", cnt.v_free_target);
|
||||
printf("cnt.v_cache_min: %d\n", cnt.v_cache_min);
|
||||
printf("cnt.v_inactive_target: %d\n", cnt.v_inactive_target);
|
||||
db_printf("cnt.v_free_count: %d\n", cnt.v_free_count);
|
||||
db_printf("cnt.v_cache_count: %d\n", cnt.v_cache_count);
|
||||
db_printf("cnt.v_inactive_count: %d\n", cnt.v_inactive_count);
|
||||
db_printf("cnt.v_active_count: %d\n", cnt.v_active_count);
|
||||
db_printf("cnt.v_wire_count: %d\n", cnt.v_wire_count);
|
||||
db_printf("cnt.v_free_reserved: %d\n", cnt.v_free_reserved);
|
||||
db_printf("cnt.v_free_min: %d\n", cnt.v_free_min);
|
||||
db_printf("cnt.v_free_target: %d\n", cnt.v_free_target);
|
||||
db_printf("cnt.v_cache_min: %d\n", cnt.v_cache_min);
|
||||
db_printf("cnt.v_inactive_target: %d\n", cnt.v_inactive_target);
|
||||
}
|
||||
|
||||
void
|
||||
DDB_print_pageq_info(void)
|
||||
DB_SHOW_COMMAND(pageq, vm_page_print_pageq_info)
|
||||
{
|
||||
int i;
|
||||
printf("PQ_FREE:");
|
||||
db_printf("PQ_FREE:");
|
||||
for(i=0;i<PQ_L2_SIZE;i++) {
|
||||
printf(" %d", *vm_page_queues[PQ_FREE + i].lcnt);
|
||||
db_printf(" %d", *vm_page_queues[PQ_FREE + i].lcnt);
|
||||
}
|
||||
printf("\n");
|
||||
db_printf("\n");
|
||||
|
||||
printf("PQ_CACHE:");
|
||||
db_printf("PQ_CACHE:");
|
||||
for(i=0;i<PQ_L2_SIZE;i++) {
|
||||
printf(" %d", *vm_page_queues[PQ_CACHE + i].lcnt);
|
||||
db_printf(" %d", *vm_page_queues[PQ_CACHE + i].lcnt);
|
||||
}
|
||||
printf("\n");
|
||||
db_printf("\n");
|
||||
|
||||
printf("PQ_ZERO:");
|
||||
db_printf("PQ_ZERO:");
|
||||
for(i=0;i<PQ_L2_SIZE;i++) {
|
||||
printf(" %d", *vm_page_queues[PQ_ZERO + i].lcnt);
|
||||
db_printf(" %d", *vm_page_queues[PQ_ZERO + i].lcnt);
|
||||
}
|
||||
printf("\n");
|
||||
db_printf("\n");
|
||||
|
||||
printf("PQ_ACTIVE: %d, PQ_INACTIVE: %d\n",
|
||||
db_printf("PQ_ACTIVE: %d, PQ_INACTIVE: %d\n",
|
||||
*vm_page_queues[PQ_ACTIVE].lcnt,
|
||||
*vm_page_queues[PQ_INACTIVE].lcnt);
|
||||
}
|
||||
#endif
|
||||
#endif /* DDB */
|
||||
|
Loading…
Reference in New Issue
Block a user