diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index 59bcff73595a..b2a21da5689f 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -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 -__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 diff --git a/sys/ddb/db_command.h b/sys/ddb/db_command.h index 9cf8fa967f84..abf761159ce3 100644 --- a/sys/ddb/db_command.h +++ b/sys/ddb/db_command.h @@ -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_*/ diff --git a/sys/ddb/db_print.c b/sys/ddb/db_print.c index 01f962985449..5b54ee06d93a 100644 --- a/sys/ddb/db_print.c +++ b/sys/ddb/db_print.c @@ -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 -__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 #include @@ -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 } diff --git a/sys/ddb/db_variables.c b/sys/ddb/db_variables.c index c721dc86acbc..e3f6d34020ac 100644 --- a/sys/ddb/db_variables.c +++ b/sys/ddb/db_variables.c @@ -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 -__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*/ diff --git a/sys/ddb/db_xxx.c b/sys/ddb/db_xxx.c index 00add1ec7087..d183a8658aca 100644 --- a/sys/ddb/db_xxx.c +++ b/sys/ddb/db_xxx.c @@ -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 -__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 }