Lines Matching +full:diag +full:- +full:version

8  * Copyright (C) 1999-2004 Silicon Graphics, Inc.  All Rights Reserved.
71 int kdb_initial_cpu = -1; /* cpu number that owns kdb */
135 * mechanisms in the kernel, so we use a very limited allocate-only
167 * the user on first-time debugger entry.
198 /* De-compose KDB_ENABLE_ALL if required */ in kdb_check_for_lockdown()
231 * kdbgetenv - This function will return the character string value of
262 * kdballocenv - This function is used to allocate bytes for
283 if ((KDB_ENVBUFSIZE - envbufsize) >= bytes) { in kdballocenv()
291 * kdbgetulenv - This function will return the value of an unsigned
292 * long-valued environment variable.
316 * kdbgetintenv - This function will return the value of an
317 * integer-valued environment variable.
319 * match A character string representing an integer-valued env variable
328 int diag; in kdbgetintenv() local
330 diag = kdbgetulenv(match, &val); in kdbgetintenv()
331 if (!diag) in kdbgetintenv()
333 return diag; in kdbgetintenv()
337 * kdb_setenv() - Alter an existing environment variable or create a new one.
370 for (i = 0; i < __nenv-1; i++) { in kdb_setenv()
381 * kdb_printenv() - Display the current environment variables.
394 * kdbgetularg - This function will convert a numeric string into an
445 * kdb_set - This function implements the 'set' command. Alter an
454 * - if the latter, shift 'em down. in kdb_set()
458 argc--; in kdb_set()
508 * kdbgetaddrarg - This function is responsible for parsing an
509 * address-expression and returning the value of the expression,
516 * consisting of a symbol name, +/-, and a numeric constant value
519 * argc - count of arguments in argv
520 * argv - argument vector
521 * *nextarg - index to next unparsed argument in argv[]
522 * regs - Register state at time of KDB entry
524 * *value - receives the value of the address-expression
525 * *offset - receives the offset specified, if any
526 * *name - receives the symbol name, if any
527 * *nextarg - index to next unparsed argument in argv[]
539 int diag; in kdbgetaddrarg() local
558 * symbol | numeric-address [+/- numeric-offset] in kdbgetaddrarg()
560 * $environment-variable in kdbgetaddrarg()
570 * or address and the '+' or '-' symbols, we in kdbgetaddrarg()
574 cp = strpbrk(symname, "+-"); in kdbgetaddrarg()
581 diag = kdbgetulenv(&symname[1], &addr); in kdbgetaddrarg()
582 if (diag) in kdbgetaddrarg()
583 return diag; in kdbgetaddrarg()
585 diag = kdb_check_regs(); in kdbgetaddrarg()
586 if (diag) in kdbgetaddrarg()
587 return diag; in kdbgetaddrarg()
597 diag = kdbgetularg(argv[*nextarg], &addr); in kdbgetaddrarg()
598 if (diag) in kdbgetaddrarg()
599 return diag; in kdbgetaddrarg()
613 *offset = addr - symtab.sym_start; in kdbgetaddrarg()
620 * check for +/- and offset in kdbgetaddrarg()
625 && (argv[*nextarg][0] != '-')) { in kdbgetaddrarg()
650 diag = kdbgetularg(cp, &off); in kdbgetaddrarg()
651 if (diag) in kdbgetaddrarg()
652 return diag; in kdbgetaddrarg()
655 off = -off; in kdbgetaddrarg()
666 static void kdb_cmderror(int diag) in kdb_cmderror() argument
670 if (diag >= 0) { in kdb_cmderror()
671 kdb_printf("no error detected (diagnostic is %d)\n", diag); in kdb_cmderror()
676 if (kdbmsgs[i].km_diag == diag) { in kdb_cmderror()
677 kdb_printf("diag: %d: %s\n", diag, kdbmsgs[i].km_msg); in kdb_cmderror()
682 kdb_printf("Unknown diag %d\n", -diag); in kdb_cmderror()
686 * kdb_defcmd, kdb_defcmd2 - This function implements the 'defcmd'
722 if (!list_empty(&kdb_macro->statements)) in kdb_defcmd2()
723 kdb_register(&kdb_macro->cmd); in kdb_defcmd2()
734 kms->statement = kdb_strdup(cmdstr, GFP_KDB); in kdb_defcmd2()
735 list_add_tail(&kms->list_node, &kdb_macro->statements); in kdb_defcmd2()
755 if (kp->func == kdb_exec_defcmd) { in kdb_defcmd()
757 kp->name, kp->usage, kp->help); in kdb_defcmd()
759 list_for_each_entry(kms, &kmp->statements, in kdb_defcmd()
761 kdb_printf("%s", kms->statement); in kdb_defcmd()
777 mp = &kdb_macro->cmd; in kdb_defcmd()
778 mp->func = kdb_exec_defcmd; in kdb_defcmd()
779 mp->minlen = 0; in kdb_defcmd()
780 mp->flags = KDB_ENABLE_ALWAYS_SAFE; in kdb_defcmd()
781 mp->name = kdb_strdup(argv[1], GFP_KDB); in kdb_defcmd()
782 if (!mp->name) in kdb_defcmd()
784 mp->usage = kdb_strdup(argv[2], GFP_KDB); in kdb_defcmd()
785 if (!mp->usage) in kdb_defcmd()
787 mp->help = kdb_strdup(argv[3], GFP_KDB); in kdb_defcmd()
788 if (!mp->help) in kdb_defcmd()
790 if (mp->usage[0] == '"') { in kdb_defcmd()
791 strcpy(mp->usage, argv[2]+1); in kdb_defcmd()
792 mp->usage[strlen(mp->usage)-1] = '\0'; in kdb_defcmd()
794 if (mp->help[0] == '"') { in kdb_defcmd()
795 strcpy(mp->help, argv[3]+1); in kdb_defcmd()
796 mp->help[strlen(mp->help)-1] = '\0'; in kdb_defcmd()
799 INIT_LIST_HEAD(&kdb_macro->statements); in kdb_defcmd()
803 kfree(mp->usage); in kdb_defcmd()
805 kfree(mp->name); in kdb_defcmd()
814 * kdb_exec_defcmd - Execute the set of commands associated with this
833 if (strcmp(kp->name, argv[0]) == 0) in kdb_exec_defcmd()
842 list_for_each_entry(kms, &kmp->statements, list_node) { in kdb_exec_defcmd()
847 kdb_printf("[%s]kdb> %s\n", kmp->cmd.name, kms->statement); in kdb_exec_defcmd()
848 ret = kdb_parse(kms->statement); in kdb_exec_defcmd()
895 /* allow it be "x y z" by removing the "'s - there must in parse_grep()
912 if (*(cp+len-1) == '$') { in parse_grep()
914 *(cp+len-1) = '\0'; in parse_grep()
929 * kdb_parse - Parse the command line, search the command table for a
950 * the token is altered in-place to a null-byte to terminate the
1000 if (argc >= MAXARGC - 1) { in kdb_parse()
1048 if (argv[0][0] == '-' && argv[0][1] && in kdb_parse()
1059 if (tp->minlen && (strlen(argv[0]) <= tp->minlen) && in kdb_parse()
1060 (strncmp(argv[0], tp->name, tp->minlen) == 0)) in kdb_parse()
1063 if (strcmp(argv[0], tp->name) == 0) in kdb_parse()
1074 if (strncmp(argv[0], tp->name, strlen(tp->name)) == 0) in kdb_parse()
1082 if (!kdb_check_flags(tp->flags, kdb_cmd_enabled, argc <= 1)) in kdb_parse()
1086 result = (*tp->func)(argc-1, (const char **)argv); in kdb_parse()
1091 if (tp->flags & KDB_REPEAT_WITH_ARGS) in kdb_parse()
1094 argc = tp->flags & KDB_REPEAT_NO_ARGS ? 1 : 0; in kdb_parse()
1137 cmdptr = (cmdptr + KDB_CMD_HISTORY_COUNT - 1) % in handle_ctrl_cmd()
1151 * kdb_reboot - This function implements the 'reboot' command. Reboot
1170 kdb_trap_printk--; in kdb_dumpregs()
1192 if (*(buf + len - 1) == '\n') in drop_newline()
1193 *(buf + len - 1) = '\0'; in drop_newline()
1197 * kdb_local - The main code for kdb. This routine is invoked on a
1205 * error The hardware-defined error code
1219 int diag; in kdb_local() local
1232 kdb_current, kdb_current ? kdb_current->pid : 0); in kdb_local()
1242 * If re-entering kdb after a single step in kdb_local()
1248 kdb_current, kdb_current->pid); in kdb_local()
1352 strlen(cmd_hist[cmd_head])-1) = '\0'; in kdb_local()
1355 *(cmd_cur+strlen(cmd_cur)-1) = '\0'; in kdb_local()
1369 diag = kdb_parse(cmdbuf); in kdb_local()
1370 if (diag == KDB_NOTFOUND) { in kdb_local()
1373 diag = 0; in kdb_local()
1375 if (diag == KDB_CMD_GO in kdb_local()
1376 || diag == KDB_CMD_CPU in kdb_local()
1377 || diag == KDB_CMD_SS in kdb_local()
1378 || diag == KDB_CMD_KGDB) in kdb_local()
1381 if (diag) in kdb_local()
1382 kdb_cmderror(diag); in kdb_local()
1384 KDB_DEBUG_STATE("kdb_local 9", diag); in kdb_local()
1385 return diag; in kdb_local()
1390 * kdb_print_state - Print the state data for the current processor
1404 * kdb_main_loop - After initial setup and assignment of the
1417 * error The hardware-defined error code
1486 * kdb_mdr - This function implements the guts of the 'mdr', memory
1498 while (count--) { in kdb_mdr()
1509 * kdb_md - This function implements the 'md', 'md1', 'md2', 'md4',
1536 for (i = 0; i < num && repeat--; i++) { in kdb_md_line()
1566 cp = wc.c + 8 - bytesperword; in kdb_md_line()
1579 kdb_printf("%*s %s\n", (int)((num-i)*(2*bytesperword + 1)+1), in kdb_md_line()
1611 bytesperword = (int)(argv[0][2] - '0'); in kdb_md()
1653 int diag, nextarg = 1; in kdb_md() local
1654 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, in kdb_md()
1656 if (diag) in kdb_md()
1657 return diag; in kdb_md()
1662 diag = kdbgetularg(argv[nextarg], &val); in kdb_md()
1663 if (!diag) { in kdb_md()
1672 diag = kdbgetularg(argv[nextarg+1], &val); in kdb_md()
1673 if (!diag) in kdb_md()
1739 addr &= ~(bytesperword-1); in kdb_md()
1759 repeat -= n; in kdb_md()
1760 z = (z + num - 1) / num; in kdb_md()
1762 int s = num * (z-2); in kdb_md()
1763 kdb_printf(kdb_machreg_fmt0 "-" kdb_machreg_fmt0 in kdb_md()
1765 addr, addr + bytesperword * s - 1); in kdb_md()
1767 repeat -= s; in kdb_md()
1776 * kdb_mm - This function implements the 'mm' command.
1777 * mm address-expression new-value
1783 int diag; in kdb_mm() local
1797 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL); in kdb_mm()
1798 if (diag) in kdb_mm()
1799 return diag; in kdb_mm()
1803 diag = kdbgetaddrarg(argc, argv, &nextarg, &contents, NULL, NULL); in kdb_mm()
1804 if (diag) in kdb_mm()
1805 return diag; in kdb_mm()
1810 width = argv[0][2] ? (argv[0][2] - '0') : (KDB_WORD_SIZE); in kdb_mm()
1811 diag = kdb_putword(addr, contents, width); in kdb_mm()
1812 if (diag) in kdb_mm()
1813 return diag; in kdb_mm()
1821 * kdb_go - This function implements the 'go' command.
1822 * go [address-expression]
1827 int diag; in kdb_go() local
1839 diag = kdbgetaddrarg(argc, argv, &nextarg, in kdb_go()
1841 if (diag) in kdb_go()
1842 return diag; in kdb_go()
1847 diag = KDB_CMD_GO; in kdb_go()
1863 return diag; in kdb_go()
1867 * kdb_rd - This function implements the 'rd' command.
1934 * kdb_rm - This function implements the 'rm' (register modify) command.
1935 * rm register-name new-contents
1942 int diag; in kdb_rm() local
1959 diag = kdbgetu64arg(argv[2], &reg64); in kdb_rm()
1960 if (diag) in kdb_rm()
1961 return diag; in kdb_rm()
1963 diag = kdb_check_regs(); in kdb_rm()
1964 if (diag) in kdb_rm()
1965 return diag; in kdb_rm()
1967 diag = KDB_BADREG; in kdb_rm()
1970 diag = 0; in kdb_rm()
1974 if (!diag) { in kdb_rm()
1993 return diag; in kdb_rm()
2002 * kdb_sr - This function implements the 'sr' (SYSRQ key) command
2003 * which interfaces to the soi-disant MAGIC SYSRQ functionality.
2004 * sr <magic-sysrq-code>
2016 kdb_trap_printk--; in kdb_sr()
2023 * kdb_ef - This function implements the 'regs' (display exception
2027 * regs address-expression
2033 int diag; in kdb_ef() local
2042 diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL); in kdb_ef()
2043 if (diag) in kdb_ef()
2044 return diag; in kdb_ef()
2050 * kdb_env - This function implements the 'env' command. Display the
2067 * kdb_dmesg - This function implements the 'dmesg' command to display
2073 int diag; in kdb_dmesg() local
2098 diag = kdbgetintenv("LOGGING", &logging); in kdb_dmesg()
2099 if (!diag && logging) { in kdb_dmesg()
2112 else if (adjust - lines >= n) in kdb_dmesg()
2114 "lines printed\n", n, n - adjust); in kdb_dmesg()
2118 skip = n - lines - adjust; in kdb_dmesg()
2140 skip--; in kdb_dmesg()
2143 if (!lines--) in kdb_dmesg()
2148 kdb_printf("%.*s\n", (int)len - 1, buf); in kdb_dmesg()
2169 if (!atomic_add_unless(&kdb_nmi_disabled, -1, 0)) in kdb_param_enable_nmi()
2170 return -EINVAL; in kdb_param_enable_nmi()
2181 * kdb_cpu - This function implements the 'cpu' command.
2193 for (start_cpu = -1, i = 0; i < NR_CPUS; i++) { in kdb_cpu_status()
2200 if (kdb_task_state_char(KDB_TSK(i)) == '-') in kdb_cpu_status()
2201 state = '-'; /* idle task */ in kdb_cpu_status()
2209 if (start_cpu < i-1) in kdb_cpu_status()
2210 kdb_printf("-%d", i-1); in kdb_cpu_status()
2223 if (start_cpu < i-1) in kdb_cpu_status()
2224 kdb_printf("-%d", i-1); in kdb_cpu_status()
2234 int diag; in kdb_cpu() local
2244 diag = kdbgetularg(argv[1], &cpunum); in kdb_cpu()
2245 if (diag) in kdb_cpu()
2246 return diag; in kdb_cpu()
2272 if (kdb_task_state(p, "-")) in kdb_ps_suppressed()
2281 kdb_printf("%d idle process%s (state -)%s\n", in kdb_ps_suppressed()
2303 (void *)p, p->pid, p->parent->pid, in kdb_ps1()
2306 (void *)(&p->thread), in kdb_ps1()
2308 p->comm); in kdb_ps1()
2321 * kdb_ps - This function implements the 'ps' command which shows a
2335 kdb_printf("%-*s Pid Parent [*] cpu State %-*s Command\n", in kdb_ps()
2360 * kdb_pid - This function implements the 'pid' command which switches
2368 int diag; in kdb_pid() local
2377 diag = kdbgetularg(argv[1], &val); in kdb_pid()
2378 if (diag) in kdb_pid()
2390 kdb_current_task->comm, in kdb_pid()
2391 kdb_current_task->pid); in kdb_pid()
2402 * kdb_help - This function implements the 'help' and '?' commands.
2408 kdb_printf("%-15.15s %-20.20s %s\n", "Command", "Usage", "Description"); in kdb_help()
2409 kdb_printf("-----------------------------" in kdb_help()
2410 "-----------------------------\n"); in kdb_help()
2415 if (!kdb_check_flags(kt->flags, kdb_cmd_enabled, true)) in kdb_help()
2417 if (strlen(kt->usage) > 20) in kdb_help()
2419 kdb_printf("%-15.15s %-20s%s%s\n", kt->name, in kdb_help()
2420 kt->usage, space, kt->help); in kdb_help()
2426 * kdb_kill - This function implements the 'kill' commands.
2440 if ((sig >= 0) || !valid_signal(-sig)) { in kdb_kill()
2441 kdb_printf("Invalid signal parameter.<-signal>\n"); in kdb_kill()
2444 sig = -sig; in kdb_kill()
2460 p = p->group_leader; in kdb_kill()
2475 val->uptime = div_u64(uptime, NSEC_PER_SEC); in kdb_sysinfo()
2476 val->loads[0] = avenrun[0]; in kdb_sysinfo()
2477 val->loads[1] = avenrun[1]; in kdb_sysinfo()
2478 val->loads[2] = avenrun[2]; in kdb_sysinfo()
2479 val->procs = nr_threads-1; in kdb_sysinfo()
2486 * kdb_summary - This function implements the 'summary' command.
2498 kdb_printf("version %s\n", init_uts_ns.name.version); in kdb_summary()
2520 #define K(x) ((x) << (PAGE_SHIFT - 10)) in kdb_summary()
2528 * kdb_per_cpu - This function implements the 'per_cpu' command.
2533 int cpu, diag, nextarg = 1; in kdb_per_cpu() local
2539 diag = kdbgetaddrarg(argc, argv, &nextarg, &symaddr, NULL, NULL); in kdb_per_cpu()
2540 if (diag) in kdb_per_cpu()
2541 return diag; in kdb_per_cpu()
2544 diag = kdbgetularg(argv[2], &bytesperword); in kdb_per_cpu()
2545 if (diag) in kdb_per_cpu()
2546 return diag; in kdb_per_cpu()
2554 diag = kdbgetularg(argv[3], &whichcpu); in kdb_per_cpu()
2555 if (diag) in kdb_per_cpu()
2556 return diag; in kdb_per_cpu()
2582 diag = kdb_getword(&val, addr, bytesperword); in kdb_per_cpu()
2583 if (diag) { in kdb_per_cpu()
2584 kdb_printf("%5d " kdb_bfd_vma_fmt0 " - unable to " in kdb_per_cpu()
2585 "read, diag=%d\n", cpu, addr, diag); in kdb_per_cpu()
2617 * kdb_register() - This function is used to register a kernel debugger
2629 if (strcmp(kp->name, cmd->name) == 0) { in kdb_register()
2631 cmd->name, cmd->func, cmd->help); in kdb_register()
2636 list_add_tail(&cmd->list_node, &kdb_cmds_head); in kdb_register()
2642 * kdb_register_table() - This function is used to register a kdb command
2649 while (len--) { in kdb_register_table()
2650 list_add_tail(&kp->list_node, &kdb_cmds_head); in kdb_register_table()
2656 * kdb_unregister() - This function is used to unregister a kernel debugger
2663 list_del(&cmd->list_node); in kdb_unregister()
2841 * internal command re-enters kdb_parse() and is safety
2848 .usage = "<-signal> <pid>",
2893 int i, diag; in kdb_cmd_init() local
2895 diag = kdb_parse(kdb_cmds[i]); in kdb_cmd_init()
2896 if (diag) in kdb_cmd_init()
2897 kdb_printf("kdb command %s failed, kdb diag %d\n", in kdb_cmd_init()
2898 kdb_cmds[i], diag); in kdb_cmd_init()