Source-Changes-HG archive

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

[src/trunk]: src/sys/ddb print a message for the commands crash does not supp...



details:   https://anonhg.NetBSD.org/src/rev/ee9a8f9d00f7
branches:  trunk
changeset: 745694:ee9a8f9d00f7
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Mar 09 01:46:24 2020 +0000

description:
print a message for the commands crash does not support.
Allow "show lock"

diffstat:

 sys/ddb/db_command.c |  53 +++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 46 insertions(+), 7 deletions(-)

diffs (229 lines):

diff -r 70d11d2f2633 -r ee9a8f9d00f7 sys/ddb/db_command.c
--- a/sys/ddb/db_command.c      Mon Mar 09 01:06:34 2020 +0000
+++ b/sys/ddb/db_command.c      Mon Mar 09 01:46:24 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_command.c,v 1.167 2020/01/01 22:57:17 thorpej Exp $ */
+/*     $NetBSD: db_command.c,v 1.168 2020/03/09 01:46:24 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.167 2020/01/01 22:57:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.168 2020/03/09 01:46:24 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -121,6 +121,11 @@
 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
@@ -1012,6 +1017,8 @@
                addr = (db_expr_t)(uintptr_t)db_read_ptr("kernel_map");
 
        uvm_map_printit((struct vm_map *)(uintptr_t) addr, full, db_printf);
+#else
+       db_kernelonly();
 #endif /* XXX CRASH(8) */
 }
 
@@ -1028,6 +1035,8 @@
 
        uvm_object_printit((struct uvm_object *)(uintptr_t) addr, full,
            db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1043,6 +1052,8 @@
                full = true;
 
        uvm_page_printit((struct vm_page *)(uintptr_t) addr, full, db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1054,6 +1065,8 @@
 
 #ifdef _KERNEL /* XXX CRASH(8) */
        uvm_page_printall(db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1069,6 +1082,8 @@
                full = true;
 
        vfs_buf_print((struct buf *)(uintptr_t) addr, full, db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1142,6 +1157,8 @@
                full = true;
 
        vfs_vnode_print((struct vnode *)(uintptr_t) addr, full, db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1157,6 +1174,8 @@
                full = true;
 
        vfs_vnode_lock_print((struct vnode *)(uintptr_t) addr, full, db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1168,6 +1187,8 @@
 
 #ifdef _KERNEL /* XXX CRASH(8) */
        vmem_print((uintptr_t) addr, modif, db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1195,6 +1216,8 @@
                full = true;
 
        vfs_mount_print_all(full, db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1206,6 +1229,8 @@
 
 #ifdef _KERNEL /* XXX CRASH(8) */
        m_print((const struct mbuf *)(uintptr_t) addr, modif, db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1217,6 +1242,8 @@
 
 #ifdef _KERNEL /* XXX CRASH(8) */
        pool_printit((struct pool *)(uintptr_t) addr, modif, db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1228,6 +1255,8 @@
 
 #ifdef _KERNEL /* XXX CRASH(8) */
        namecache_print((struct vnode *)(uintptr_t) addr, db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1239,6 +1268,8 @@
 
 #ifdef _KERNEL /* XXX CRASH(8) */
        uvmexp_print(db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1250,6 +1281,8 @@
 
 #ifdef _KERNEL /* XXX CRASH(8) */
        socket_print(modif, db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1272,10 +1305,8 @@
     db_expr_t count, const char *modif)
 {
 
-#ifdef _KERNEL /* XXX CRASH(8) */
        lockdebug_lock_print(have_addr ? (void *)(uintptr_t)addr : NULL,
            db_printf);
-#endif
 }
 
 static void
@@ -1285,6 +1316,8 @@
 
 #ifdef _KERNEL /* XXX CRASH(8) */
        lockdebug_show_all_locks(db_printf, modif);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1295,6 +1328,8 @@
 
 #ifdef _KERNEL /* XXX CRASH(8) */
        uvm_page_print_freelists(db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1305,6 +1340,8 @@
 
 #ifdef _KERNEL /* XXX CRASH(8) */
        lockdebug_show_lockstats(db_printf);
+#else
+       db_kernelonly();
 #endif
 }
 
@@ -1368,7 +1405,7 @@
                         args[5], args[6], args[7], args[8], args[9]);
        db_printf("%s\n", db_num_to_str(retval));
 #else  /* _KERNEL */
-       db_printf("This command can only be used in-kernel.\n");
+       db_kernelonly();
 #endif /* _KERNEL */
 }
 
@@ -1399,7 +1436,7 @@
        spl0();
        kern_reboot((int)bootflags, NULL);
 #else  /* _KERNEL */
-       db_printf("This command can only be used in-kernel.\n");
+       db_kernelonly();
 #endif /* _KERNEL */
 }
 
@@ -1466,7 +1503,7 @@
        panicstr = "dump forced via kernel debugger";
        kern_reboot(RB_DUMP, NULL);
 #else  /* _KERNEL */
-       db_printf("This command can only be used in-kernel.\n");
+       db_kernelonly();
 #endif /* _KERNEL */
 }
 
@@ -1485,5 +1522,7 @@
        vmem_whatis(addr, db_printf);
        uvm_whatis(addr, db_printf);
        module_whatis(addr, db_printf);
+#else
+       db_kernelonly();
 #endif
 }



Home | Main Index | Thread Index | Old Index