Make the db_kernelonly() macro visible to all files and re-use it.
Register access is kernel only.
This commit is contained in:
parent
62b28cbd3f
commit
5a4646458a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_command.c,v 1.168 2020/03/09 01:46:24 christos Exp $ */
|
||||
/* $NetBSD: db_command.c,v 1.169 2020/03/10 15:58:36 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009, 2019
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.168 2020/03/09 01:46:24 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.169 2020/03/10 15:58:36 christos Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_aio.h"
|
||||
|
@ -121,11 +121,6 @@ db_addr_t db_prev;
|
|||
db_addr_t db_next;
|
||||
|
||||
|
||||
#ifndef _KERNEL
|
||||
#define db_kernelonly() \
|
||||
db_printf("%s: can only be used in-kernel.\n", __func__)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* New DDB api for adding and removing commands uses three lists, because
|
||||
* we use two types of commands
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_command.h,v 1.35 2009/03/07 22:02:17 ad Exp $ */
|
||||
/* $NetBSD: db_command.h,v 1.36 2020/03/10 15:58:37 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -148,4 +148,9 @@ void *db_alloc(size_t);
|
|||
void *db_zalloc(size_t);
|
||||
void db_free(void *, size_t);
|
||||
|
||||
#ifndef _KERNEL
|
||||
#define db_kernelonly() \
|
||||
db_printf("%s: can only be used in-kernel.\n", __func__)
|
||||
#endif
|
||||
|
||||
#endif /*_DDB_COMMAND_*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_print.c,v 1.28 2011/04/12 08:42:12 mrg Exp $ */
|
||||
/* $NetBSD: db_print.c,v 1.29 2020/03/10 15:58:37 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_print.c,v 1.28 2011/04/12 08:42:12 mrg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_print.c,v 1.29 2020/03/10 15:58:37 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
|
@ -47,6 +47,7 @@ void
|
|||
db_show_regs(db_expr_t addr, bool have_addr,
|
||||
db_expr_t count, const char *modif)
|
||||
{
|
||||
#ifdef _KERNEL
|
||||
const struct db_variable *regp;
|
||||
struct db_variable vs;
|
||||
db_expr_t value, offset;
|
||||
|
@ -71,4 +72,7 @@ db_show_regs(db_expr_t addr, bool have_addr,
|
|||
db_printf("\n");
|
||||
}
|
||||
db_print_loc_and_inst(PC_REGS(DDB_REGS));
|
||||
#else
|
||||
db_kernelonly();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_variables.c,v 1.46 2018/02/17 00:41:09 sevan Exp $ */
|
||||
/* $NetBSD: db_variables.c,v 1.47 2020/03/10 15:58:37 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_variables.c,v 1.46 2018/02/17 00:41:09 sevan Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_variables.c,v 1.47 2020/03/10 15:58:37 christos Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_ddbparam.h"
|
||||
|
@ -250,12 +250,14 @@ db_find_variable(const struct db_variable **varp)
|
|||
return (1);
|
||||
}
|
||||
}
|
||||
#ifdef _KERNEL
|
||||
for (vp = db_regs; vp < db_eregs; vp++) {
|
||||
if (!strcmp(db_tok_string, vp->name)) {
|
||||
*varp = vp;
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
db_error("Unknown variable\n");
|
||||
/*NOTREACHED*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_xxx.c,v 1.73 2020/02/01 02:23:23 riastradh Exp $ */
|
||||
/* $NetBSD: db_xxx.c,v 1.74 2020/03/10 15:58:37 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.73 2020/02/01 02:23:23 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.74 2020/03/10 15:58:37 christos Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_kgdb.h"
|
||||
|
@ -133,7 +133,7 @@ db_kill_proc(db_expr_t addr, bool haddr,
|
|||
if (t)
|
||||
mutex_exit(proc_lock);
|
||||
#else
|
||||
db_printf("This command is not currently supported.\n");
|
||||
db_kernelonly();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue