Add `show malloc' to dump the internal state of the MALLOC_DEBUG code.

This commit is contained in:
thorpej 2001-08-17 01:00:10 +00:00
parent bbd3d01db5
commit fae2a1befd
2 changed files with 23 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_command.c,v 1.61 2001/07/31 04:28:16 atatat Exp $ */
/* $NetBSD: db_command.c,v 1.62 2001/08/17 01:00:10 thorpej Exp $ */
/*
* Mach Operating System
@ -39,6 +39,7 @@
#include <sys/vnode.h>
#include <sys/pool.h>
#include <sys/namei.h>
#include <sys/malloc.h>
#include <machine/db_machdep.h> /* type definitions */
@ -359,6 +360,24 @@ db_map_print_cmd(addr, have_addr, count, modif)
uvm_map_printit((struct vm_map *) addr, full, db_printf);
}
/*ARGSUSED*/
void
db_malloc_print_cmd(addr, have_addr, count, modif)
db_expr_t addr;
int have_addr;
db_expr_t count;
char * modif;
{
#ifdef MALLOC_DEBUG
if (!have_addr)
addr = 0;
debug_malloc_printit(db_printf, (vaddr_t) addr);
#else
db_printf("The kernel is not built with the MALLOC_DEBUG option.\n");
#endif /* MALLOC_DEBUG */
}
/*ARGSUSED*/
void
db_object_print_cmd(addr, have_addr, count, modif)
@ -482,6 +501,7 @@ static const struct db_command db_show_cmds[] = {
{ "uvmexp", db_uvmexp_print_cmd, 0, NULL },
{ "vnode", db_vnode_print_cmd, 0, NULL },
{ "watches", db_listwatch_cmd, 0, NULL },
{ "malloc", db_malloc_print_cmd, 0, NULL },
{ NULL, NULL, 0, NULL }
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_command.h,v 1.20 2001/01/22 13:56:55 jdolecek Exp $ */
/* $NetBSD: db_command.h,v 1.21 2001/08/17 01:00:10 thorpej Exp $ */
/*
* Mach Operating System
@ -39,6 +39,7 @@ int db_cmd_search __P((const char *, 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 *));