]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ddb/db_command.c
xnu-1699.24.8.tar.gz
[apple/xnu.git] / osfmk / ddb / db_command.c
1 /*
2 * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * @OSF_COPYRIGHT@
30 */
31 /*
32 * Mach Operating System
33 * Copyright (c) 1991 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56 /*
57 */
58 /*
59 * Author: David B. Golub, Carnegie Mellon University
60 * Date: 7/90
61 */
62
63 /*
64 * Command dispatcher.
65 */
66 #include <norma_vm.h>
67
68 #include <mach/boolean.h>
69 #include <string.h>
70 #include <machine/db_machdep.h>
71
72 #if defined(__alpha)
73 # include <kdebug.h>
74 # if KDEBUG
75 # include <machine/kdebug.h>
76 # endif
77 #endif /* defined(__alpha) */
78
79 #include <ddb/db_lex.h>
80 #include <ddb/db_output.h>
81 #include <ddb/db_break.h>
82 #include <ddb/db_command.h>
83 #include <ddb/db_cond.h>
84 #include <ddb/db_examine.h>
85 #include <ddb/db_expr.h>
86 #include <ddb/db_macro.h>
87 #include <ddb/db_print.h>
88 #include <ddb/db_run.h>
89 #include <ddb/db_task_thread.h>
90 #include <ddb/db_variables.h>
91 #include <ddb/db_watch.h>
92 #include <ddb/db_write_cmd.h>
93
94 #include <machine/setjmp.h>
95 #include <kern/thread.h>
96
97 #include <kern/misc_protos.h>
98 #include <vm/vm_print.h>
99 #include <ipc/ipc_print.h>
100 #include <kern/kern_print.h>
101 #include <machine/db_machdep.h> /* For db_stack_trace_cmd(). */
102 #include <kern/zalloc.h> /* For db_show_one_zone, db_show_all_zones. */
103 #include <kern/lock.h> /* For db_show_all_slocks(). */
104
105 #if NORMA_VM
106 #include <xmm/xmm_obj.h>
107 #endif /* NORMA_VM */
108
109 /*
110 * Exported global variables
111 */
112 boolean_t db_cmd_loop_done;
113 jmp_buf_t *db_recover = 0;
114 db_addr_t db_dot;
115 db_addr_t db_last_addr;
116 db_addr_t db_prev;
117 db_addr_t db_next;
118
119 /*
120 * if 'ed' style: 'dot' is set at start of last item printed,
121 * and '+' points to next line.
122 * Otherwise: 'dot' points to next item, '..' points to last.
123 */
124 boolean_t db_ed_style = TRUE;
125
126 /*
127 * Results of command search.
128 */
129 #define CMD_UNIQUE 0
130 #define CMD_FOUND 1
131 #define CMD_NONE 2
132 #define CMD_AMBIGUOUS 3
133 #define CMD_HELP 4
134
135 /* Prototypes for functions local to this file. XXX -- should be static!
136 */
137
138 void db_command(
139 struct db_command **last_cmdp, /* IN_OUT */
140 db_expr_t *last_countp, /* IN_OUT */
141 char *last_modifp, /* IN_OUT */
142 struct db_command *cmd_table);
143
144 void db_help_cmd(void);
145
146 void db_fncall(void);
147
148 void db_cmd_list(struct db_command *table);
149
150 int db_cmd_search(
151 char * name,
152 struct db_command * table,
153 struct db_command ** cmdp); /* out */
154
155 void db_command_list(
156 struct db_command **last_cmdp, /* IN_OUT */
157 db_expr_t *last_countp, /* IN_OUT */
158 char *last_modifp, /* IN_OUT */
159 struct db_command *cmd_table);
160
161 /*
162 * Search for command prefix.
163 */
164 int
165 db_cmd_search(
166 char * name,
167 struct db_command * table,
168 struct db_command ** cmdp) /* out */
169 {
170 struct db_command *cmd;
171 int result = CMD_NONE;
172
173 for (cmd = table; cmd->name != 0; cmd++) {
174 register char *lp;
175 const char *rp;
176 register int c;
177
178 lp = name;
179 rp = cmd->name;
180 while ((c = *lp) == *rp) {
181 if (c == 0) {
182 /* complete match */
183 *cmdp = cmd;
184 return (CMD_UNIQUE);
185 }
186 lp++;
187 rp++;
188 }
189 if (c == 0) {
190 /* end of name, not end of command -
191 partial match */
192 if (result == CMD_FOUND) {
193 result = CMD_AMBIGUOUS;
194 /* but keep looking for a full match -
195 this lets us match single letters */
196 }
197 else {
198 *cmdp = cmd;
199 result = CMD_FOUND;
200 }
201 }
202 }
203 if (result == CMD_NONE) {
204 /* check for 'help' */
205 if (!strncmp(name, "help", strlen(name)))
206 result = CMD_HELP;
207 }
208 return (result);
209 }
210
211 void
212 db_cmd_list(struct db_command *table)
213 {
214 struct db_command *new;
215 struct db_command *old;
216 struct db_command *cur;
217 unsigned int l;
218 unsigned int len;
219
220 len = 1;
221 for (cur = table; cur->name != 0; cur++)
222 if ((l = strlen(cur->name)) >= len)
223 len = l + 1;
224
225 old = (struct db_command *)0;
226 for (;;) {
227 new = (struct db_command *)0;
228 for (cur = table; cur->name != 0; cur++)
229 if ((new == (struct db_command *)0 ||
230 strncmp(cur->name, new->name, strlen(cur->name)) < 0) &&
231 (old == (struct db_command *)0 ||
232 strncmp(cur->name, old->name, strlen(cur->name)) > 0))
233 new = cur;
234 if (new == (struct db_command *)0)
235 return;
236 db_reserve_output_position(len);
237 db_printf("%-*s", len, new->name);
238 old = new;
239 }
240 }
241
242 void
243 db_command(
244 struct db_command **last_cmdp, /* IN_OUT */
245 db_expr_t *last_countp, /* IN_OUT */
246 char *last_modifp, /* IN_OUT */
247 struct db_command *cmd_table)
248 {
249 struct db_command *cmd;
250 int t;
251 char modif[TOK_STRING_SIZE];
252 char *modifp = &modif[0];
253 db_expr_t addr, count;
254 boolean_t have_addr = FALSE;
255 int result;
256
257 t = db_read_token();
258 if (t == tEOL || t == tSEMI_COLON) {
259 /* empty line repeats last command, at 'next' */
260 cmd = *last_cmdp;
261 count = *last_countp;
262 modifp = last_modifp;
263 addr = (db_expr_t)db_next;
264 have_addr = FALSE;
265 if (t == tSEMI_COLON)
266 db_unread_token(t);
267 }
268 else if (t == tEXCL) {
269 db_fncall();
270 return;
271 }
272 else if (t != tIDENT) {
273 db_printf("?\n");
274 db_flush_lex();
275 return;
276 }
277 else {
278 /*
279 * Search for command
280 */
281 while (cmd_table) {
282 result = db_cmd_search(db_tok_string,
283 cmd_table,
284 &cmd);
285 switch (result) {
286 case CMD_NONE:
287 if (db_exec_macro(db_tok_string) == 0)
288 return;
289 db_printf("No such command \"%s\"\n", db_tok_string);
290 db_flush_lex();
291 return;
292 case CMD_AMBIGUOUS:
293 db_printf("Ambiguous\n");
294 db_flush_lex();
295 return;
296 case CMD_HELP:
297 db_cmd_list(cmd_table);
298 db_flush_lex();
299 return;
300 default:
301 break;
302 }
303 if ((cmd_table = cmd->more) != 0) {
304 t = db_read_token();
305 if (t != tIDENT) {
306 db_cmd_list(cmd_table);
307 db_flush_lex();
308 return;
309 }
310 }
311 }
312
313 if ((cmd->flag & CS_OWN) == 0) {
314 /*
315 * Standard syntax:
316 * command [/modifier] [addr] [,count]
317 */
318 t = db_read_token();
319 if (t == tSLASH) {
320 t = db_read_token();
321 if (t != tIDENT) {
322 db_printf("Bad modifier \"/%s\"\n", db_tok_string);
323 db_flush_lex();
324 return;
325 }
326 strlcpy(modif, db_tok_string, TOK_STRING_SIZE);
327 }
328 else {
329 db_unread_token(t);
330 modif[0] = '\0';
331 }
332
333 if (db_expression(&addr)) {
334 db_dot = (db_addr_t) addr;
335 db_last_addr = db_dot;
336 have_addr = TRUE;
337 }
338 else {
339 addr = (db_expr_t) db_dot;
340 have_addr = FALSE;
341 }
342 t = db_read_token();
343 if (t == tCOMMA) {
344 if (!db_expression(&count)) {
345 db_printf("Count missing after ','\n");
346 db_flush_lex();
347 return;
348 }
349 }
350 else {
351 db_unread_token(t);
352 count = -1;
353 }
354 }
355 }
356 if (cmd != 0) {
357 /*
358 * Execute the command.
359 */
360 (*cmd->fcn)(addr, have_addr, count, modifp);
361
362 if (cmd->flag & CS_SET_DOT) {
363 /*
364 * If command changes dot, set dot to
365 * previous address displayed (if 'ed' style).
366 */
367 if (db_ed_style) {
368 db_dot = db_prev;
369 }
370 else {
371 db_dot = db_next;
372 }
373 }
374 else {
375 /*
376 * If command does not change dot,
377 * set 'next' location to be the same.
378 */
379 db_next = db_dot;
380 }
381 }
382 *last_cmdp = cmd;
383 *last_countp = count;
384 strlcpy(last_modifp, modifp, TOK_STRING_SIZE);
385 }
386
387 void
388 db_command_list(
389 struct db_command **last_cmdp, /* IN_OUT */
390 db_expr_t *last_countp, /* IN_OUT */
391 char *last_modifp, /* IN_OUT */
392 struct db_command *cmd_table)
393 {
394 do {
395 db_command(last_cmdp, last_countp, last_modifp, cmd_table);
396 db_skip_to_eol();
397 } while (db_read_token() == tSEMI_COLON && db_cmd_loop_done == 0);
398 }
399
400
401 extern void db_system_stats(void);
402
403 struct db_command db_show_all_cmds[] = {
404 {
405 .name = "acts",
406 .fcn = db_show_all_acts,
407 },
408 {
409 .name = "spaces",
410 .fcn = db_show_all_spaces,
411 },
412 {
413 .name = "tasks",
414 .fcn = db_show_all_acts,
415 },
416 /* temporary alias for sanity preservation */
417 {
418 .name ="threads",
419 db_show_all_acts,
420 },
421 {
422 .name = "zones",
423 .fcn = db_show_all_zones,
424 },
425 {
426 .name = "vmtask",
427 .fcn = db_show_all_task_vm,
428 },
429 {
430 .name = (const char *)NULL,
431 },
432 };
433
434 /* XXX */
435
436 extern void db_show_thread_log(void);
437 extern void db_show_etap_log(db_expr_t, int, db_expr_t, char *);
438
439 struct db_command db_show_cmds[] = {
440 {
441 .name = "all",
442 .more = db_show_all_cmds
443 },
444 {
445 .name = "registers",
446 .fcn = db_show_regs,
447 },
448 {
449 .name = "variables",
450 .fcn = db_show_variable,
451 .flag = CS_OWN,
452 },
453 {
454 .name = "breaks",
455 .fcn = db_listbreak_cmd,
456 },
457 {
458 .name = "watches",
459 .fcn = db_listwatch_cmd,
460 },
461 {
462 .name = "task",
463 .fcn = db_show_one_task,
464 },
465 {
466 .name = "act",
467 .fcn = db_show_one_act,
468 },
469 {
470 .name = "shuttle",
471 .fcn = db_show_shuttle,
472 },
473 #if 0
474 {
475 .name = "thread",
476 .fcn = db_show_one_thread,
477 },
478 #endif
479 {
480 .name = "vmtask",
481 .fcn = db_show_one_task_vm,
482 },
483 {
484 .name = "macro",
485 .fcn = (db_func)db_show_macro,
486 .flag = CS_OWN,
487 },
488 {
489 .name = "runq",
490 .fcn = (db_func)db_show_runq,
491 },
492 {
493 .name = "map",
494 .fcn = (db_func)vm_map_print,
495 },
496 {
497 .name = "object",
498 .fcn = vm_object_print,
499 },
500 {
501 .name = "page",
502 .fcn = (db_func)vm_page_print,
503 },
504 {
505 .name = "copy",
506 .fcn = (db_func)vm_map_copy_print,
507 },
508 {
509 .name = "port",
510 .fcn = (db_func)ipc_port_print,
511 },
512 {
513 .name = "pset",
514 .fcn = (db_func)ipc_pset_print,
515 },
516 {
517 .name = "kmsg",
518 .fcn = (db_func)ipc_kmsg_print,
519 },
520 {
521 .name = "msg",
522 .fcn = (db_func)ipc_msg_print,
523 },
524 {
525 .name = "ipc_port",
526 .fcn = db_show_port_id,
527 },
528 #if NORMA_VM
529 {
530 .name = "xmm_obj",
531 .fcn = (db_func)xmm_obj_print,
532 },
533 {
534 .name = "xmm_reply",
535 .fcn = (db_func)xmm_reply_print,
536 },
537 #endif /* NORMA_VM */
538 {
539 .name = "space",
540 .fcn = db_show_one_space,
541 },
542 {
543 .name = "system",
544 .fcn = (db_func)db_system_stats,
545 },
546 {
547 .name = "zone",
548 .fcn = db_show_one_zone,
549 },
550 {
551 .name = "lock",
552 .fcn = (db_func)db_show_one_lock,
553 },
554 {
555 .name = "simple_lock",
556 .fcn = (db_func)db_show_one_simple_lock,
557 },
558 {
559 .name = "thread_log",
560 (db_func)db_show_thread_log,
561 },
562 {
563 .name = "shuttle",
564 .fcn = db_show_shuttle,
565 },
566 {
567 .name = (const char *)NULL,
568 },
569 };
570
571 #define db_switch_cpu kdb_on
572
573 struct db_command db_command_table[] = {
574 #if DB_MACHINE_COMMANDS
575 /* this must be the first entry, if it exists */
576 {
577 .name = "machine",
578 },
579 #endif /* DB_MACHINE_COMMANDS */
580 {
581 .name = "print",
582 .fcn = (db_func)db_print_cmd,
583 .flag = CS_OWN,
584 },
585 {
586 .name = "examine",
587 .fcn = db_examine_cmd,
588 .flag = CS_MORE|CS_SET_DOT,
589 },
590 {
591 .name = "x",
592 .fcn = db_examine_cmd,
593 .flag = CS_MORE|CS_SET_DOT,
594 },
595 {
596 .name = "xf",
597 .fcn = db_examine_forward,
598 .flag = CS_SET_DOT,
599 },
600 {
601 .name = "xb",
602 .fcn = db_examine_backward,
603 .flag = CS_SET_DOT,
604 },
605 {
606 .name = "search",
607 .fcn = (db_func)db_search_cmd,
608 .flag = CS_OWN|CS_SET_DOT,
609 },
610 {
611 .name = "set",
612 .fcn = (db_func)db_set_cmd,
613 .flag = CS_OWN,
614 },
615 {
616 .name = "write",
617 .fcn = db_write_cmd,
618 .flag = CS_MORE|CS_SET_DOT,
619 },
620 {
621 .name = "w",
622 .fcn = db_write_cmd,
623 .flag = CS_MORE|CS_SET_DOT,
624 },
625 {
626 .name = "delete",
627 .fcn = (db_func)db_delete_cmd,
628 .flag = CS_OWN,
629 },
630 {
631 .name = "d",
632 .fcn = (db_func)db_delete_cmd,
633 .flag = CS_OWN,
634 },
635 {
636 .name = "break",
637 .fcn = db_breakpoint_cmd,
638 .flag = CS_MORE,
639 },
640 {
641 .name = "dwatch",
642 .fcn = db_deletewatch_cmd,
643 .flag = CS_MORE,
644 },
645 {
646 .name = "watch",
647 .fcn = db_watchpoint_cmd,
648 .flag = CS_MORE,
649 },
650 {
651 .name = "step",
652 .fcn = db_single_step_cmd,
653 },
654 {
655 .name = "s",
656 .fcn = db_single_step_cmd,
657 },
658 {
659 .name = "continue",
660 .fcn = db_continue_cmd,
661 },
662 {
663 .name = "c",
664 .fcn = db_continue_cmd,
665 },
666 {
667 .name = "gdb",
668 .fcn = db_continue_gdb,
669 },
670 {
671 .name = "until",
672 .fcn = db_trace_until_call_cmd,
673 },
674
675 /* As per request of DNoveck, CR1550, leave this disabled */
676 #if 0 /* until CR1440 is fixed, to avoid toe-stubbing */
677 {
678 .name = "next",
679 .fcn = db_trace_until_matching_cmd,
680 },
681 #endif
682 {
683 .name = "match",
684 .fcn = db_trace_until_matching_cmd,
685 },
686 {
687 .name = "trace",
688 .fcn = db_stack_trace_cmd,
689 },
690 {
691 .name = "cond",
692 .fcn = (db_func)db_cond_cmd,
693 .flag = CS_OWN,
694 },
695 {
696 .name = "call",
697 .fcn = (db_func)db_fncall,
698 .flag = CS_OWN,
699 },
700 {
701 .name = "macro",
702 .fcn = (db_func)db_def_macro_cmd,
703 .flag = CS_OWN,
704 },
705 {
706 .name = "dmacro",
707 .fcn = (db_func)db_del_macro_cmd,
708 .flag = CS_OWN,
709 },
710 {
711 .name = "show",
712 .more = db_show_cmds
713 },
714 {
715 .name = "cpu",
716 .fcn = (db_func)db_switch_cpu,
717 },
718 {
719 .name = "dr",
720 .fcn = db_display_real,
721 .flag = CS_MORE|CS_SET_DOT,
722 },
723 {
724 .name = "di",
725 .fcn = db_display_iokit,
726 .flag = CS_MORE,
727 },
728 {
729 .name = "dk",
730 .fcn = db_display_kmod,
731 .flag = CS_MORE,
732 },
733
734 {
735 .name = "reboot",
736 (db_func)db_reboot,
737 },
738 {
739 .name = "ms",
740 .fcn = db_msr,
741 .flag = CS_MORE,
742 },
743 {
744 .name = "cp",
745 .fcn = db_cpuid,
746 .flag = CS_MORE,
747 },
748 {
749 .name = "da",
750 .fcn = db_apic,
751 .flag = CS_MORE,
752 },
753 {
754 .name = (const char *)NULL,
755 },
756 };
757
758 /* this function should be called to install the machine dependent
759 commands. It should be called before the debugger is enabled */
760 void db_machine_commands_install(struct db_command *ptr)
761 {
762 db_command_table[0].more = ptr;
763 return;
764 }
765
766
767 struct db_command *db_last_command = 0;
768 db_expr_t db_last_count = 0;
769 char db_last_modifier[TOK_STRING_SIZE] = { '\0' };
770
771 void
772 db_help_cmd(void)
773 {
774 struct db_command *cmd = db_command_table;
775
776 while (cmd->name != 0) {
777 db_printf("%-12s", cmd->name);
778 db_end_line();
779 cmd++;
780 }
781 }
782
783 int (*ddb_display)(void);
784
785 extern int db_output_line;
786 extern int db_macro_level;
787
788 void
789 db_command_loop(void)
790 {
791 jmp_buf_t db_jmpbuf;
792 jmp_buf_t *prev = db_recover;
793
794 /*
795 * Initialize 'prev' and 'next' to dot.
796 */
797 db_prev = db_dot;
798 db_next = db_dot;
799
800 if (ddb_display)
801 (*ddb_display)();
802
803 db_cmd_loop_done = 0;
804 while (!db_cmd_loop_done) {
805 (void) _setjmp(db_recover = &db_jmpbuf);
806 db_macro_level = 0;
807 if (db_print_position() != 0)
808 db_printf("\n");
809 db_output_line = 0;
810 db_indent = 0;
811 db_reset_more();
812 db_output_prompt();
813
814 (void) db_read_line("!!");
815 db_command_list(&db_last_command, &db_last_count,
816 db_last_modifier, db_command_table);
817 }
818
819 db_recover = prev;
820 }
821
822 boolean_t
823 db_exec_cmd_nest(
824 const char *cmd,
825 int size)
826 {
827 struct db_lex_context lex_context;
828
829 db_cmd_loop_done = 0;
830 if (cmd) {
831 db_save_lex_context(&lex_context);
832 db_switch_input(cmd, size);
833 }
834 db_command_list(&db_last_command, &db_last_count,
835 db_last_modifier, db_command_table);
836 if (cmd)
837 db_restore_lex_context(&lex_context);
838 return(db_cmd_loop_done == 0);
839 }
840
841 void
842 db_error(const char *s)
843 {
844 db_macro_level = 0;
845 if (db_recover) {
846 if (s > (char *)1)
847 db_printf(s);
848 db_flush_lex();
849 _longjmp(db_recover, (s == (char *)1) ? 2 : 1);
850 }
851 else
852 {
853 if (s > (char *)1)
854 db_printf(s);
855 panic("db_error");
856 }
857 }
858
859
860 /*
861 * Call random function:
862 * !expr(arg,arg,arg)
863 */
864 void
865 db_fncall(void)
866 {
867 db_expr_t fn_addr;
868 #define MAXARGS 11
869 uint32_t args[MAXARGS];
870 db_expr_t argwork;
871 int nargs = 0;
872 uint32_t retval;
873 uint32_t (*func)(uint32_t, ...);
874 int t;
875
876 if (!db_expression(&fn_addr)) {
877 db_printf("Bad function \"%s\"\n", db_tok_string);
878 db_flush_lex();
879 return;
880 }
881 func = (uint32_t (*) (uint32_t, ...))(unsigned long)fn_addr;
882
883 t = db_read_token();
884 if (t == tLPAREN) {
885 if (db_expression(&argwork)) {
886 args[nargs] = (uint32_t)argwork;
887 nargs++;
888 while ((t = db_read_token()) == tCOMMA) {
889 if (nargs == MAXARGS) {
890 db_printf("Too many arguments\n");
891 db_flush_lex();
892 return;
893 }
894 if (!db_expression(&argwork)) {
895 db_printf("Argument missing\n");
896 db_flush_lex();
897 return;
898 }
899 args[nargs] = (uint32_t)argwork;
900 nargs++;
901 }
902 db_unread_token(t);
903 }
904 if (db_read_token() != tRPAREN) {
905 db_printf("?\n");
906 db_flush_lex();
907 return;
908 }
909 }
910 while (nargs < MAXARGS) {
911 args[nargs++] = 0;
912 }
913
914 retval = (*func)(args[0], args[1], args[2], args[3], args[4],
915 args[5], args[6], args[7], args[8], args[9] );
916 db_printf(" %#n\n", retval);
917 }
918
919 boolean_t
920 db_option(
921 const char *modif,
922 int option)
923 {
924 const char *p;
925
926 for (p = modif; *p; p++)
927 if (*p == option)
928 return(TRUE);
929 return(FALSE);
930 }