Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ddb Make the db_kernelonly() macro visible to all files ...



details:   https://anonhg.NetBSD.org/src/rev/8b311e4545a1
branches:  trunk
changeset: 1008093:8b311e4545a1
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Mar 10 15:58:36 2020 +0000

description:
Make the db_kernelonly() macro visible to all files and re-use it.
Register access is kernel only.

diffstat:

 sys/ddb/db_command.c   |  9 ++-------
 sys/ddb/db_command.h   |  7 ++++++-
 sys/ddb/db_print.c     |  8 ++++++--
 sys/ddb/db_variables.c |  6 ++++--
 sys/ddb/db_xxx.c       |  6 +++---
 5 files changed, 21 insertions(+), 15 deletions(-)

diffs (143 lines):

diff -r 139e5ebcfd6e -r 8b311e4545a1 sys/ddb/db_command.c
--- a/sys/ddb/db_command.c      Tue Mar 10 15:54:52 2020 +0000
+++ b/sys/ddb/db_command.c      Tue Mar 10 15:58:36 2020 +0000
@@ -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_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 -r 139e5ebcfd6e -r 8b311e4545a1 sys/ddb/db_command.h
--- a/sys/ddb/db_command.h      Tue Mar 10 15:54:52 2020 +0000
+++ b/sys/ddb/db_command.h      Tue Mar 10 15:58:36 2020 +0000
@@ -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_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 -r 139e5ebcfd6e -r 8b311e4545a1 sys/ddb/db_print.c
--- a/sys/ddb/db_print.c        Tue Mar 10 15:54:52 2020 +0000
+++ b/sys/ddb/db_print.c        Tue Mar 10 15:58:36 2020 +0000
@@ -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 @@
 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_printf("\n");
        }
        db_print_loc_and_inst(PC_REGS(DDB_REGS));
+#else
+       db_kernelonly();
+#endif
 }
diff -r 139e5ebcfd6e -r 8b311e4545a1 sys/ddb/db_variables.c
--- a/sys/ddb/db_variables.c    Tue Mar 10 15:54:52 2020 +0000
+++ b/sys/ddb/db_variables.c    Tue Mar 10 15:58:36 2020 +0000
@@ -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 @@
                                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 -r 139e5ebcfd6e -r 8b311e4545a1 sys/ddb/db_xxx.c
--- a/sys/ddb/db_xxx.c  Tue Mar 10 15:54:52 2020 +0000
+++ b/sys/ddb/db_xxx.c  Tue Mar 10 15:58:36 2020 +0000
@@ -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 @@
        if (t)
                mutex_exit(proc_lock);
 #else
-       db_printf("This command is not currently supported.\n");
+       db_kernelonly();
 #endif
 }
 



Home | Main Index | Thread Index | Old Index