db_command.c revision 1.80 1 /* $NetBSD: db_command.c,v 1.80 2005/11/26 12:16:44 yamt Exp $ */
2
3 /*
4 * Mach Operating System
5 * Copyright (c) 1991,1990 Carnegie Mellon University
6 * All Rights Reserved.
7 *
8 * Permission to use, copy, modify and distribute this software and its
9 * documentation is hereby granted, provided that both the copyright
10 * notice and this permission notice appear in all copies of the
11 * software, derivative works or modified versions, and any portions
12 * thereof, and that both notices appear in supporting documentation.
13 *
14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
15 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
16 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 *
18 * Carnegie Mellon requests users of this software to return to
19 *
20 * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
24 *
25 * any improvements or extensions that they make and grant Carnegie the
26 * rights to redistribute these changes.
27 */
28
29 /*
30 * Command dispatcher.
31 */
32
33 #include <sys/cdefs.h>
34 __KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.80 2005/11/26 12:16:44 yamt Exp $");
35
36 #include "opt_ddb.h"
37 #include "opt_kgdb.h"
38 #include "opt_inet.h"
39 #include "opt_ddbparam.h"
40
41 #include <sys/param.h>
42 #include <sys/systm.h>
43 #include <sys/reboot.h>
44 #include <sys/device.h>
45 #include <sys/malloc.h>
46 #include <sys/namei.h>
47 #include <sys/pool.h>
48 #include <sys/proc.h>
49 #include <sys/vnode.h>
50
51 #include <machine/db_machdep.h> /* type definitions */
52
53 #if defined(_KERNEL_OPT)
54 #include "opt_multiprocessor.h"
55 #endif
56 #ifdef MULTIPROCESSOR
57 #include <machine/cpu.h>
58 #endif
59
60 #include <ddb/db_lex.h>
61 #include <ddb/db_output.h>
62 #include <ddb/db_command.h>
63 #include <ddb/db_break.h>
64 #include <ddb/db_watch.h>
65 #include <ddb/db_run.h>
66 #include <ddb/db_variables.h>
67 #include <ddb/db_interface.h>
68 #include <ddb/db_sym.h>
69 #include <ddb/db_extern.h>
70
71 #include <uvm/uvm_extern.h>
72 #include <uvm/uvm_ddb.h>
73
74 #include "arp.h"
75
76 /*
77 * Results of command search.
78 */
79 #define CMD_UNIQUE 0
80 #define CMD_FOUND 1
81 #define CMD_NONE 2
82 #define CMD_AMBIGUOUS 3
83 #define CMD_HELP 4
84
85 /*
86 * Exported global variables
87 */
88 boolean_t db_cmd_loop_done;
89 label_t *db_recover;
90 db_addr_t db_dot;
91 db_addr_t db_last_addr;
92 db_addr_t db_prev;
93 db_addr_t db_next;
94
95 /*
96 * if 'ed' style: 'dot' is set at start of last item printed,
97 * and '+' points to next line.
98 * Otherwise: 'dot' points to next item, '..' points to last.
99 */
100 static boolean_t db_ed_style = TRUE;
101
102 static void db_buf_print_cmd(db_expr_t, int, db_expr_t, const char *);
103 static void db_cmd_list(const struct db_command *);
104 static int db_cmd_search(const char *, const struct db_command *,
105 const struct db_command **);
106 static void db_command(const struct db_command **,
107 const struct db_command *);
108 static void db_event_print_cmd(db_expr_t, int, db_expr_t, const char *);
109 static void db_fncall(db_expr_t, int, db_expr_t, const char *);
110 static void db_malloc_print_cmd(db_expr_t, int, db_expr_t, const char *);
111 static void db_map_print_cmd(db_expr_t, int, db_expr_t, const char *);
112 static void db_namecache_print_cmd(db_expr_t, int, db_expr_t, const char *);
113 static void db_object_print_cmd(db_expr_t, int, db_expr_t, const char *);
114 static void db_page_print_cmd(db_expr_t, int, db_expr_t, const char *);
115 static void db_pool_print_cmd(db_expr_t, int, db_expr_t, const char *);
116 static void db_reboot_cmd(db_expr_t, int, db_expr_t, const char *);
117 static void db_sifting_cmd(db_expr_t, int, db_expr_t, const char *);
118 static void db_stack_trace_cmd(db_expr_t, int, db_expr_t, const char *);
119 static void db_sync_cmd(db_expr_t, int, db_expr_t, const char *);
120 static void db_uvmexp_print_cmd(db_expr_t, int, db_expr_t, const char *);
121 static void db_vnode_print_cmd(db_expr_t, int, db_expr_t, const char *);
122 static void db_mount_print_cmd(db_expr_t, int, db_expr_t, const char *);
123
124 /*
125 * 'show' commands
126 */
127
128 static const struct db_command db_show_all_cmds[] = {
129 { "callout", db_show_callout, 0, NULL },
130 { "procs", db_show_all_procs, 0, NULL },
131 { NULL, NULL, 0, NULL }
132 };
133
134 static const struct db_command db_show_cmds[] = {
135 { "all", NULL, 0, db_show_all_cmds },
136 #if defined(INET) && (NARP > 0)
137 { "arptab", db_show_arptab, 0, NULL },
138 #endif
139 { "breaks", db_listbreak_cmd, 0, NULL },
140 { "buf", db_buf_print_cmd, 0, NULL },
141 { "event", db_event_print_cmd, 0, NULL },
142 { "malloc", db_malloc_print_cmd, 0, NULL },
143 { "map", db_map_print_cmd, 0, NULL },
144 { "mount", db_mount_print_cmd, 0, NULL },
145 { "ncache", db_namecache_print_cmd, 0, NULL },
146 { "object", db_object_print_cmd, 0, NULL },
147 { "page", db_page_print_cmd, 0, NULL },
148 { "pool", db_pool_print_cmd, 0, NULL },
149 { "registers", db_show_regs, 0, NULL },
150 { "sched_qs", db_show_sched_qs, 0, NULL },
151 { "uvmexp", db_uvmexp_print_cmd, 0, NULL },
152 { "vnode", db_vnode_print_cmd, 0, NULL },
153 { "watches", db_listwatch_cmd, 0, NULL },
154 { NULL, NULL, 0, NULL }
155 };
156
157 /* arch/<arch>/<arch>/db_interface.c */
158 #ifdef DB_MACHINE_COMMANDS
159 extern const struct db_command db_machine_command_table[];
160 #endif
161
162 static const struct db_command db_command_table[] = {
163 { "b", db_breakpoint_cmd, 0, NULL },
164 { "break", db_breakpoint_cmd, 0, NULL },
165 { "bt", db_stack_trace_cmd, 0, NULL },
166 { "c", db_continue_cmd, 0, NULL },
167 { "call", db_fncall, CS_OWN, NULL },
168 { "callout", db_show_callout, 0, NULL },
169 { "continue", db_continue_cmd, 0, NULL },
170 { "d", db_delete_cmd, 0, NULL },
171 { "delete", db_delete_cmd, 0, NULL },
172 { "dmesg", db_dmesg, 0, NULL },
173 { "dwatch", db_deletewatch_cmd, 0, NULL },
174 { "examine", db_examine_cmd, CS_SET_DOT, NULL },
175 { "kill", db_kill_proc, CS_OWN, NULL },
176 #ifdef KGDB
177 { "kgdb", db_kgdb_cmd, 0, NULL },
178 #endif
179 #ifdef DB_MACHINE_COMMANDS
180 { "machine", NULL, 0, db_machine_command_table },
181 #endif
182 { "match", db_trace_until_matching_cmd,0, NULL },
183 { "next", db_trace_until_matching_cmd,0, NULL },
184 { "p", db_print_cmd, 0, NULL },
185 { "print", db_print_cmd, 0, NULL },
186 { "ps", db_show_all_procs, 0, NULL },
187 { "reboot", db_reboot_cmd, CS_OWN, NULL },
188 { "s", db_single_step_cmd, 0, NULL },
189 { "search", db_search_cmd, CS_OWN|CS_SET_DOT, NULL },
190 { "set", db_set_cmd, CS_OWN, NULL },
191 { "show", NULL, 0, db_show_cmds },
192 { "sifting", db_sifting_cmd, CS_OWN, NULL },
193 { "step", db_single_step_cmd, 0, NULL },
194 { "sync", db_sync_cmd, CS_OWN, NULL },
195 { "trace", db_stack_trace_cmd, 0, NULL },
196 { "until", db_trace_until_call_cmd,0, NULL },
197 { "w", db_write_cmd, CS_MORE|CS_SET_DOT, NULL },
198 { "watch", db_watchpoint_cmd, CS_MORE, NULL },
199 { "write", db_write_cmd, CS_MORE|CS_SET_DOT, NULL },
200 { "x", db_examine_cmd, CS_SET_DOT, NULL },
201 { NULL, NULL, 0, NULL }
202 };
203
204 static const struct db_command *db_last_command = NULL;
205 #if defined(DDB_COMMANDONENTER)
206 const char *db_cmd_on_enter = ___STRING(DDB_COMMANDONENTER);
207 #endif /* defined(DDB_COMMANDONENTER) */
208 #define DB_LINE_SEP ';'
209
210 /*
211 * Utility routine - discard tokens through end-of-line.
212 */
213 void
214 db_skip_to_eol(void)
215 {
216 int t;
217
218 do {
219 t = db_read_token();
220 } while (t != tEOL);
221 }
222
223 void
224 db_error(s)
225 const char *s;
226 {
227
228 if (s)
229 db_printf("%s", s);
230 db_flush_lex();
231 longjmp(db_recover);
232 }
233
234 void
235 db_command_loop(void)
236 {
237 label_t db_jmpbuf;
238 label_t *savejmp;
239
240 /*
241 * Initialize 'prev' and 'next' to dot.
242 */
243 db_prev = db_dot;
244 db_next = db_dot;
245
246 db_cmd_loop_done = 0;
247
248 savejmp = db_recover;
249 db_recover = &db_jmpbuf;
250 (void) setjmp(&db_jmpbuf);
251
252 #if defined(DDB_COMMANDONENTER)
253 if (db_cmd_on_enter != NULL) {
254 const struct db_command *dummy = NULL;
255 const char *cmd = db_cmd_on_enter;
256
257 while (*cmd != '\0') {
258 const char *ep = cmd;
259
260 while (*ep != '\0' && *ep != DB_LINE_SEP) {
261 ep++;
262 }
263 db_set_line(cmd, ep);
264 db_command(&dummy, db_command_table);
265 cmd = ep;
266 if (*cmd == DB_LINE_SEP) {
267 cmd++;
268 }
269 }
270 }
271 #endif /* defined(DDB_COMMANDONENTER) */
272
273 while (!db_cmd_loop_done) {
274 if (db_print_position() != 0)
275 db_printf("\n");
276 db_output_line = 0;
277
278
279 #ifdef MULTIPROCESSOR
280 db_printf("db{%ld}> ", (long)cpu_number());
281 #else
282 db_printf("db> ");
283 #endif
284 (void) db_read_line();
285
286 db_command(&db_last_command, db_command_table);
287 }
288
289 db_recover = savejmp;
290 }
291
292 /*
293 * Search for command prefix.
294 */
295 static int
296 db_cmd_search(const char *name, const struct db_command *table,
297 const struct db_command **cmdp)
298 {
299 const struct db_command *cmd;
300 int result = CMD_NONE;
301
302 for (cmd = table; cmd->name != 0; cmd++) {
303 const char *lp;
304 const char *rp;
305 int c;
306
307 lp = name;
308 rp = cmd->name;
309 while ((c = *lp) == *rp) {
310 if (c == 0) {
311 /* complete match */
312 *cmdp = cmd;
313 return (CMD_UNIQUE);
314 }
315 lp++;
316 rp++;
317 }
318 if (c == 0) {
319 /* end of name, not end of command -
320 partial match */
321 if (result == CMD_FOUND) {
322 result = CMD_AMBIGUOUS;
323 /* but keep looking for a full match -
324 this lets us match single letters */
325 } else {
326 *cmdp = cmd;
327 result = CMD_FOUND;
328 }
329 }
330 }
331 if (result == CMD_NONE) {
332 /* check for 'help' */
333 if (name[0] == 'h' && name[1] == 'e'
334 && name[2] == 'l' && name[3] == 'p')
335 result = CMD_HELP;
336 }
337 return (result);
338 }
339
340 static void
341 db_cmd_list(const struct db_command *table)
342 {
343 int i, j, w, columns, lines, width=0, numcmds;
344 const char *p;
345
346 for (numcmds = 0; table[numcmds].name != NULL; numcmds++) {
347 w = strlen(table[numcmds].name);
348 if (w > width)
349 width = w;
350 }
351 width = DB_NEXT_TAB(width);
352
353 columns = db_max_width / width;
354 if (columns == 0)
355 columns = 1;
356 lines = (numcmds + columns - 1) / columns;
357 for (i = 0; i < lines; i++) {
358 for (j = 0; j < columns; j++) {
359 p = table[j * lines + i].name;
360 if (p)
361 db_printf("%s", p);
362 if (j * lines + i + lines >= numcmds) {
363 db_putchar('\n');
364 break;
365 }
366 w = strlen(p);
367 while (w < width) {
368 w = DB_NEXT_TAB(w);
369 db_putchar('\t');
370 }
371 }
372 }
373 }
374
375 static void
376 db_command(const struct db_command **last_cmdp,
377 const struct db_command *cmd_table)
378 {
379 const struct db_command *cmd;
380 int t;
381 char modif[TOK_STRING_SIZE];
382 db_expr_t addr, count;
383 boolean_t have_addr = FALSE;
384 int result;
385
386 static db_expr_t last_count = 0;
387
388 t = db_read_token();
389 if ((t == tEOL) || (t == tCOMMA)) {
390 /*
391 * An empty line repeats last command, at 'next'.
392 * Only a count repeats the last command with the new count.
393 */
394 cmd = *last_cmdp;
395 addr = (db_expr_t)db_next;
396 if (t == tCOMMA) {
397 if (!db_expression(&count)) {
398 db_printf("Count missing\n");
399 db_flush_lex();
400 return;
401 }
402 } else
403 count = last_count;
404 have_addr = FALSE;
405 modif[0] = '\0';
406 db_skip_to_eol();
407 } else if (t == tEXCL) {
408 db_fncall(0, 0, 0, NULL);
409 return;
410 } else if (t != tIDENT) {
411 db_printf("?\n");
412 db_flush_lex();
413 return;
414 } else {
415 /*
416 * Search for command
417 */
418 while (cmd_table) {
419 result = db_cmd_search(db_tok_string, cmd_table, &cmd);
420 switch (result) {
421 case CMD_NONE:
422 db_printf("No such command\n");
423 db_flush_lex();
424 return;
425 case CMD_AMBIGUOUS:
426 db_printf("Ambiguous\n");
427 db_flush_lex();
428 return;
429 case CMD_HELP:
430 db_cmd_list(cmd_table);
431 db_flush_lex();
432 return;
433 default:
434 break;
435 }
436 if ((cmd_table = cmd->more) != 0) {
437 t = db_read_token();
438 if (t != tIDENT) {
439 db_cmd_list(cmd_table);
440 db_flush_lex();
441 return;
442 }
443 }
444 }
445
446 if ((cmd->flag & CS_OWN) == 0) {
447 /*
448 * Standard syntax:
449 * command [/modifier] [addr] [,count]
450 */
451 t = db_read_token();
452 if (t == tSLASH) {
453 t = db_read_token();
454 if (t != tIDENT) {
455 db_printf("Bad modifier\n");
456 db_flush_lex();
457 return;
458 }
459 strlcpy(modif, db_tok_string, sizeof(modif));
460 } else {
461 db_unread_token(t);
462 modif[0] = '\0';
463 }
464
465 if (db_expression(&addr)) {
466 db_dot = (db_addr_t) addr;
467 db_last_addr = db_dot;
468 have_addr = TRUE;
469 } else {
470 addr = (db_expr_t) db_dot;
471 have_addr = FALSE;
472 }
473 t = db_read_token();
474 if (t == tCOMMA) {
475 if (!db_expression(&count)) {
476 db_printf("Count missing\n");
477 db_flush_lex();
478 return;
479 }
480 } else {
481 db_unread_token(t);
482 count = -1;
483 }
484 if ((cmd->flag & CS_MORE) == 0) {
485 db_skip_to_eol();
486 }
487 }
488 }
489 *last_cmdp = cmd;
490 last_count = count;
491 if (cmd != 0) {
492 /*
493 * Execute the command.
494 */
495 (*cmd->fcn)(addr, have_addr, count, modif);
496
497 if (cmd->flag & CS_SET_DOT) {
498 /*
499 * If command changes dot, set dot to
500 * previous address displayed (if 'ed' style).
501 */
502 if (db_ed_style)
503 db_dot = db_prev;
504 else
505 db_dot = db_next;
506 } else {
507 /*
508 * If command does not change dot,
509 * set 'next' location to be the same.
510 */
511 db_next = db_dot;
512 }
513 }
514 }
515
516 /*ARGSUSED*/
517 static void
518 db_map_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
519 {
520 boolean_t full = FALSE;
521
522 if (modif[0] == 'f')
523 full = TRUE;
524
525 if (have_addr == FALSE)
526 addr = (db_expr_t)(intptr_t) kernel_map;
527
528 uvm_map_printit((struct vm_map *)(intptr_t) addr, full, db_printf);
529 }
530
531 /*ARGSUSED*/
532 static void
533 db_malloc_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
534 {
535
536 #ifdef MALLOC_DEBUG
537 if (!have_addr)
538 addr = 0;
539
540 debug_malloc_printit(db_printf, (vaddr_t) addr);
541 #else
542 db_printf("The kernel is not built with the MALLOC_DEBUG option.\n");
543 #endif /* MALLOC_DEBUG */
544 }
545
546 /*ARGSUSED*/
547 static void
548 db_object_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
549 {
550 boolean_t full = FALSE;
551
552 if (modif[0] == 'f')
553 full = TRUE;
554
555 uvm_object_printit((struct uvm_object *)(intptr_t) addr, full,
556 db_printf);
557 }
558
559 /*ARGSUSED*/
560 static void
561 db_page_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
562 {
563 boolean_t full = FALSE;
564
565 if (modif[0] == 'f')
566 full = TRUE;
567
568 uvm_page_printit((struct vm_page *)(intptr_t) addr, full, db_printf);
569 }
570
571 /*ARGSUSED*/
572 static void
573 db_buf_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
574 {
575 boolean_t full = FALSE;
576
577 if (modif[0] == 'f')
578 full = TRUE;
579
580 vfs_buf_print((struct buf *)(intptr_t) addr, full, db_printf);
581 }
582
583 /*ARGSUSED*/
584 static void
585 db_event_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
586 {
587 boolean_t full = FALSE;
588
589 if (modif[0] == 'f')
590 full = TRUE;
591
592 event_print(full, db_printf);
593 }
594
595 /*ARGSUSED*/
596 static void
597 db_vnode_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
598 {
599 boolean_t full = FALSE;
600
601 if (modif[0] == 'f')
602 full = TRUE;
603
604 vfs_vnode_print((struct vnode *)(intptr_t) addr, full, db_printf);
605 }
606
607 static void
608 db_mount_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
609 {
610 boolean_t full = FALSE;
611
612 if (modif[0] == 'f')
613 full = TRUE;
614
615 vfs_mount_print((struct mount *)(intptr_t) addr, full, db_printf);
616 }
617
618 /*ARGSUSED*/
619 static void
620 db_pool_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
621 {
622
623 pool_printit((struct pool *)(intptr_t) addr, modif, db_printf);
624 }
625
626 /*ARGSUSED*/
627 static void
628 db_namecache_print_cmd(db_expr_t addr, int have_addr, db_expr_t count,
629 const char *modif)
630 {
631
632 namecache_print((struct vnode *)(intptr_t) addr, db_printf);
633 }
634
635 /*ARGSUSED*/
636 static void
637 db_uvmexp_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
638 {
639
640 uvmexp_print(db_printf);
641 }
642
643 /*
644 * Call random function:
645 * !expr(arg,arg,arg)
646 */
647 /*ARGSUSED*/
648 static void
649 db_fncall(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
650 {
651 db_expr_t fn_addr;
652 #define MAXARGS 11
653 db_expr_t args[MAXARGS];
654 int nargs = 0;
655 db_expr_t retval;
656 db_expr_t (*func)(db_expr_t, ...);
657 int t;
658
659 if (!db_expression(&fn_addr)) {
660 db_printf("Bad function\n");
661 db_flush_lex();
662 return;
663 }
664 func = (db_expr_t (*)(db_expr_t, ...))(intptr_t) fn_addr;
665
666 t = db_read_token();
667 if (t == tLPAREN) {
668 if (db_expression(&args[0])) {
669 nargs++;
670 while ((t = db_read_token()) == tCOMMA) {
671 if (nargs == MAXARGS) {
672 db_printf("Too many arguments\n");
673 db_flush_lex();
674 return;
675 }
676 if (!db_expression(&args[nargs])) {
677 db_printf("Argument missing\n");
678 db_flush_lex();
679 return;
680 }
681 nargs++;
682 }
683 db_unread_token(t);
684 }
685 if (db_read_token() != tRPAREN) {
686 db_printf("?\n");
687 db_flush_lex();
688 return;
689 }
690 }
691 db_skip_to_eol();
692
693 while (nargs < MAXARGS) {
694 args[nargs++] = 0;
695 }
696
697 retval = (*func)(args[0], args[1], args[2], args[3], args[4],
698 args[5], args[6], args[7], args[8], args[9]);
699 db_printf("%s\n", db_num_to_str(retval));
700 }
701
702 static void
703 db_reboot_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
704 {
705 db_expr_t bootflags;
706
707 /* Flags, default to RB_AUTOBOOT */
708 if (!db_expression(&bootflags))
709 bootflags = (db_expr_t)RB_AUTOBOOT;
710 if (db_read_token() != tEOL) {
711 db_error("?\n");
712 /*NOTREACHED*/
713 }
714 /*
715 * We are leaving DDB, never to return upward.
716 * Clear db_recover so that we can debug faults in functions
717 * called from cpu_reboot.
718 */
719 db_recover = 0;
720 cpu_reboot((int)bootflags, NULL);
721 }
722
723 static void
724 db_sifting_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
725 {
726 int mode, t;
727
728 t = db_read_token();
729 if (t == tSLASH) {
730 t = db_read_token();
731 if (t != tIDENT) {
732 bad_modifier:
733 db_printf("Bad modifier\n");
734 db_flush_lex();
735 return;
736 }
737 if (!strcmp(db_tok_string, "F"))
738 mode = 'F';
739 else
740 goto bad_modifier;
741 t = db_read_token();
742 } else
743 mode = 0;
744
745 if (t == tIDENT)
746 db_sifting(db_tok_string, mode);
747 else {
748 db_printf("Bad argument (non-string)\n");
749 db_flush_lex();
750 }
751 }
752
753 static void
754 db_stack_trace_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
755 {
756 register const char *cp = modif;
757 register char c;
758 void (*pr)(const char *, ...);
759
760 pr = db_printf;
761 while ((c = *cp++) != 0)
762 if (c == 'l')
763 pr = printf;
764
765 if (count == -1)
766 count = 65535;
767
768 db_stack_trace_print(addr, have_addr, count, modif, pr);
769 }
770
771 static void
772 db_sync_cmd(db_expr_t addr, int have_addr, db_expr_t count, const char *modif)
773 {
774
775 /*
776 * We are leaving DDB, never to return upward.
777 * Clear db_recover so that we can debug faults in functions
778 * called from cpu_reboot.
779 */
780 db_recover = 0;
781 cpu_reboot(RB_DUMP, NULL);
782 }
783