Fri Oct 30 06:57:09 2020 UTC ()
Trailing whitespace


(skrll)
diff -r1.170 -r1.171 src/sys/ddb/db_command.c
diff -r1.38 -r1.39 src/sys/ddb/db_command.h
diff -r1.27 -r1.28 src/sys/ddb/db_input.c
diff -r1.12 -r1.13 src/sys/ddb/db_proc.c

cvs diff -r1.170 -r1.171 src/sys/ddb/db_command.c (expand / switch to unified diff)

--- src/sys/ddb/db_command.c 2020/04/13 11:43:27 1.170
+++ src/sys/ddb/db_command.c 2020/10/30 06:57:08 1.171
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: db_command.c,v 1.170 2020/04/13 11:43:27 skrll Exp $ */ 1/* $NetBSD: db_command.c,v 1.171 2020/10/30 06:57:08 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009, 2019 4 * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009, 2019
5 * The NetBSD Foundation, Inc. 5 * The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Adam Hamsik, and by Andrew Doran. 9 * by Adam Hamsik, and by Andrew Doran.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -51,27 +51,27 @@ @@ -51,27 +51,27 @@
51 * School of Computer Science 51 * School of Computer Science
52 * Carnegie Mellon University 52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890 53 * Pittsburgh PA 15213-3890
54 * 54 *
55 * any improvements or extensions that they make and grant Carnegie the 55 * any improvements or extensions that they make and grant Carnegie the
56 * rights to redistribute these changes. 56 * rights to redistribute these changes.
57 */ 57 */
58 58
59/* 59/*
60 * Command dispatcher. 60 * Command dispatcher.
61 */ 61 */
62 62
63#include <sys/cdefs.h> 63#include <sys/cdefs.h>
64__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.170 2020/04/13 11:43:27 skrll Exp $"); 64__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.171 2020/10/30 06:57:08 skrll Exp $");
65 65
66#ifdef _KERNEL_OPT 66#ifdef _KERNEL_OPT
67#include "opt_aio.h" 67#include "opt_aio.h"
68#include "opt_ddb.h" 68#include "opt_ddb.h"
69#include "opt_kgdb.h" 69#include "opt_kgdb.h"
70#include "opt_mqueue.h" 70#include "opt_mqueue.h"
71#include "opt_inet.h" 71#include "opt_inet.h"
72#include "opt_kernhist.h" 72#include "opt_kernhist.h"
73#include "opt_ddbparam.h" 73#include "opt_ddbparam.h"
74#include "opt_multiprocessor.h" 74#include "opt_multiprocessor.h"
75#endif 75#endif
76 76
77#include <sys/param.h> 77#include <sys/param.h>
@@ -462,27 +462,27 @@ db_init_commands(void) @@ -462,27 +462,27 @@ db_init_commands(void)
462 462
463/* 463/*
464 * Add command table to the specified list 464 * Add command table to the specified list
465 * Arg: 465 * Arg:
466 * int type specifies type of command table DDB_SHOW_CMD|DDB_BASE_CMD|DDB_MAC_CMD 466 * int type specifies type of command table DDB_SHOW_CMD|DDB_BASE_CMD|DDB_MAC_CMD
467 * *cmd_tbl poiter to static allocated db_command table 467 * *cmd_tbl poiter to static allocated db_command table
468 * 468 *
469 * Command table must be NULL terminated array of struct db_command 469 * Command table must be NULL terminated array of struct db_command
470 */ 470 */
471int 471int
472db_register_tbl(uint8_t type, const struct db_command *cmd_tbl) 472db_register_tbl(uint8_t type, const struct db_command *cmd_tbl)
473{ 473{
474 struct db_cmd_tbl_en *list_ent; 474 struct db_cmd_tbl_en *list_ent;
475  475
476 /* empty list - ignore */ 476 /* empty list - ignore */
477 if (cmd_tbl->name == 0) 477 if (cmd_tbl->name == 0)
478 return 0; 478 return 0;
479 479
480 /* force builtin commands to be registered first */ 480 /* force builtin commands to be registered first */
481 db_init_commands(); 481 db_init_commands();
482 482
483 /* now create a list entry for this table */ 483 /* now create a list entry for this table */
484 list_ent = db_zalloc(sizeof(*list_ent)); 484 list_ent = db_zalloc(sizeof(*list_ent));
485 if (list_ent == NULL) 485 if (list_ent == NULL)
486 return ENOMEM; 486 return ENOMEM;
487 list_ent->db_cmd=cmd_tbl; 487 list_ent->db_cmd=cmd_tbl;
488 488

cvs diff -r1.38 -r1.39 src/sys/ddb/db_command.h (expand / switch to unified diff)

--- src/sys/ddb/db_command.h 2020/05/31 09:51:55 1.38
+++ src/sys/ddb/db_command.h 2020/10/30 06:57:08 1.39
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: db_command.h,v 1.38 2020/05/31 09:51:55 rin Exp $ */ 1/* $NetBSD: db_command.h,v 1.39 2020/10/30 06:57:08 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc. 4 * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Adam Hamsik. 8 * by Adam Hamsik.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -78,69 +78,69 @@ struct db_command; @@ -78,69 +78,69 @@ struct db_command;
78 78
79 79
80 80
81/* 81/*
82 * Macro include help when DDB_VERBOSE_HELP option(9) is used 82 * Macro include help when DDB_VERBOSE_HELP option(9) is used
83 */ 83 */
84#ifdef DDB_VERBOSE_HELP 84#ifdef DDB_VERBOSE_HELP
85#define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\ 85#define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\
86 name,funct,type,cmd_descr,cmd_arg,arg_desc 86 name,funct,type,cmd_descr,cmd_arg,arg_desc
87#else 87#else
88#define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\ 88#define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\
89 name,funct,type 89 name,funct,type
90#endif 90#endif
91  91
92 92
93 93
94/* 94/*
95 * we have two types of lists one for base commands like reboot 95 * we have two types of lists one for base commands like reboot
96 * and another list for show subcommands. 96 * and another list for show subcommands.
97 */ 97 */
98 98
99#define DDB_BASE_CMD 0 99#define DDB_BASE_CMD 0
100#define DDB_SHOW_CMD 1 100#define DDB_SHOW_CMD 1
101#define DDB_MACH_CMD 2 101#define DDB_MACH_CMD 2
102 102
103 103
104int db_register_tbl(uint8_t, const struct db_command *); 104int db_register_tbl(uint8_t, const struct db_command *);
105int db_unregister_tbl(uint8_t, const struct db_command *); 105int db_unregister_tbl(uint8_t, const struct db_command *);
106 106
107/* 107/*
108 * Command table 108 * Command table
109 */ 109 */
110struct db_command { 110struct db_command {
111 const char *name; /* command name */ 111 const char *name; /* command name */
112  112
113 /* function to call */ 113 /* function to call */
114 void (*fcn)(db_expr_t, bool, db_expr_t, const char *); 114 void (*fcn)(db_expr_t, bool, db_expr_t, const char *);
115 /* 115 /*
116 * Flag is used for modifing command behaviour. 116 * Flag is used for modifing command behaviour.
117 * CS_OWN && CS_MORE are specify type of command arguments. 117 * CS_OWN && CS_MORE are specify type of command arguments.
118 * CS_OWN commandmanage arguments in own way. 118 * CS_OWN commandmanage arguments in own way.
119 * CS_MORE db_command() prepare argument list. 119 * CS_MORE db_command() prepare argument list.
120 * 120 *
121 * CS_COMPAT is set for all level 2 commands with level 3 childs (show all pages) 121 * CS_COMPAT is set for all level 2 commands with level 3 childs (show all pages)
122 * 122 *
123 * CS_SHOW identify show command in BASE command list 123 * CS_SHOW identify show command in BASE command list
124 * CS_MACH identify mach command in BASE command list 124 * CS_MACH identify mach command in BASE command list
125 * 125 *
126 * CS_SET_DOT specify if this command is put to last added command memory. 126 * CS_SET_DOT specify if this command is put to last added command memory.
127 * CS_NOREPEAT this command does not repeat 127 * CS_NOREPEAT this command does not repeat
128 */ 128 */
129 uint16_t flag; /* extra info: */ 129 uint16_t flag; /* extra info: */
130#define CS_OWN 0x1 /* non-standard syntax */ 130#define CS_OWN 0x1 /* non-standard syntax */
131#define CS_MORE 0x2 /* standard syntax, but may have other 131#define CS_MORE 0x2 /* standard syntax, but may have other
132 words at end */ 132 words at end */
133#define CS_COMPAT 0x4 /* is set for compatibilty with old  133#define CS_COMPAT 0x4 /* is set for compatibilty with old
134 ddb versions*/ 134 ddb versions*/
135#define CS_SHOW 0x8 /* select show list */ 135#define CS_SHOW 0x8 /* select show list */
136#define CS_MACH 0x10 /* select machine dependent list */ 136#define CS_MACH 0x10 /* select machine dependent list */
137 137
138#define CS_SET_DOT 0x100 /* set dot after command */ 138#define CS_SET_DOT 0x100 /* set dot after command */
139#define CS_NOREPEAT 0x200 /* don't set last_command */ 139#define CS_NOREPEAT 0x200 /* don't set last_command */
140#ifdef DDB_VERBOSE_HELP 140#ifdef DDB_VERBOSE_HELP
141 const char *cmd_descr; /* description of command */ 141 const char *cmd_descr; /* description of command */
142 const char *cmd_arg; /* command arguments */ 142 const char *cmd_arg; /* command arguments */
143 const char *cmd_arg_help; /* arguments description */ 143 const char *cmd_arg_help; /* arguments description */
144#endif 144#endif
145}; 145};
146 146

cvs diff -r1.27 -r1.28 src/sys/ddb/db_input.c (expand / switch to unified diff)

--- src/sys/ddb/db_input.c 2019/09/29 02:00:22 1.27
+++ src/sys/ddb/db_input.c 2020/10/30 06:57:08 1.28
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: db_input.c,v 1.27 2019/09/29 02:00:22 uwe Exp $ */ 1/* $NetBSD: db_input.c,v 1.28 2020/10/30 06:57:08 skrll Exp $ */
2 2
3/* 3/*
4 * Mach Operating System 4 * Mach Operating System
5 * Copyright (c) 1991,1990 Carnegie Mellon University 5 * Copyright (c) 1991,1990 Carnegie Mellon University
6 * All Rights Reserved. 6 * All Rights Reserved.
7 * 7 *
8 * Permission to use, copy, modify and distribute this software and its 8 * Permission to use, copy, modify and distribute this software and its
9 * documentation is hereby granted, provided that both the copyright 9 * documentation is hereby granted, provided that both the copyright
10 * notice and this permission notice appear in all copies of the 10 * notice and this permission notice appear in all copies of the
11 * software, derivative works or modified versions, and any portions 11 * software, derivative works or modified versions, and any portions
12 * thereof, and that both notices appear in supporting documentation. 12 * thereof, and that both notices appear in supporting documentation.
13 * 13 *
14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science 21 * School of Computer Science
22 * Carnegie Mellon University 22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890 23 * Pittsburgh PA 15213-3890
24 * 24 *
25 * any improvements or extensions that they make and grant Carnegie the 25 * any improvements or extensions that they make and grant Carnegie the
26 * rights to redistribute these changes. 26 * rights to redistribute these changes.
27 * 27 *
28 * Author: David B. Golub, Carnegie Mellon University 28 * Author: David B. Golub, Carnegie Mellon University
29 * Date: 7/90 29 * Date: 7/90
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: db_input.c,v 1.27 2019/09/29 02:00:22 uwe Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: db_input.c,v 1.28 2020/10/30 06:57:08 skrll Exp $");
34 34
35#ifdef _KERNEL_OPT 35#ifdef _KERNEL_OPT
36#include "opt_ddbparam.h" 36#include "opt_ddbparam.h"
37#endif 37#endif
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/proc.h> 40#include <sys/proc.h>
41 41
42#include <ddb/ddb.h> 42#include <ddb/ddb.h>
43 43
44#include <dev/cons.h> 44#include <dev/cons.h>
45 45
46#ifndef DDB_HISTORY_SIZE 46#ifndef DDB_HISTORY_SIZE
@@ -143,27 +143,27 @@ db_delete_line(void) @@ -143,27 +143,27 @@ db_delete_line(void)
143 143
144static inline void 144static inline void
145db_hist_put(int c) 145db_hist_put(int c)
146{ 146{
147 KASSERT(&db_history[0] <= db_history_last); 147 KASSERT(&db_history[0] <= db_history_last);
148 KASSERT(db_history_last <= &db_history[DDB_HISTORY_SIZE-1]); 148 KASSERT(db_history_last <= &db_history[DDB_HISTORY_SIZE-1]);
149 149
150 *db_history_last++ = c; 150 *db_history_last++ = c;
151 151
152 if (db_history_last > &db_history[DDB_HISTORY_SIZE-1]) 152 if (db_history_last > &db_history[DDB_HISTORY_SIZE-1])
153 db_history_last = db_history; 153 db_history_last = db_history;
154} 154}
155#endif 155#endif
156  156
157 157
158/* returns true at end-of-line */ 158/* returns true at end-of-line */
159static int 159static int
160db_inputchar(int c) 160db_inputchar(int c)
161{ 161{
162 switch (c) { 162 switch (c) {
163 case CTRL('b'): 163 case CTRL('b'):
164 /* back up one character */ 164 /* back up one character */
165 if (db_lc > db_lbuf_start) { 165 if (db_lc > db_lbuf_start) {
166 cnputc(BACKUP); 166 cnputc(BACKUP);
167 db_lc--; 167 db_lc--;
168 } 168 }
169 break; 169 break;

cvs diff -r1.12 -r1.13 src/sys/ddb/db_proc.c (expand / switch to unified diff)

--- src/sys/ddb/db_proc.c 2020/04/04 13:59:16 1.12
+++ src/sys/ddb/db_proc.c 2020/10/30 06:57:08 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: db_proc.c,v 1.12 2020/04/04 13:59:16 mlelstv Exp $ */ 1/* $NetBSD: db_proc.c,v 1.13 2020/10/30 06:57:08 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2009, 2020 The NetBSD Foundation, Inc. 4 * Copyright (c) 2009, 2020 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran. 8 * by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -51,27 +51,27 @@ @@ -51,27 +51,27 @@
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE. 58 * SUCH DAMAGE.
59 * 59 *
60 * from: kern_proc.c 8.4 (Berkeley) 1/4/94 60 * from: kern_proc.c 8.4 (Berkeley) 1/4/94
61 */ 61 */
62 62
63#include <sys/cdefs.h> 63#include <sys/cdefs.h>
64__KERNEL_RCSID(0, "$NetBSD: db_proc.c,v 1.12 2020/04/04 13:59:16 mlelstv Exp $"); 64__KERNEL_RCSID(0, "$NetBSD: db_proc.c,v 1.13 2020/10/30 06:57:08 skrll Exp $");
65 65
66#ifndef _KERNEL 66#ifndef _KERNEL
67#include <stdbool.h> 67#include <stdbool.h>
68#endif 68#endif
69 69
70#include <sys/param.h> 70#include <sys/param.h>
71#include <sys/cpu.h> 71#include <sys/cpu.h>
72#include <sys/proc.h> 72#include <sys/proc.h>
73#ifdef _KERNEL /* XXX */ 73#ifdef _KERNEL /* XXX */
74#include <sys/kauth.h> 74#include <sys/kauth.h>
75#endif 75#endif
76 76
77#include <ddb/ddb.h> 77#include <ddb/ddb.h>
@@ -228,27 +228,27 @@ db_show_all_procs(db_expr_t addr, bool h @@ -228,27 +228,27 @@ db_show_all_procs(db_expr_t addr, bool h
228 if (lp != NULL && l.l_wchan && l.l_wmesg) { 228 if (lp != NULL && l.l_wchan && l.l_wmesg) {
229 db_read_string(l.l_wmesg, 229 db_read_string(l.l_wmesg,
230 sizeof(wbuf), wbuf); 230 sizeof(wbuf), wbuf);
231 wbuf[MAXCOMLEN] = '\0'; 231 wbuf[MAXCOMLEN] = '\0';
232 } else { 232 } else {
233 wbuf[0] = '\0'; 233 wbuf[0] = '\0';
234 } 234 }
235 db_printf("%8d %8d %10d %d %#7x %4d %16s %7.7s\n", 235 db_printf("%8d %8d %10d %d %#7x %4d %16s %7.7s\n",
236 p.p_pptr != NULL ? p.p_pptr->p_pid : -1, pgrp.pg_id, 236 p.p_pptr != NULL ? p.p_pptr->p_pid : -1, pgrp.pg_id,
237#ifdef _KERNEL 237#ifdef _KERNEL
238 kauth_cred_getuid(p.p_cred), 238 kauth_cred_getuid(p.p_cred),
239#else 239#else
240 /* XXX CRASH(8) */ 666, 240 /* XXX CRASH(8) */ 666,
241#endif  241#endif
242 p.p_stat, p.p_flag, 242 p.p_stat, p.p_flag,
243 p.p_nlwps, p.p_comm, 243 p.p_nlwps, p.p_comm,
244 (p.p_nlwps != 1) ? "*" : wbuf); 244 (p.p_nlwps != 1) ? "*" : wbuf);
245 break; 245 break;
246 246
247 case 'w': 247 case 'w':
248 while (lp != NULL) { 248 while (lp != NULL) {
249 if (l.l_wchan && l.l_wmesg) { 249 if (l.l_wchan && l.l_wmesg) {
250 db_read_string(l.l_wmesg, 250 db_read_string(l.l_wmesg,
251 sizeof(wbuf), wbuf); 251 sizeof(wbuf), wbuf);
252 wbuf[MAXCOMLEN] = '\0'; 252 wbuf[MAXCOMLEN] = '\0';
253 } else { 253 } else {
254 wbuf[0] = '\0'; 254 wbuf[0] = '\0';