Module Name: src Committed By: christos Date: Tue Mar 10 15:58:37 UTC 2020
Modified Files: src/sys/ddb: db_command.c db_command.h db_print.c db_variables.c db_xxx.c Log Message: Make the db_kernelonly() macro visible to all files and re-use it. Register access is kernel only. To generate a diff of this commit: cvs rdiff -u -r1.168 -r1.169 src/sys/ddb/db_command.c cvs rdiff -u -r1.35 -r1.36 src/sys/ddb/db_command.h cvs rdiff -u -r1.28 -r1.29 src/sys/ddb/db_print.c cvs rdiff -u -r1.46 -r1.47 src/sys/ddb/db_variables.c cvs rdiff -u -r1.73 -r1.74 src/sys/ddb/db_xxx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/ddb/db_command.c diff -u src/sys/ddb/db_command.c:1.168 src/sys/ddb/db_command.c:1.169 --- src/sys/ddb/db_command.c:1.168 Sun Mar 8 21:46:24 2020 +++ src/sys/ddb/db_command.c Tue Mar 10 11:58:36 2020 @@ -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 Index: src/sys/ddb/db_command.h diff -u src/sys/ddb/db_command.h:1.35 src/sys/ddb/db_command.h:1.36 --- src/sys/ddb/db_command.h:1.35 Sat Mar 7 17:02:17 2009 +++ src/sys/ddb/db_command.h Tue Mar 10 11:58:37 2020 @@ -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_*/ Index: src/sys/ddb/db_print.c diff -u src/sys/ddb/db_print.c:1.28 src/sys/ddb/db_print.c:1.29 --- src/sys/ddb/db_print.c:1.28 Tue Apr 12 04:42:12 2011 +++ src/sys/ddb/db_print.c Tue Mar 10 11:58:37 2020 @@ -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_a db_printf("\n"); } db_print_loc_and_inst(PC_REGS(DDB_REGS)); +#else + db_kernelonly(); +#endif } Index: src/sys/ddb/db_variables.c diff -u src/sys/ddb/db_variables.c:1.46 src/sys/ddb/db_variables.c:1.47 --- src/sys/ddb/db_variables.c:1.46 Fri Feb 16 19:41:09 2018 +++ src/sys/ddb/db_variables.c Tue Mar 10 11:58:37 2020 @@ -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_variabl 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*/ Index: src/sys/ddb/db_xxx.c diff -u src/sys/ddb/db_xxx.c:1.73 src/sys/ddb/db_xxx.c:1.74 --- src/sys/ddb/db_xxx.c:1.73 Fri Jan 31 21:23:23 2020 +++ src/sys/ddb/db_xxx.c Tue Mar 10 11:58:37 2020 @@ -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 }