>> >> Also, I suggested the "-o outputfile" option -- after which you could simply >> enter >> "crash vmlinux outputfile" -- because your implementation requires that the >> user must be aware of the base physical address value. >> >> Anyway, this all sounds good, so please post a patch. And can you also make >> one of >> these dumpfiles available to me to download? >> >> Thanks, >> >> Dave > > -- > Crash-utility mailing list > Crash-utility@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/crash-utility Hi Dave, Patch attached implements raw RAM image support. I have tested it with a ARM ramdump. Will test it with a arm64 ramdump tomorrow and will post the results. With this change, a raw RAM image can be passed to crash in the following way. ./crash [path to ram image] [path to vmlinux] --ram_start=[address] -o output_file To start with I have assumed that, dump of a single memory node will be a single file. That means, the 2 RAM images (ddr1.bin and ddr2.bin which I guess belongs to a single node) mentioned in the first email of this mail chain, should be concatenated and passed as a single file. When multiple images are passed with multiple --ram_start, it will be considered as different memory nodes, like below. ./crash [path to ram image of node 1] [path to ram image of node 2] [path to vmlinux] --ram_start=[start address of node 1] --ram_start=[start address of node 2] -o output_file I can share the memory dumps used. Thanks, Vinayak
Attachment:
0001-raw-binary-RAM-image-support.patch
Description: Binary data
/* main.c - core analysis suite * * Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc. * Copyright (C) 2002-2014 David Anderson * Copyright (C) 2002-2014 Red Hat, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include "defs.h" #include "xen_hyper_defs.h" #include <curses.h> #include <getopt.h> #include <sys/prctl.h> static void setup_environment(int, char **); static int is_external_command(void); static int is_builtin_command(void); static int is_input_file(void); static void check_xen_hyper(void); static void show_untrusted_files(void); static void get_osrelease(char *); static void get_log(char *); static struct option long_options[] = { {"memory_module", required_argument, 0, 0}, {"memory_device", required_argument, 0, 0}, {"no_kallsyms", 0, 0, 0}, {"no_modules", 0, 0, 0}, {"help", optional_argument, 0, 'h'}, {"no_data_debug", 0, 0, 0}, {"no_crashrc", 0, 0, 0}, {"no_kmem_cache", 0, 0, 0}, {"kmem_cache_delay", 0, 0, 0}, {"readnow", 0, 0, 0}, {"smp", 0, 0, 0}, {"machdep", required_argument, 0, 0}, {"version", 0, 0, 0}, {"buildinfo", 0, 0, 0}, {"cpus", required_argument, 0, 0}, {"no_ikconfig", 0, 0, 0}, {"hyper", 0, 0, 0}, {"p2m_mfn", required_argument, 0, 0}, {"xen_phys_start", required_argument, 0, 0}, {"zero_excluded", 0, 0, 0}, {"no_panic", 0, 0, 0}, {"more", 0, 0, 0}, {"less", 0, 0, 0}, {"CRASHPAGER", 0, 0, 0}, {"no_scroll", 0, 0, 0}, {"reloc", required_argument, 0, 0}, {"kaslr", required_argument, 0, 0}, {"active", 0, 0, 0}, {"minimal", 0, 0, 0}, {"mod", required_argument, 0, 0}, {"kvmhost", required_argument, 0, 0}, {"kvmio", required_argument, 0, 0}, {"no_elf_notes", 0, 0, 0}, {"osrelease", required_argument, 0, 0}, {"log", required_argument, 0, 0}, {"hex", 0, 0, 0}, {"dec", 0, 0, 0}, {"no_strip", 0, 0, 0}, {"ram_start", required_argument, 0, 0}, {0, 0, 0, 0} }; int main(int argc, char **argv) { int i, c, option_index, nodes = 0, rams = 0; struct ramdump_def *rd = NULL; char *elf_out = NULL; char *tmpname; setup_environment(argc, argv); /* * Get and verify command line options. */ opterr = 0; optind = 0; while((c = getopt_long(argc, argv, "Lkgh::e:i:sSvc:d:tfp:m:xo:", long_options, &option_index)) != -1) { switch (c) { case 0: if (STREQ(long_options[option_index].name, "memory_module")) pc->memory_module = optarg; else if (STREQ(long_options[option_index].name, "memory_device")) pc->memory_device = optarg; else if (STREQ(long_options[option_index].name, "no_kallsyms")) kt->flags |= NO_KALLSYMS; else if (STREQ(long_options[option_index].name, "no_modules")) kt->flags |= NO_MODULE_ACCESS; else if (STREQ(long_options[option_index].name, "no_ikconfig")) kt->flags |= NO_IKCONFIG; else if (STREQ(long_options[option_index].name, "no_data_debug")) pc->flags &= ~DATADEBUG; else if (STREQ(long_options[option_index].name, "no_kmem_cache")) vt->flags |= KMEM_CACHE_UNAVAIL; else if (STREQ(long_options[option_index].name, "kmem_cache_delay")) vt->flags |= KMEM_CACHE_DELAY; else if (STREQ(long_options[option_index].name, "readnow")) pc->flags |= READNOW; else if (STREQ(long_options[option_index].name, "smp")) kt->flags |= SMP; else if (STREQ(long_options[option_index].name, "machdep")) { for (i = 0; i < MAX_MACHDEP_ARGS; i++) { if (machdep->cmdline_args[i]) continue; machdep->cmdline_args[i] = optarg; break; } if (i == MAX_MACHDEP_ARGS) error(INFO, "option ignored: %s\n", optarg); } else if (STREQ(long_options[option_index].name, "version")) { pc->flags |= VERSION_QUERY; display_version(); display_gdb_banner(); clean_exit(0); } else if (STREQ(long_options[option_index].name, "buildinfo")) { dump_build_data(); clean_exit(0); } else if (STREQ(long_options[option_index].name, "cpus")) kt->cpus_override = optarg; else if (STREQ(long_options[option_index].name, "hyper")) pc->flags |= XEN_HYPER; else if (STREQ(long_options[option_index].name, "p2m_mfn")) xen_kdump_p2m_mfn(optarg); else if (STREQ(long_options[option_index].name, "xen_phys_start")) set_xen_phys_start(optarg); else if (STREQ(long_options[option_index].name, "zero_excluded")) *diskdump_flags |= ZERO_EXCLUDED; else if (STREQ(long_options[option_index].name, "no_elf_notes")) { if (machine_type("X86") || machine_type("X86_64")) *diskdump_flags |= NO_ELF_NOTES; else error(INFO, "--no_elf_notes is only applicable to " "the X86 and X86_64 architectures.\n"); } else if (STREQ(long_options[option_index].name, "no_panic")) tt->flags |= PANIC_TASK_NOT_FOUND; else if (STREQ(long_options[option_index].name, "no_strip")) st->flags |= NO_STRIP; else if (STREQ(long_options[option_index].name, "more")) { if ((pc->scroll_command != SCROLL_NONE) && file_exists("/bin/more", NULL)) pc->scroll_command = SCROLL_MORE; } else if (STREQ(long_options[option_index].name, "less")) { if ((pc->scroll_command != SCROLL_NONE) && file_exists("/usr/bin/less", NULL)) pc->scroll_command = SCROLL_LESS; } else if (STREQ(long_options[option_index].name, "CRASHPAGER")) { if ((pc->scroll_command != SCROLL_NONE) && CRASHPAGER_valid()) pc->scroll_command = SCROLL_CRASHPAGER; } else if (STREQ(long_options[option_index].name, "no_scroll")) pc->flags &= ~SCROLL; else if (STREQ(long_options[option_index].name, "no_crashrc")) pc->flags |= NOCRASHRC; else if (STREQ(long_options[option_index].name, "active")) tt->flags |= ACTIVE_ONLY; else if (STREQ(long_options[option_index].name, "mod")) kt->module_tree = optarg; else if (STREQ(long_options[option_index].name, "kaslr")) { if (!machine_type("X86_64")) error(INFO, "--kaslr only valid " "with X86_64 machine type.\n"); else if (STREQ(optarg, "auto")) kt->flags2 |= (RELOC_AUTO|KASLR); else { if (!calculate(optarg, &kt->relocate, NULL, 0)) { error(INFO, "invalid --kaslr argument: %s\n", optarg); program_usage(SHORT_FORM); } kt->relocate *= -1; kt->flags |= RELOC_SET; kt->flags2 |= KASLR; } } else if (STREQ(long_options[option_index].name, "reloc")) { if (!calculate(optarg, &kt->relocate, NULL, 0)) { error(INFO, "invalid --reloc argument: %s\n", optarg); program_usage(SHORT_FORM); } kt->flags |= RELOC_SET; } else if (STREQ(long_options[option_index].name, "minimal")) pc->flags |= MINIMAL_MODE; else if (STREQ(long_options[option_index].name, "kvmhost")) set_kvmhost_type(optarg); else if (STREQ(long_options[option_index].name, "kvmio")) set_kvm_iohole(optarg); else if (STREQ(long_options[option_index].name, "osrelease")) { pc->flags2 |= GET_OSRELEASE; get_osrelease(optarg); } else if (STREQ(long_options[option_index].name, "log")) { pc->flags2 |= GET_LOG; get_log(optarg); } else if (STREQ(long_options[option_index].name, "hex")) { pc->flags2 |= RADIX_OVERRIDE; pc->output_radix = 16; } else if (STREQ(long_options[option_index].name, "dec")) { pc->flags2 |= RADIX_OVERRIDE; pc->output_radix = 10; } else if (STREQ(long_options[option_index].name, "ram_start")) { nodes++; rd = realloc(rd, sizeof(struct ramdump_def) * nodes); if (!rd) error(FATAL, "realloc failure\n"); rd[nodes - 1].start_paddr = strtoul(optarg, NULL, 0); } else { error(INFO, "internal error: option %s unhandled\n", long_options[option_index].name); program_usage(SHORT_FORM); } break; case 'f': st->flags |= FORCE_DEBUGINFO; break; case 'g': pc->flags |= KERNEL_DEBUG_QUERY; break; case 'h': /* note: long_getopt's handling of optional arguments is weak. * To it, an optional argument must be part of the same argument * as the flag itself (eg. --help=commands or -hcommands). * We want to accept "--help commands" or "-h commands". * So we must do that part ourselves. */ if (optarg != NULL) cmd_usage(optarg, COMPLETE_HELP|PIPE_TO_SCROLL|MUST_HELP); else if (argv[optind] != NULL && argv[optind][0] != '-') cmd_usage(argv[optind++], COMPLETE_HELP|PIPE_TO_SCROLL|MUST_HELP); else program_usage(LONG_FORM); clean_exit(0); case 'k': pc->flags |= KERNTYPES; break; case 'e': if (STREQ(optarg, "vi")) pc->editing_mode = "vi"; else if (STREQ(optarg, "emacs")) pc->editing_mode = "emacs"; else fprintf(fp, "invalid edit mode: %s\n", optarg); break; case 't': pc->flags |= GET_TIMESTAMP; break; case 'i': pc->input_file = optarg; pc->flags |= CMDLINE_IFILE; break; case 'v': pc->flags |= VERSION_QUERY; display_version(); display_gdb_banner(); clean_exit(0); case 's': pc->flags |= SILENT; pc->flags &= ~SCROLL; // pc->scroll_command = SCROLL_NONE; (why?) break; case 'L': if (mlockall(MCL_CURRENT|MCL_FUTURE) == -1) perror("mlockall"); break; case 'S': if (is_system_map("/boot/System.map")) { pc->system_map = "/boot/System.map"; pc->flags |= (SYSMAP|SYSMAP_ARG); } break; case 'c': create_console_device(optarg); break; case 'd': pc->debug = atol(optarg); set_lkcd_debug(pc->debug); set_vas_debug(pc->debug); break; case 'p': force_page_size(optarg); break; case 'm': for (i = 0; i < MAX_MACHDEP_ARGS; i++) { if (machdep->cmdline_args[i]) continue; machdep->cmdline_args[i] = optarg; break; } if (i == MAX_MACHDEP_ARGS) error(INFO, "option ignored: %s\n", optarg); break; case 'x': pc->flags |= PRELOAD_EXTENSIONS; break; case 'o': elf_out = optarg; break; default: error(INFO, "invalid option: %s\n", argv[optind-1]); program_usage(SHORT_FORM); } } opterr = 1; display_version(); /* * Take the kernel and dumpfile arguments in either order. */ while (argv[optind]) { if (is_remote_daemon(argv[optind])) { if (pc->flags & DUMPFILE_TYPES) { error(INFO, "too many dumpfile/memory arguments\n"); program_usage(SHORT_FORM); } pc->flags2 |= REMOTE_DAEMON; optind++; continue; } if (STREQ(argv[optind], "/dev/crash")) { pc->memory_device = argv[optind]; optind++; continue; } if (!file_exists(argv[optind], NULL)) { error(INFO, "%s: %s\n", argv[optind], strerror(ENOENT)); program_usage(SHORT_FORM); } else if (!is_readable(argv[optind])) program_usage(SHORT_FORM); if (is_kernel(argv[optind])) { if (pc->namelist || pc->server_namelist) { if (!select_namelist(argv[optind])) { error(INFO, "too many namelist arguments\n"); program_usage(SHORT_FORM); } } else pc->namelist = argv[optind]; } else if (is_compressed_kernel(argv[optind], &tmpname)) { if (pc->namelist) { if (!select_namelist(tmpname)) { error(INFO, "too many namelist arguments\n"); program_usage(SHORT_FORM); } if (pc->namelist_debug == tmpname) { pc->namelist_debug_orig = argv[optind]; } else { pc->namelist_debug_orig = pc->namelist_orig; pc->namelist_orig = argv[optind]; } } else { pc->namelist = tmpname; pc->namelist_orig = argv[optind]; } pc->cleanup = NULL; } else if (!(pc->flags & KERNEL_DEBUG_QUERY)) { if (is_flattened_format(argv[optind])) pc->flags2 |= FLAT; if (rd) { if (rams < nodes) rd[rams++].path = argv[optind]; else error(INFO, "too many dumpfile arguments\n"); } else if (STREQ(argv[optind], "/dev/mem")) { if (pc->flags & MEMORY_SOURCES) { error(INFO, "too many dumpfile arguments\n"); program_usage(SHORT_FORM); } pc->flags |= DEVMEM; pc->dumpfile = NULL; pc->readmem = read_dev_mem; pc->writemem = write_dev_mem; pc->live_memsrc = argv[optind]; } else if (is_proc_kcore(argv[optind], KCORE_LOCAL)) { if (pc->flags & MEMORY_SOURCES) { error(INFO, "too many dumpfile arguments\n"); program_usage(SHORT_FORM); } pc->flags |= PROC_KCORE; pc->dumpfile = NULL; pc->readmem = read_proc_kcore; pc->writemem = write_proc_kcore; pc->live_memsrc = argv[optind]; } else if (is_netdump(argv[optind], NETDUMP_LOCAL)) { if (pc->flags & MEMORY_SOURCES) { error(INFO, "too many dumpfile arguments\n"); program_usage(SHORT_FORM); } pc->flags |= NETDUMP; pc->dumpfile = argv[optind]; if (is_sadump_xen()) { pc->readmem = read_kdump; pc->writemem = write_kdump; } else { pc->readmem = read_netdump; pc->writemem = write_netdump; } } else if (is_kdump(argv[optind], KDUMP_LOCAL)) { if (pc->flags & MEMORY_SOURCES) { error(INFO, "too many dumpfile arguments\n"); program_usage(SHORT_FORM); } pc->flags |= KDUMP; pc->dumpfile = argv[optind]; pc->readmem = read_kdump; pc->writemem = write_kdump; } else if (is_kvmdump(argv[optind])) { if (pc->flags & MEMORY_SOURCES) { error(INFO, "too many dumpfile arguments\n"); program_usage(SHORT_FORM); } pc->flags |= KVMDUMP; pc->dumpfile = argv[optind]; pc->readmem = read_kvmdump; pc->writemem = write_kvmdump; } else if (is_kvmdump_mapfile(argv[optind])) { if (pc->kvmdump_mapfile) { error(INFO, "too many KVM map file arguments\n"); program_usage(SHORT_FORM); } pc->kvmdump_mapfile = argv[optind]; } else if (is_xendump(argv[optind])) { if (pc->flags & MEMORY_SOURCES) { error(INFO, "too many dumpfile arguments\n"); program_usage(SHORT_FORM); } pc->flags |= XENDUMP; pc->dumpfile = argv[optind]; pc->readmem = read_xendump; pc->writemem = write_xendump; } else if (is_system_map(argv[optind])) { pc->system_map = argv[optind]; pc->flags |= (SYSMAP|SYSMAP_ARG); } else if (is_diskdump(argv[optind])) { if ((pc->flags & MEMORY_SOURCES) && (!dumpfile_is_split())) { error(INFO, "too many dumpfile arguments\n"); program_usage(SHORT_FORM); } pc->flags |= DISKDUMP; pc->dumpfile = argv[optind]; pc->readmem = read_diskdump; pc->writemem = write_diskdump; } else if (is_lkcd_compressed_dump(argv[optind])) { if (pc->flags & MEMORY_SOURCES) { error(INFO, "too many dumpfile arguments\n"); program_usage(SHORT_FORM); } pc->flags |= LKCD; pc->dumpfile = argv[optind]; pc->readmem = read_lkcd_dumpfile; pc->writemem = write_lkcd_dumpfile; } else if (is_mclx_compressed_dump(argv[optind])) { if (pc->flags & MEMORY_SOURCES) { error(INFO, "too many dumpfile arguments\n"); program_usage(SHORT_FORM); } pc->flags |= MCLXCD; pc->dumpfile = argv[optind]; pc->readmem = read_mclx_dumpfile; pc->writemem = write_mclx_dumpfile; } else if (is_s390_dump(argv[optind])) { if (pc->flags & MEMORY_SOURCES) { error(INFO, "too many dumpfile arguments\n"); program_usage(SHORT_FORM); } pc->flags |= S390D; pc->dumpfile = argv[optind]; pc->readmem = read_s390_dumpfile; pc->writemem = write_s390_dumpfile; } else if (is_sadump(argv[optind])) { if ((pc->flags & MEMORY_SOURCES) && !sadump_is_diskset()) { error(INFO, "too many dumpfile arguments\n"); program_usage(SHORT_FORM); } pc->flags |= SADUMP; pc->dumpfile = argv[optind]; pc->readmem = read_sadump; pc->writemem = write_sadump; } else { error(INFO, "%s: not a supported file format\n", argv[optind]); program_usage(SHORT_FORM); } } optind++; } if (rd) { if (rams != nodes) error(FATAL, "Number of nodes not matching with ram images\n"); pc->dumpfile = ramdump_to_elf(rd, nodes, elf_out); if (is_kdump(pc->dumpfile, KDUMP_LOCAL)) { pc->flags |= KDUMP; pc->readmem = read_kdump; pc->writemem = write_kdump; } } check_xen_hyper(); if (setjmp(pc->main_loop_env)) clean_exit(1); /* * Initialize various subsystems. */ fd_init(); buf_init(); cmdline_init(); mem_init(); hq_init(); machdep_init(PRE_SYMTAB); symtab_init(); paravirt_init(); machdep_init(PRE_GDB); datatype_init(); /* * gdb_main_loop() modifies "command_loop_hook" to point to the * main_loop() function below, and then calls gdb's main() function. * After gdb initializes itself, it calls back to main_loop(). */ gdb_main_loop(argc, argv); clean_exit(0); exit(0); } /* * This routine is called from above, but also will be re-entered * as part of gdb's SIGINT handling. Since GDB_INIT and RUNTIME * will be set on re-entrancy, the initialization routines won't * be called. This can be avoided by always making gdb ignore SIGINT. */ void main_loop(void) { if (pc->flags2 & ERASEINFO_DATA) error(WARNING, "\n%s:\n " "Kernel data has been erased from this dumpfile. This may " "cause\n the crash session to fail entirely, may " "cause commands to fail,\n or may result in " "unpredictable runtime behavior.\n", pc->dumpfile); if (!(pc->flags & GDB_INIT)) { gdb_session_init(); show_untrusted_files(); kdump_backup_region_init(); if (XEN_HYPER_MODE()) { #ifdef XEN_HYPERVISOR_ARCH machdep_init(POST_GDB); xen_hyper_init(); machdep_init(POST_INIT); #else error(FATAL, XEN_HYPERVISOR_NOT_SUPPORTED); #endif } else if (!(pc->flags & MINIMAL_MODE)) { read_in_kernel_config(IKCFG_INIT); kernel_init(); machdep_init(POST_GDB); vm_init(); machdep_init(POST_VM); module_init(); help_init(); task_init(); vfs_init(); net_init(); dev_init(); machdep_init(POST_INIT); } } else SIGACTION(SIGINT, restart, &pc->sigaction, NULL); /* * Display system statistics and current context. */ if (!(pc->flags & SILENT) && !(pc->flags & RUNTIME)) { if (XEN_HYPER_MODE()) { #ifdef XEN_HYPERVISOR_ARCH xen_hyper_display_sys_stats(); xen_hyper_show_vcpu_context(XEN_HYPER_VCPU_LAST_CONTEXT()); fprintf(fp, "\n"); #else error(FATAL, XEN_HYPERVISOR_NOT_SUPPORTED); #endif } else if (!(pc->flags & MINIMAL_MODE)) { display_sys_stats(); show_context(CURRENT_CONTEXT()); fprintf(fp, "\n"); } } if (pc->flags & MINIMAL_MODE) error(NOTE, "minimal mode commands: log, dis, rd, sym, eval, set, extend and exit\n\n"); pc->flags |= RUNTIME; if (pc->flags & PRELOAD_EXTENSIONS) preload_extensions(); /* * Return here if a non-recoverable error occurs * during command execution. */ if (setjmp(pc->main_loop_env)) { ; } /* * process_command_line() reads, parses and stores input command lines * in the global args[] array. exec_command() figures out what to * do with the parsed line. */ while (TRUE) { process_command_line(); exec_command(); } } /* * Most of the time args[0] simply contains the name string of a command * found in the global command_table[]. Special consideration is done for * dealing with input files, "known" external commands, and built-in commands. * If none of the above apply, the args[0] string is checked against the * known list of structure, union and typedef names, and if found, passed * on to cmd_struct(), cmd_union() or cmd_whatis(). */ void exec_command(void) { struct command_table_entry *ct; struct args_input_file args_ifile; if (args[0] && (args[0][0] == '\\') && args[0][1]) { shift_string_left(args[0], 1); shift_string_left(pc->orig_line, 1); pc->curcmd_flags |= NO_MODIFY; } reattempt: if (!args[0]) return; optind = argerrs = 0; if ((ct = get_command_table_entry(args[0]))) { if (ct->flags & REFRESH_TASK_TABLE) { if (XEN_HYPER_MODE()) { #ifdef XEN_HYPERVISOR_ARCH xen_hyper_refresh_domain_context_space(); xen_hyper_refresh_vcpu_context_space(); #else error(FATAL, XEN_HYPERVISOR_NOT_SUPPORTED); #endif } else if (!(pc->flags & MINIMAL_MODE)) { tt->refresh_task_table(); sort_context_array(); } } if (!STREQ(pc->curcmd, pc->program_name)) pc->lastcmd = pc->curcmd; pc->curcmd = ct->name; pc->cmdgencur++; if (is_args_input_file(ct, &args_ifile)) exec_args_input_file(ct, &args_ifile); else (*ct->func)(); pc->lastcmd = pc->curcmd; pc->curcmd = pc->program_name; return; } if (is_input_file()) return; if (is_external_command()) return; if (is_builtin_command()) return; if (is_datatype_command()) goto reattempt; if (STRNEQ(args[0], "#") || STRNEQ(args[0], "//")) return; if (!(pc->flags & MINIMAL_MODE) && is_gdb_command(TRUE, FAULT_ON_ERROR)) goto reattempt; if (REMOTE() && remote_execute()) return; pc->curcmd = pc->program_name; if (pc->flags & MINIMAL_MODE) error(INFO, "%s: command not available in minimal mode\n" "NOTE: minimal mode commands: log, dis, rd, sym, eval, set, extend and exit\n", args[0]); else error(INFO, "command not found: %s\n", args[0]); if (pc->curcmd_flags & REPEAT) pc->curcmd_flags &= ~REPEAT; } /* * Find the command_table structure associated with a command name. */ struct command_table_entry * get_command_table_entry(char *name) { int i; struct command_table_entry *cp; struct extension_table *ext; if (pc->flags2 & GDB_CMD_MODE) { if (STREQ(name, "crash")) { if (argcnt == 1) error(FATAL, "a crash command must follow " "the \"crash\" directive\n"); for (i = 1; i <= argcnt; i++) args[i-1] = args[i]; argcnt--; name = args[0]; } else name = "gdb"; } for (cp = pc->cmd_table; cp->name; cp++) { if (STREQ(cp->name, name)) { if (!(pc->flags & MINIMAL_MODE) || (cp->flags & MINIMAL)) return cp; else return NULL; } } for (ext = extension_table; ext; ext = ext->next) { for (cp = ext->command_table; cp->name; cp++) { if (STREQ(cp->name, name)) { if (!(pc->flags & MINIMAL_MODE) || (cp->flags & MINIMAL)) return cp; else return NULL; } } } return NULL; } static int is_input_file(void) { if (STREQ(args[0], "<")) { exec_input_file(); return TRUE; } return FALSE; } static int is_builtin_command(void) { int i; struct remote_file remote_file, *rfp; /* * cmd_test() is used strictly for debugging -- but not advertised * in the help menu. */ if (STREQ(args[0], "test")) { pc->curcmd = "test"; cmd_test(); return TRUE; } if (STREQ(args[0], "save")) { pc->curcmd = "save"; rfp = &remote_file; BZERO(rfp, sizeof(struct remote_file)); rfp->flags |= REMOTE_VERBOSE; for (i = 1; i < argcnt; i++) { rfp->filename = args[i]; get_remote_file(rfp); } return TRUE; } return FALSE; } /* * Pure laziness -- to avoid having to type the exclamation point at the * beginning of the line. */ static int is_external_command(void) { int i; char *cmd; char command[BUFSIZE]; cmd = args[0]; if (STREQ(cmd, "vi") || STREQ(cmd, "pwd") || STREQ(cmd, "grep") || STREQ(cmd, "cat") || STREQ(cmd, "more") || STREQ(cmd, "less") || STREQ(cmd, "echo") || STREQ(cmd, "ls")) { sprintf(command, "%s", cmd); for (i = 1; i < argcnt; i++) { strcat(command, " "); if (strstr(args[i], " ")) { strcat(command, "\""); strcat(command, args[i]); strcat(command, "\""); } else strcat(command, args[i]); } if (system(command) == -1) perror(command); return TRUE; } return FALSE; } void cmd_quit(void) { if (REMOTE()) remote_exit(); clean_exit(0); } void cmd_mach(void) { machdep->cmd_mach(); } static void setup_environment(int argc, char **argv) { int i; char *p1; char buf[BUFSIZE]; char homerc[BUFSIZE]; char localrc[BUFSIZE]; FILE *afp; char *program; program = argv[0]; /* * Program output typically goes via "fprintf(fp, ...)", but the * contents of fp are modified on the fly to handle redirection * to pipes or output files. */ fp = stdout; /* * Start populating the program_context structure. It's used so * frequently that "pc" has been declared globally to point to the * "program_context" structure. */ pc->program_name = (char *)basename(program); pc->program_path = program; pc->program_version = build_version; pc->program_pid = (ulong)getpid(); pc->curcmd = pc->program_name; pc->flags = (HASH|SCROLL); pc->flags |= DATADEBUG; /* default until unnecessary */ pc->confd = -2; pc->machine_type = MACHINE_TYPE; pc->readmem = read_dev_mem; /* defaults until argv[] is parsed */ pc->writemem = write_dev_mem; pc->memory_module = NULL; pc->memory_device = MEMORY_DRIVER_DEVICE; machdep->bits = sizeof(long) * 8; machdep->verify_paddr = generic_verify_paddr; machdep->get_kvaddr_ranges = generic_get_kvaddr_ranges; pc->redhat_debug_loc = DEFAULT_REDHAT_DEBUG_LOCATION; pc->cmdgencur = 0; pc->cmd_table = linux_command_table; kt->BUG_bytes = -1; kt->flags |= PRE_KERNEL_INIT; /* * Set up to perform a clean_exit() upon parent death. */ SIGACTION(SIGUSR2, restart, &pc->sigaction, NULL); prctl(PR_SET_PDEATHSIG, SIGUSR2); /* * Get gdb version before initializing it since this might be one * of the short-hand commands that need it without running gdb. */ get_gdb_version(); /* * Set up the default scrolling behavior for terminal output. */ if (isatty(fileno(stdout))) { if (CRASHPAGER_valid()) { pc->flags |= SCROLL; pc->scroll_command = SCROLL_CRASHPAGER; } else if (file_exists("/usr/bin/less", NULL)) { pc->flags |= SCROLL; pc->scroll_command = SCROLL_LESS; } else if (file_exists("/bin/more", NULL)) { pc->flags |= SCROLL; pc->scroll_command = SCROLL_MORE; } else { pc->scroll_command = SCROLL_NONE; pc->flags &= ~SCROLL; } } /* * Setup the readline command line editing mode based upon the * following order: * * (1) EDITOR environment variable * (2) overridden by any .crashrc entry: "set vi" or "set emacs" * (3) RL_VI_MODE if not set anywhere else */ pc->flags |= READLINE; pc->editing_mode = "no_mode"; if ((p1 = getenv("EDITOR"))) { if (strstr(p1, "vi")) pc->editing_mode = "vi"; if (strstr(p1, "emacs")) pc->editing_mode = "emacs"; } /* * Resolve $HOME .rc file first, then the one in the local directory. * Note that only "set" and "alias" commands are done at this time. */ for (i = 1; i < argc; i++) if (STREQ(argv[i], "--no_crashrc")) pc->flags |= NOCRASHRC; alias_init(NULL); if ((p1 = getenv("HOME"))) { if ((pc->home = (char *)malloc(strlen(p1)+1)) == NULL) { error(INFO, "home directory malloc: %s\n", strerror(errno)); pc->home = "(unknown)"; } else strcpy(pc->home, p1); sprintf(homerc, "%s/.%src", pc->home, pc->program_name); if (!(pc->flags & NOCRASHRC) && file_exists(homerc, NULL)) { if ((afp = fopen(homerc, "r")) == NULL) error(INFO, "cannot open %s: %s\n", homerc, strerror(errno)); else if (untrusted_file(afp, homerc)) fclose(afp); else { while (fgets(buf, BUFSIZE, afp)) resolve_rc_cmd(buf, ALIAS_RCHOME); fclose(afp); } } } sprintf(localrc, ".%src", pc->program_name); if (!same_file(homerc, localrc) && !(pc->flags & NOCRASHRC) && file_exists(localrc, NULL)) { if ((afp = fopen(localrc, "r")) == NULL) error(INFO, "cannot open %s: %s\n", localrc, strerror(errno)); else if (untrusted_file(afp, localrc)) fclose(afp); else { while (fgets(buf, BUFSIZE, afp)) resolve_rc_cmd(buf, ALIAS_RCLOCAL); fclose(afp); } } if (STREQ(pc->editing_mode, "no_mode")) pc->editing_mode = "vi"; machdep_init(SETUP_ENV); } /* * "help -p" output */ void dump_program_context(void) { int i; int others = 0; char *p1; char buf[BUFSIZE]; char buf2[BUFSIZE]; fprintf(fp, " program_name: %s\n", pc->program_name); fprintf(fp, " program_path: %s\n", pc->program_path); fprintf(fp, " program_version: %s\n", pc->program_version); fprintf(fp, " gdb_version: %s\n", pc->gdb_version); fprintf(fp, " program_pid: %ld\n", pc->program_pid); fprintf(fp, " prompt: \"%s\"\n", pc->prompt); fprintf(fp, " flags: %llx ", pc->flags); if (pc->flags) sprintf(buf, "("); if (pc->flags & RUNTIME) sprintf(&buf[strlen(buf)], "%sRUNTIME", others++ ? "|" : ""); if (pc->flags & LIVE_SYSTEM) sprintf(&buf[strlen(buf)], "%sLIVE_SYSTEM", others++ ? "|" : ""); if (pc->flags & TTY) sprintf(&buf[strlen(buf)], "%sTTY", others++ ? "|" : ""); if (pc->flags & IN_FOREACH) sprintf(&buf[strlen(buf)], "%sIN_FOREACH", others++ ? "|" : ""); if (pc->flags & MFD_RDWR) sprintf(&buf[strlen(buf)], "%sMFD_RDWR", others++ ? "|" : ""); if (pc->flags & KVMDUMP) sprintf(&buf[strlen(buf)], "%sKVMDUMP", others++ ? "|" : ""); if (pc->flags & SILENT) sprintf(&buf[strlen(buf)], "%sSILENT", others++ ? "|" : ""); if (pc->flags & HASH) sprintf(&buf[strlen(buf)], "%sHASH", others++ ? "|" : ""); if (pc->flags & SCROLL) sprintf(&buf[strlen(buf)], "%sSCROLL", others++ ? "|" : ""); if (pc->flags & NO_CONSOLE) sprintf(&buf[strlen(buf)], "%sNO_CONSOLE", others++ ? "|" : ""); if (pc->flags & MCLXCD) sprintf(&buf[strlen(buf)], "%sMCLXCD", others++ ? "|" : ""); if (pc->flags & RUNTIME_IFILE) sprintf(&buf[strlen(buf)], "%sRUNTIME_IFILE", others++ ? "|" : ""); if (pc->flags & CMDLINE_IFILE) sprintf(&buf[strlen(buf)], "%sCMDLINE_IFILE", others++ ? "|" : ""); if (pc->flags & DROP_CORE) sprintf(&buf[strlen(buf)], "%sDROP_CORE", others++ ? "|" : ""); if (pc->flags & LKCD) sprintf(&buf[strlen(buf)], "%sLKCD", others++ ? "|" : ""); if (pc->flags & GDB_INIT) sprintf(&buf[strlen(buf)], "%sGDB_INIT", others++ ? "|" : ""); if (pc->flags & IN_GDB) sprintf(&buf[strlen(buf)], "%sIN_GDB", others++ ? "|" : ""); if (pc->flags & RCHOME_IFILE) sprintf(&buf[strlen(buf)], "%sRCHOME_IFILE", others++ ? "|" : ""); if (pc->flags & RCLOCAL_IFILE) sprintf(&buf[strlen(buf)], "%sRCLOCAL_IFILE", others++ ? "|" : ""); if (pc->flags & READLINE) sprintf(&buf[strlen(buf)], "%sREADLINE", others++ ? "|" : ""); if (pc->flags & _SIGINT_) sprintf(&buf[strlen(buf)], "%s_SIGINT_", others++ ? "|" : ""); if (pc->flags & IN_RESTART) sprintf(&buf[strlen(buf)], "%sIN_RESTART", others++ ? "|" : ""); if (pc->flags & KERNEL_DEBUG_QUERY) sprintf(&buf[strlen(buf)], "%sKERNEL_DEBUG_QUERY", others++ ? "|" : ""); if (pc->flags & DEVMEM) sprintf(&buf[strlen(buf)], "%sDEVMEM", others++ ? "|" : ""); if (pc->flags & MEMMOD) sprintf(&buf[strlen(buf)], "%sMEMMOD", others++ ? "|" : ""); if (pc->flags & MODPRELOAD) sprintf(&buf[strlen(buf)], "%sMODPRELOAD", others++ ? "|" : ""); if (pc->flags & REM_LIVE_SYSTEM) sprintf(&buf[strlen(buf)], "%sREM_LIVE_SYSTEM", others++ ? "|" : ""); if (pc->flags & MEMSRC_LOCAL) sprintf(&buf[strlen(buf)], "%sMEMSRC_LOCAL", others++ ? "|" : ""); if (pc->flags & NAMELIST_LOCAL) sprintf(&buf[strlen(buf)], "%sNAMELIST_LOCAL", others++ ? "|" : ""); if (pc->flags & DUMPFILE_SAVED) sprintf(&buf[strlen(buf)], "%sDUMPFILE_SAVED", others++ ? "|" : ""); if (pc->flags & NAMELIST_SAVED) sprintf(&buf[strlen(buf)], "%sNAMELIST_SAVED", others++ ? "|" : ""); if (pc->flags & UNLINK_NAMELIST) sprintf(&buf[strlen(buf)], "%sUNLINK_NAMELIST", others++ ? "|" : ""); if (pc->flags & NAMELIST_UNLINKED) sprintf(&buf[strlen(buf)], "%sNAMELIST_UNLINKED", others++ ? "|" : ""); if (pc->flags & REM_MCLXCD) sprintf(&buf[strlen(buf)], "%sREM_MCLXCD", others++ ? "|" : ""); if (pc->flags & REM_LKCD) sprintf(&buf[strlen(buf)], "%sREM_LKCD", others++ ? "|" : ""); if (pc->flags & NAMELIST_NO_GZIP) sprintf(&buf[strlen(buf)], "%sNAMELIST_NO_GZIP", others++ ? "|" : ""); if (pc->flags & UNLINK_MODULES) sprintf(&buf[strlen(buf)], "%sUNLINK_MODULES", others++ ? "|" : ""); if (pc->flags & S390D) sprintf(&buf[strlen(buf)], "%sS390D", others++ ? "|" : ""); if (pc->flags & REM_S390D) sprintf(&buf[strlen(buf)], "%sREM_S390D", others++ ? "|" : ""); if (pc->flags & NETDUMP) sprintf(&buf[strlen(buf)], "%sNETDUMP", others++ ? "|" : ""); if (pc->flags & XENDUMP) sprintf(&buf[strlen(buf)], "%sXENDUMP", others++ ? "|" : ""); if (pc->flags & KDUMP) sprintf(&buf[strlen(buf)], "%sKDUMP", others++ ? "|" : ""); if (pc->flags & SADUMP) sprintf(&buf[strlen(buf)], "%sSADUMP", others++ ? "|" : ""); if (pc->flags & SYSRQ) sprintf(&buf[strlen(buf)], "%sSYSRQ", others++ ? "|" : ""); if (pc->flags & REM_NETDUMP) sprintf(&buf[strlen(buf)], "%sREM_NETDUMP", others++ ? "|" : ""); if (pc->flags & DISKDUMP) sprintf(&buf[strlen(buf)], "%sDISKDUMP", others++ ? "|" : ""); if (pc->flags & SYSMAP) sprintf(&buf[strlen(buf)], "%sSYSMAP", others++ ? "|" : ""); if (pc->flags & SYSMAP_ARG) sprintf(&buf[strlen(buf)], "%sSYSMAP_ARG", others++ ? "|" : ""); if (pc->flags & DATADEBUG) sprintf(&buf[strlen(buf)], "%sDATADEBUG", others++ ? "|" : ""); if (pc->flags & FINDKERNEL) sprintf(&buf[strlen(buf)], "%sFINDKERNEL", others++ ? "|" : ""); if (pc->flags & VERSION_QUERY) sprintf(&buf[strlen(buf)], "%sVERSION_QUERY", others++ ? "|" : ""); if (pc->flags & READNOW) sprintf(&buf[strlen(buf)], "%sREADNOW", others++ ? "|" : ""); if (pc->flags & NOCRASHRC) sprintf(&buf[strlen(buf)], "%sNOCRASHRC", others++ ? "|" : ""); if (pc->flags & INIT_IFILE) sprintf(&buf[strlen(buf)], "%sINIT_IFILE", others++ ? "|" : ""); if (pc->flags & XEN_HYPER) sprintf(&buf[strlen(buf)], "%sXEN_HYPER", others++ ? "|" : ""); if (pc->flags & XEN_CORE) sprintf(&buf[strlen(buf)], "%sXEN_CORE", others++ ? "|" : ""); if (pc->flags & PLEASE_WAIT) sprintf(&buf[strlen(buf)], "%sPLEASE_WAIT", others++ ? "|" : ""); if (pc->flags & IFILE_ERROR) sprintf(&buf[strlen(buf)], "%sIFILE_ERROR", others++ ? "|" : ""); if (pc->flags & MINIMAL_MODE) sprintf(&buf[strlen(buf)], "%sMINIMAL_MODE", others++ ? "|" : ""); if (pc->flags & CRASHBUILTIN) sprintf(&buf[strlen(buf)], "%sCRASHBUILTIN", others++ ? "|" : ""); if (pc->flags & PRELOAD_EXTENSIONS) sprintf(&buf[strlen(buf)], "%sPRELOAD_EXTENSIONS", others++ ? "|" : ""); if (pc->flags & PROC_KCORE) sprintf(&buf[strlen(buf)], "%sPROC_KCORE", others++ ? "|" : ""); if (pc->flags) strcat(buf, ")"); if (strlen(buf)) { if (strlen(buf) > 46) { sprintf(buf2, "\n%s\n", mkstring(buf, 80, CENTER|LJUST, NULL)); if (strlen(buf2) <= 82) fprintf(fp, "%s", buf2); else { for (i = strlen(buf2)-1; i; i--) { if ((buf2[i] == '|') && (i < 80)) break; } strcpy(buf, buf2); buf[i+1] = NULLCHAR; fprintf(fp, "%s\n %s", buf, &buf2[i+1]); } } else fprintf(fp, "%s\n", buf); } others = 0; fprintf(fp, " flags2: %llx (", pc->flags2); if (pc->flags2 & FLAT) fprintf(fp, "%sFLAT", others++ ? "|" : ""); if (pc->flags2 & ELF_NOTES) fprintf(fp, "%sELF_NOTES", others++ ? "|" : ""); if (pc->flags2 & GET_OSRELEASE) fprintf(fp, "%sGET_OSRELEASE", others++ ? "|" : ""); if (pc->flags2 & REMOTE_DAEMON) fprintf(fp, "%sREMOTE_DAEMON", others++ ? "|" : ""); if (pc->flags2 & LIVE_DUMP) fprintf(fp, "%sLIVE_DUMP", others++ ? "|" : ""); if (pc->flags2 & RADIX_OVERRIDE) fprintf(fp, "%sRADIX_OVERRIDE", others++ ? "|" : ""); if (pc->flags2 & QEMU_MEM_DUMP) fprintf(fp, "%sQEMU_MEM_DUMP", others++ ? "|" : ""); if (pc->flags2 & GET_LOG) fprintf(fp, "%sGET_LOG", others++ ? "|" : ""); if (pc->flags2 & VMCOREINFO) fprintf(fp, "%sVMCOREINFO", others++ ? "|" : ""); if (pc->flags2 & ALLOW_FP) fprintf(fp, "%sALLOW_FP", others++ ? "|" : ""); fprintf(fp, ")\n"); fprintf(fp, " namelist: %s\n", pc->namelist); fprintf(fp, " dumpfile: %s\n", pc->dumpfile); fprintf(fp, " live_memsrc: %s\n", pc->live_memsrc); fprintf(fp, " system_map: %s\n", pc->system_map); fprintf(fp, " namelist_debug: %s\n", pc->namelist_debug); fprintf(fp, " debuginfo_file: %s\n", pc->debuginfo_file); fprintf(fp, " namelist_orig: %s\n", pc->namelist_orig); fprintf(fp, "namelist_dbg_orig: %s\n", pc->namelist_debug_orig); fprintf(fp, " kvmdump_mapfile: %s\n", pc->kvmdump_mapfile); fprintf(fp, " memory_module: %s\n", pc->memory_module); fprintf(fp, " memory_device: %s\n", pc->memory_device); fprintf(fp, " machine_type: %s\n", pc->machine_type); fprintf(fp, " editing_mode: %s\n", pc->editing_mode); fprintf(fp, " nfd: %d\n", pc->nfd); fprintf(fp, " mfd: %d\n", pc->mfd); fprintf(fp, " kfd: %d\n", pc->kfd); fprintf(fp, " dfd: %d\n", pc->dfd); fprintf(fp, " confd: %d\n", pc->confd); fprintf(fp, " home: %s\n", pc->home); fprintf(fp, " command_line: "); if (STRNEQ(pc->command_line, args[0])) fprintf(fp, "%s\n", concat_args(buf, 0, FALSE)); else fprintf(fp, "%s\n", pc->command_line); fprintf(fp, " orig_line: %s\n", pc->orig_line); fprintf(fp, " eoc_index: %d\n", pc->eoc_index); fprintf(fp, " readline: %lx\n", (ulong)pc->readline); fprintf(fp, " my_tty: %s\n", pc->my_tty); fprintf(fp, " debug: %ld\n", pc->debug); fprintf(fp, " debug_save: %ld\n", pc->debug_save); fprintf(fp, " console: %s\n", pc->console); fprintf(fp, " redhat_debug_loc: %s\n", pc->redhat_debug_loc); fprintf(fp, " pipefd[2]: %d,%d\n", pc->pipefd[0], pc->pipefd[1]); fprintf(fp, " nullfp: %lx\n", (ulong)pc->nullfp); fprintf(fp, " stdpipe: %lx\n", (ulong)pc->stdpipe); fprintf(fp, " pipe: %lx\n", (ulong)pc->pipe); fprintf(fp, " ifile: %lx\n", (ulong)pc->ifile); fprintf(fp, " ofile: %lx\n", (ulong)pc->ofile); fprintf(fp, " ifile_pipe: %lx\n", (ulong)pc->ifile_pipe); fprintf(fp, " ifile_ofile: %lx\n", (ulong)pc->ifile_ofile); fprintf(fp, " args_ifile: %lx\n", (ulong)pc->args_ifile); fprintf(fp, " input_file: %s\n", pc->input_file); fprintf(fp, "ifile_in_progress: %lx (", pc->ifile_in_progress); others = 0; if (pc->ifile_in_progress & RCHOME_IFILE) fprintf(fp, "%sRCHOME_IFILE", others++ ? "|" : ""); if (pc->ifile_in_progress & RCLOCAL_IFILE) fprintf(fp, "%sRCLOCAL_IFILE", others++ ? "|" : ""); if (pc->ifile_in_progress & CMDLINE_IFILE) fprintf(fp, "%sCMDLINE_IFILE", others++ ? "|" : ""); if (pc->ifile_in_progress & RUNTIME_IFILE) fprintf(fp, "%sRUNTIME_IFILE", others++ ? "|" : ""); fprintf(fp, ")\n"); fprintf(fp, " ifile_offset: %lld\n", (ulonglong)pc->ifile_offset); fprintf(fp, "runtime_ifile_cmd: %s\n", pc->runtime_ifile_cmd ? pc->runtime_ifile_cmd : "(unused)"); fprintf(fp, " scroll_command: "); switch (pc->scroll_command) { case SCROLL_NONE: fprintf(fp, "SCROLL_NONE\n"); break; case SCROLL_LESS: fprintf(fp, "SCROLL_LESS\n"); break; case SCROLL_MORE: fprintf(fp, "SCROLL_MORE\n"); break; case SCROLL_CRASHPAGER: fprintf(fp, "SCROLL_CRASHPAGER (%s)\n", getenv("CRASHPAGER")); break; } buf[0] = NULLCHAR; fprintf(fp, " redirect: %lx ", pc->redirect); if (pc->redirect) sprintf(buf, "("); others = 0; if (pc->redirect & FROM_COMMAND_LINE) sprintf(&buf[strlen(buf)], "%sFROM_COMMAND_LINE", others++ ? "|" : ""); if (pc->redirect & FROM_INPUT_FILE) sprintf(&buf[strlen(buf)], "%sFROM_INPUT_FILE", others++ ? "|" : ""); if (pc->redirect & REDIRECT_NOT_DONE) sprintf(&buf[strlen(buf)], "%sREDIRECT_NOT_DONE", others++ ? "|" : ""); if (pc->redirect & REDIRECT_TO_PIPE) sprintf(&buf[strlen(buf)], "%sREDIRECT_TO_PIPE", others++ ? "|" : ""); if (pc->redirect & REDIRECT_TO_STDPIPE) sprintf(&buf[strlen(buf)], "%sREDIRECT_TO_STDPIPE", others++ ? "|" : ""); if (pc->redirect & REDIRECT_TO_FILE) sprintf(&buf[strlen(buf)], "%sREDIRECT_TO_FILE", others++ ? "|" : ""); if (pc->redirect & REDIRECT_FAILURE) sprintf(&buf[strlen(buf)], "%sREDIRECT_FAILURE", others++ ? "|" : ""); if (pc->redirect & REDIRECT_SHELL_ESCAPE) sprintf(&buf[strlen(buf)], "%sREDIRECT_SHELL_ESCAPE", others++ ? "|" : ""); if (pc->redirect & REDIRECT_SHELL_COMMAND) sprintf(&buf[strlen(buf)], "%sREDIRECT_SHELL_COMMAND", others++ ? "|" : ""); if (pc->redirect & REDIRECT_PID_KNOWN) sprintf(&buf[strlen(buf)], "%sREDIRECT_PID_KNOWN", others++ ? "|" : ""); if (pc->redirect & REDIRECT_MULTI_PIPE) sprintf(&buf[strlen(buf)], "%sREDIRECT_MULTI_PIPE", others++ ? "|" : ""); if (pc->redirect) strcat(buf, ")"); if (strlen(buf)) { if (strlen(buf) > 54) fprintf(fp, "\n%s\n", mkstring(buf, 80, CENTER|LJUST, NULL)); else fprintf(fp, "%s\n", buf); } if (!pc->redirect) fprintf(fp, "\n"); fprintf(fp, " stdpipe_pid: %d\n", pc->stdpipe_pid); fprintf(fp, " pipe_pid: %d\n", pc->pipe_pid); fprintf(fp, " pipe_shell_pid: %d\n", pc->pipe_shell_pid); fprintf(fp, " pipe_command: %s\n", pc->pipe_command); if (pc->symfile && pc->symfile2) { fprintf(fp, " symfile: %lx (%ld)\n", (ulong)pc->symfile, (ulong)ftell(pc->symfile)); fprintf(fp, " symfile2: %lx (%ld)\n", (ulong)pc->symfile2, (ulong)ftell(pc->symfile2)); } else { fprintf(fp, " symfile: %lx \n", (ulong)pc->symfile); fprintf(fp, " symfile2: %lx \n", (ulong)pc->symfile2); } fprintf(fp, " tmpfile: %lx\n", (ulong)pc->tmpfile); fprintf(fp, " saved_fp: %lx\n", (ulong)pc->saved_fp); fprintf(fp, " tmp_fp: %lx\n", (ulong)pc->tmp_fp); fprintf(fp, " tmpfile2: %lx\n", (ulong)pc->tmpfile2); fprintf(fp, " cmd_table: %s\n", XEN_HYPER_MODE() ? "xen_hyper_command_table" : "linux_command_table"); fprintf(fp, " curcmd: %s\n", pc->curcmd); fprintf(fp, " lastcmd: %s\n", pc->lastcmd); fprintf(fp, " cur_gdb_cmd: %d %s\n", pc->cur_gdb_cmd, gdb_command_string(pc->cur_gdb_cmd, buf, FALSE)); fprintf(fp, " last_gdb_cmd: %d %s\n", pc->last_gdb_cmd, gdb_command_string(pc->last_gdb_cmd, buf, FALSE)); fprintf(fp, " cur_req: %lx\n", (ulong)pc->cur_req); fprintf(fp, " cmdgencur: %ld\n", pc->cmdgencur); fprintf(fp, " curcmd_flags: %lx (", pc->curcmd_flags); others = 0; if (pc->curcmd_flags & XEN_MACHINE_ADDR) fprintf(fp, "%sXEN_MACHINE_ADDR", others ? "|" : ""); if (pc->curcmd_flags & REPEAT) fprintf(fp, "%sREPEAT", others ? "|" : ""); if (pc->curcmd_flags & IDLE_TASK_SHOWN) fprintf(fp, "%sIDLE_TASK_SHOWN", others ? "|" : ""); if (pc->curcmd_flags & TASK_SPECIFIED) fprintf(fp, "%sTASK_SPECIFIED", others ? "|" : ""); if (pc->curcmd_flags & MEMTYPE_UVADDR) fprintf(fp, "%sMEMTYPE_UVADDR", others ? "|" : ""); if (pc->curcmd_flags & MEMTYPE_FILEADDR) fprintf(fp, "%sMEMTYPE_FILEADDR", others ? "|" : ""); if (pc->curcmd_flags & HEADER_PRINTED) fprintf(fp, "%sHEADER_PRINTED", others ? "|" : ""); if (pc->curcmd_flags & BAD_INSTRUCTION) fprintf(fp, "%sBAD_INSTRUCTION", others ? "|" : ""); if (pc->curcmd_flags & UD2A_INSTRUCTION) fprintf(fp, "%sUD2A_INSTRUCTION", others ? "|" : ""); if (pc->curcmd_flags & IRQ_IN_USE) fprintf(fp, "%sIRQ_IN_USE", others ? "|" : ""); if (pc->curcmd_flags & IGNORE_ERRORS) fprintf(fp, "%sIGNORE_ERRORS", others ? "|" : ""); if (pc->curcmd_flags & FROM_RCFILE) fprintf(fp, "%sFROM_RCFILE", others ? "|" : ""); if (pc->curcmd_flags & MEMTYPE_KVADDR) fprintf(fp, "%sMEMTYPE_KVADDR", others ? "|" : ""); if (pc->curcmd_flags & NO_MODIFY) fprintf(fp, "%sNO_MODIFY", others ? "|" : ""); if (pc->curcmd_flags & MOD_SECTIONS) fprintf(fp, "%sMOD_SECTIONS", others ? "|" : ""); if (pc->curcmd_flags & MOD_READNOW) fprintf(fp, "%sMOD_READNOW", others ? "|" : ""); fprintf(fp, ")\n"); fprintf(fp, " curcmd_private: %llx\n", pc->curcmd_private); fprintf(fp, " cmd_cleanup: %lx\n", (ulong)pc->cmd_cleanup); fprintf(fp, " cmd_cleanup_arg: %lx\n", (ulong)pc->cmd_cleanup_arg); fprintf(fp, " sigint_cnt: %d\n", pc->sigint_cnt); fprintf(fp, " sigaction: %lx\n", (ulong)&pc->sigaction); fprintf(fp, " gdb_sigaction: %lx\n", (ulong)&pc->gdb_sigaction); fprintf(fp, " main_loop_env: %lx\n", (ulong)&pc->main_loop_env); fprintf(fp, " foreach_loop_env: %lx\n", (ulong)&pc->foreach_loop_env); fprintf(fp, "gdb_interface_env: %lx\n", (ulong)&pc->gdb_interface_env); fprintf(fp, " termios_orig: %lx\n", (ulong)&pc->termios_orig); fprintf(fp, " termios_raw: %lx\n", (ulong)&pc->termios_raw); fprintf(fp, " ncmds: %d\n", pc->ncmds); fprintf(fp, " cmdlist: %lx\n", (ulong)pc->cmdlist); fprintf(fp, " cmdlistsz: %d\n", pc->cmdlistsz); fprintf(fp, " output_radix: %d (%s)\n", pc->output_radix, pc->output_radix == 16 ? "hex" : ((pc->output_radix == 10) ? "decimal" : "???")); fprintf(fp, " server: %s\n", pc->server); fprintf(fp, " server_pid: %ld\n", pc->server_pid); fprintf(fp, " port: %d\n", pc->port); fprintf(fp, " sockfd: %d\n", pc->sockfd); fprintf(fp, " server_memsrc: %s\n", pc->server_memsrc); fprintf(fp, " server_namelist: %s\n", pc->server_namelist); fprintf(fp, " rmfd: %d\n", pc->rmfd); fprintf(fp, " rkfd: %d\n", pc->rkfd); fprintf(fp, " rcvbufsize: %ld\n", pc->rcvbufsize); fprintf(fp, " readmem: "); if ((p1 = readmem_function_name())) fprintf(fp, "%s()\n", p1); else fprintf(fp, "%lx\n", (ulong)pc->readmem); fprintf(fp, " writemem: "); if ((p1 = writemem_function_name())) fprintf(fp, "%s()\n", p1); else fprintf(fp, "%lx\n", (ulong)pc->writemem); fprintf(fp, " dumpfile memory: %d\n", dumpfile_memory(DUMPFILE_MEM_USED)); fprintf(fp, " curext: %lx\n", (ulong)pc->curext); fprintf(fp, " sbrk: %lx\n", (ulong)pc->sbrk); fprintf(fp, " cleanup: %s\n", pc->cleanup); fprintf(fp, " scope: %lx %s\n", pc->scope, pc->scope ? "" : "(not set)"); } char * readmem_function_name(void) { if (pc->readmem == read_dev_mem) return("read_dev_mem"); else if (pc->readmem == read_mclx_dumpfile) return("read_mclx_dumpfile"); else if (pc->readmem == read_lkcd_dumpfile) return("read_lkcd_dumpfile"); else if (pc->readmem == read_daemon) return("read_daemon"); else if (pc->readmem == read_netdump) return("read_netdump"); else if (pc->readmem == read_xendump) return("read_xendump"); else if (pc->readmem == read_kdump) return("read_kdump"); else if (pc->readmem == read_memory_device) return("read_memory_device"); else if (pc->readmem == read_xendump_hyper) return("read_xendump_hyper"); else if (pc->readmem == read_diskdump) return("read_diskdump"); else if (pc->readmem == read_proc_kcore) return("read_proc_kcore"); else if (pc->readmem == read_sadump) return("read_sadump"); else if (pc->readmem == read_s390_dumpfile) return("read_s390_dumpfile"); else return NULL; } char * writemem_function_name(void) { if (pc->writemem == write_dev_mem) return("write_dev_mem"); else if (pc->writemem == write_mclx_dumpfile) return("write_mclx_dumpfile"); else if (pc->writemem == write_lkcd_dumpfile) return("write_lkcd_dumpfile"); else if (pc->writemem == write_daemon) return("write_daemon"); else if (pc->writemem == write_netdump) return("write_netdump"); else if (pc->writemem == write_xendump) return("write_xendump"); else if (pc->writemem == write_kdump) return("write_kdump"); else if (pc->writemem == write_memory_device) return("write_memory_device"); // else if (pc->writemem == write_xendump_hyper) // return("write_xendump_hyper"); else if (pc->writemem == write_diskdump) return("write_diskdump"); else if (pc->writemem == write_proc_kcore) return("write_proc_kcore"); else if (pc->writemem == write_sadump) return("write_sadump"); else if (pc->writemem == write_s390_dumpfile) return("write_s390_dumpfile"); else return NULL; } /* * "help -B" output */ void dump_build_data(void) { fprintf(fp, " build_command: %s\n", build_command); fprintf(fp, " build_data: %s\n", build_data); fprintf(fp, " build_target: %s\n", build_target); fprintf(fp, " build_version: %s\n", build_version); fprintf(fp, "compiler version: %s\n", compiler_version); } /* * Perform any cleanup activity here. */ int clean_exit(int status) { if (pc->flags & MEMMOD) cleanup_memory_driver(); if ((pc->namelist_orig) && file_exists(pc->namelist, NULL)) unlink(pc->namelist); if ((pc->namelist_debug_orig) && file_exists(pc->namelist_debug, NULL)) unlink(pc->namelist_debug); if (pc->cleanup && file_exists(pc->cleanup, NULL)) unlink(pc->cleanup); exit(status); } /* * Check whether this session is for xen hypervisor analysis. */ static void check_xen_hyper(void) { if (!pc->namelist) return; if (!XEN_HYPER_MODE()) { if (STRNEQ(basename(pc->namelist), "xen-syms")) pc->flags |= XEN_HYPER; else return; } #ifdef XEN_HYPERVISOR_ARCH pc->cmd_table = xen_hyper_command_table; if (pc->flags & XENDUMP) pc->readmem = read_xendump_hyper; #else error(FATAL, XEN_HYPERVISOR_NOT_SUPPORTED); #endif } /* * Reject untrusted .crashrc, $HOME/.crashrc, * .gdbinit, and $HOME/.gdbinit files. */ static char *untrusted_file_list[4] = { 0 }; int untrusted_file(FILE *filep, char *filename) { struct stat sbuf; int i; if (filep && (fstat(fileno(filep), &sbuf) == 0) && (sbuf.st_uid == getuid()) && !(sbuf.st_mode & S_IWOTH)) return FALSE; for (i = 0; i < 4; i++) { if (!untrusted_file_list[i]) { untrusted_file_list[i] = strdup(filename); break; } } return TRUE; } static void show_untrusted_files(void) { int i, cnt; for (i = cnt = 0; i < 4; i++) { if (untrusted_file_list[i]) { error(WARNING, "not using untrusted file: \"%s\"\n", untrusted_file_list[i]); free(untrusted_file_list[i]); cnt++; } } if (cnt) fprintf(fp, "\n"); } /* * If GET_OSRELEASE is still set, the OS release has been * found and displayed. */ static void get_osrelease(char *dumpfile) { int retval = 1; if (is_flattened_format(dumpfile)) pc->flags2 |= FLAT; if (is_diskdump(dumpfile)) { if (pc->flags2 & GET_OSRELEASE) retval = 0; } else if (is_kdump(dumpfile, KDUMP_LOCAL)) { if (pc->flags2 & GET_OSRELEASE) retval = 0; } if (retval) fprintf(fp, "unknown\n"); clean_exit(retval); } static void get_log(char *dumpfile) { int retval = 1; if (is_flattened_format(dumpfile)) pc->flags2 |= FLAT; if (is_diskdump(dumpfile)) { if (pc->flags2 & GET_LOG) retval = 0; } else if (is_kdump(dumpfile, KDUMP_LOCAL)) { if (pc->flags2 & GET_LOG) retval = 0; } if (retval) fprintf(fp, "%s: no VMCOREINFO data\n", dumpfile); clean_exit(retval); }
Attachment:
Makefile
Description: Binary data
/* * ramdump.c - core analysis suite * * Copyright (c) 2014 Vinayak Menon <vinayakm.list@xxxxxxxxx> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Author: Vinayak Menon <vinayakm.list@xxxxxxxxx> */ #define _LARGEFILE64_SOURCE 1 /* stat64() */ #include "defs.h" #include <libelf.h> #define ELF_DEFAULT_FILE "ramdump_elf" static void alloc_elf_header(char *e, ushort e_machine, int nodes) { switch (e_machine) { case EM_ARM: { Elf32_Ehdr *ehdr = (Elf32_Ehdr *)e; memcpy(ehdr->e_ident, ELFMAG, SELFMAG); ehdr->e_ident[EI_CLASS] = ELFCLASS32; ehdr->e_ident[EI_DATA] = ELFDATA2LSB; ehdr->e_ident[EI_VERSION] = EV_CURRENT; ehdr->e_ident[EI_OSABI] = ELFOSABI_LINUX; ehdr->e_ident[EI_ABIVERSION] = 0; memset(ehdr->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD); ehdr->e_type = ET_CORE; ehdr->e_machine = EM_ARM; ehdr->e_version = EV_CURRENT; ehdr->e_shentsize = 0x0; ehdr->e_shnum = 0x0; ehdr->e_shoff = 0x0; ehdr->e_shstrndx = 0x0; ehdr->e_phnum = 1 + nodes; ehdr->e_entry = 0; ehdr->e_phoff = sizeof(Elf32_Ehdr); ehdr->e_flags = 0; ehdr->e_ehsize = sizeof(Elf32_Ehdr); ehdr->e_phentsize = sizeof(Elf32_Phdr); break; } case EM_AARCH64: { Elf64_Ehdr *ehdr = (Elf64_Ehdr *)e; memcpy(ehdr->e_ident, ELFMAG, SELFMAG); ehdr->e_ident[EI_CLASS] = ELFCLASS64; ehdr->e_ident[EI_DATA] = ELFDATA2LSB; ehdr->e_ident[EI_VERSION] = EV_CURRENT; ehdr->e_ident[EI_OSABI] = ELFOSABI_LINUX; ehdr->e_ident[EI_ABIVERSION] = 0; memset(ehdr->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD); ehdr->e_type = ET_CORE; ehdr->e_machine = EM_AARCH64; ehdr->e_version = EV_CURRENT; ehdr->e_entry = 0; ehdr->e_phoff = sizeof(Elf64_Ehdr); ehdr->e_shoff = 0; ehdr->e_flags = 0; ehdr->e_ehsize = sizeof(Elf64_Ehdr); ehdr->e_phentsize = sizeof(Elf64_Phdr); ehdr->e_phnum = 1 + nodes; ehdr->e_shentsize = 0; ehdr->e_shnum = 0; ehdr->e_shstrndx = 0; break; } }; } static int alloc_program_headers(char *e, ushort e_machine, struct ramdump_def *r, int nodes) { unsigned int i; struct stat64 st; switch (e_machine) { case EM_ARM: { Elf32_Phdr *phdr = (Elf32_Phdr *)e; for (i = 0; i < nodes; i++, phdr++) { phdr[i].p_type = PT_LOAD; if (0 > stat64(r[i].path, &st)) { error(INFO, "ramdump stat failed\n"); return -1; } r[i].size = st.st_size; phdr[i].p_filesz = r[i].size; phdr[i].p_memsz = phdr[i].p_filesz; /* * Yet to find a way to use PTOV, * as machdep_init is yet to be * invoked. */ phdr[i].p_vaddr = 0; phdr[i].p_paddr = r[i].start_paddr; phdr[i].p_flags = PF_R | PF_W | PF_X; phdr[i].p_align = 0; } break; } case EM_AARCH64: { Elf64_Phdr *phdr = (Elf64_Phdr *)e; for (i = 0; i < nodes; i++, phdr++) { phdr[i].p_type = PT_LOAD; if (0 > stat64(r[i].path, &st)) { error(INFO, "ramdump stat failed\n"); return -1; } r[i].size = st.st_size; phdr[i].p_filesz = r[i].size; phdr[i].p_memsz = phdr[i].p_filesz; phdr[i].p_vaddr = 0; phdr[i].p_paddr = r[i].start_paddr; phdr[i].p_flags = PF_R | PF_W | PF_X; phdr[i].p_align = 0; } break; } }; return 0; } static char *write_elf(ushort e_machine, void *load, char *e_head, size_t data_offset, struct ramdump_def *r, char *elf, int nodes) { #define CPY_BUF_SZ 4096 int fd1, fd2, i, err = 1; char *buf; char *out_elf = ELF_DEFAULT_FILE; size_t rd, len, offset; buf = (char *)GETBUF(CPY_BUF_SZ); if (elf) out_elf = elf; error(NOTE, "Creating kdump ELF %s\n", out_elf); offset = data_offset; fd2 = open(out_elf, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR); if (!fd2) { error(INFO, "%s open error\n", out_elf); goto end1; } while (offset > 0) { len = write(fd2, e_head + (data_offset - offset), offset); if (len < 0) { error(INFO, "ramdump write error\n"); goto end; } offset -= len; } for (i = 0; i < nodes; i++) { if (e_machine == EM_ARM) offset = ((Elf32_Phdr *)load)[i].p_offset; else if (e_machine == EM_AARCH64) offset = ((Elf64_Phdr *)load)[i].p_offset; fd1 = open(r[i].path, O_RDONLY, S_IRUSR); if (!fd1) { error(INFO, "%s open error\n", r[i].path); goto end; } lseek(fd2, (off_t)offset, SEEK_SET); while ((rd = read(fd1, buf, CPY_BUF_SZ)) > 0) { if (write(fd2, buf, rd) != rd) { error(INFO, "%s write error\n", r[i].path); close(fd1); goto end; } } close(fd1); } err = 0; end: close(fd2); end1: FREEBUF(buf); return err ? NULL : out_elf; } static void alloc_notes(char *e_head, ushort e_machine) { /* Nothing filled in as of now */ switch (e_machine) { case EM_ARM: { Elf32_Phdr *notes = (Elf32_Phdr *)e_head; notes->p_type = PT_NOTE; notes->p_offset = 0; notes->p_vaddr = 0; notes->p_paddr = 0; notes->p_filesz = 0; notes->p_memsz = 0; notes->p_flags = 0; notes->p_align = 0; break; } case EM_AARCH64: { Elf64_Phdr *notes = (Elf64_Phdr *)e_head; notes->p_type = PT_NOTE; notes->p_offset = 0; notes->p_vaddr = 0; notes->p_paddr = 0; notes->p_filesz = 0; notes->p_memsz = 0; notes->p_flags = 0; notes->p_align = 0; break; } }; } char *ramdump_to_elf(struct ramdump_def *ramdump, int nodes, char *elf) { int i; char *e_head, *ptr, *e_file = NULL; ushort e_machine = 0; size_t offset, data_offset; size_t l_offset32, l_offset64; size_t szelfhdr = 0, szpghdr = 0; Elf64_Phdr *notes64, *load64; Elf32_Phdr *load32, *notes32; if (machine_type("ARM")) { e_machine = EM_ARM; szelfhdr = sizeof(Elf32_Ehdr); szpghdr = sizeof(Elf32_Phdr); } else if (machine_type("ARM64")) { e_machine = EM_AARCH64; szelfhdr = sizeof(Elf64_Ehdr); szpghdr = sizeof(Elf64_Phdr); } else { error(INFO, "unknown machine type\n"); return NULL; } e_head = (char *)GETBUF(szelfhdr + nodes * szpghdr + PAGESIZE() * 2); ptr = e_head; offset = 0; error(NOTE, "Converting ramdump to kdump\n"); alloc_elf_header(ptr, e_machine, nodes); ptr += szelfhdr; offset += szelfhdr; notes32 = (Elf32_Phdr *)ptr; notes64 = (Elf64_Phdr *)ptr; alloc_notes(ptr, e_machine); offset += szpghdr; ptr += szpghdr; load32 = (Elf32_Phdr *)ptr; load64 = (Elf64_Phdr *)ptr; if (alloc_program_headers(ptr, e_machine, ramdump, nodes)) goto end; offset += szpghdr * nodes; ptr += szpghdr * nodes; /* Empty note */ notes32->p_offset = offset; notes64->p_offset = offset; l_offset32 = offset; l_offset64 = offset; data_offset = offset; switch (e_machine) { case EM_ARM: for (i = 0; i < nodes; i++) { load32[i].p_offset = l_offset32; l_offset32 += load32[i].p_filesz; } break; case EM_AARCH64: for (i = 0; i < nodes; i++) { load64[i].p_offset = l_offset64; l_offset64 += load64[i].p_filesz; } break; } e_file = write_elf(e_machine, load32, e_head, data_offset, ramdump, elf, nodes); end: FREEBUF(e_head); return e_file; }
/* defs.h - core analysis suite * * Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc. * Copyright (C) 2002-2014 David Anderson * Copyright (C) 2002-2014 Red Hat, Inc. All rights reserved. * Copyright (C) 2002 Silicon Graphics, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef GDB_COMMON #include <stdio.h> #include <stdarg.h> #include <stdint.h> #include <termios.h> #include <unistd.h> #include <sys/mman.h> #include <setjmp.h> #undef basename #if !defined(__USE_GNU) #define __USE_GNU #include <string.h> #undef __USE_GNU #else #include <string.h> #endif #include <fcntl.h> #include <stdlib.h> #include <signal.h> #include <assert.h> #include <errno.h> #include <dirent.h> #include <time.h> #include <zlib.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/param.h> #include <sys/wait.h> #include <sys/time.h> #include <execinfo.h> /* backtrace() */ #include <regex.h> #ifdef LZO #include <lzo/lzo1x.h> #endif #ifdef SNAPPY #include <snappy-c.h> #endif #ifndef ATTRIBUTE_UNUSED #define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) #endif #define BASELEVEL_REVISION "7.0.5" #undef TRUE #undef FALSE #define TRUE (1) #define FALSE (0) #define STR(x) #x #ifndef offsetof # define offsetof(TYPE, MEMBER) ((ulong)&((TYPE *)0)->MEMBER) #endif #if !defined(X86) && !defined(X86_64) && !defined(ALPHA) && !defined(PPC) && \ !defined(IA64) && !defined(PPC64) && !defined(S390) && !defined(S390X) && \ !defined(ARM) && !defined(ARM64) #ifdef __alpha__ #define ALPHA #endif #ifdef __i386__ #define X86 #endif #ifdef __powerpc__ #define PPC #endif #ifdef __ia64__ #define IA64 #endif #ifdef __s390__ #define S390 #endif #ifdef __s390x__ #define S390X #endif #ifdef __powerpc64__ #define PPC64 #endif #ifdef __x86_64__ #define X86_64 #endif #ifdef __arm__ #define ARM #endif #ifdef __aarch64__ #define ARM64 #endif #endif #ifdef X86 #define NR_CPUS (256) #endif #ifdef X86_64 #define NR_CPUS (8192) #endif #ifdef ALPHA #define NR_CPUS (64) #endif #ifdef PPC #define NR_CPUS (32) #endif #ifdef IA64 #define NR_CPUS (4096) #endif #ifdef PPC64 #define NR_CPUS (2048) #endif #ifdef S390 #define NR_CPUS (512) #endif #ifdef S390X #define NR_CPUS (512) #endif #ifdef ARM #define NR_CPUS (4) #endif #ifdef ARM64 #define NR_CPUS (4096) /* TBD */ #endif #define BUFSIZE (1500) #define NULLCHAR ('\0') #define MAXARGS (100) /* max number of arguments to one function */ #define MAXARGLEN (40) /* max length of argument */ #define HIST_BLKSIZE (4096) static inline int string_exists(char *s) { return (s ? TRUE : FALSE); } #define STREQ(A, B) (string_exists((char *)A) && string_exists((char *)B) && \ (strcmp((char *)(A), (char *)(B)) == 0)) #define STRNEQ(A, B) (string_exists((char *)A) && string_exists((char *)B) && \ (strncmp((char *)(A), (char *)(B), strlen((char *)(B))) == 0)) #define BZERO(S, N) (memset(S, NULLCHAR, N)) #define BCOPY(S, D, C) (memcpy(D, S, C)) #define BNEG(S, N) (memset(S, 0xff, N)) #define BEEP() fprintf(stderr, "%c", 0x7) #define LASTCHAR(s) (s[strlen(s)-1]) #define FIRSTCHAR(s) (s[0]) #define QUOTED_STRING(s) ((FIRSTCHAR(s) == '"') && (LASTCHAR(s) == '"')) #define SINGLE_QUOTED_STRING(s) ((FIRSTCHAR(s) == '\'') && (LASTCHAR(s) == '\'')) #define PATHEQ(A, B) ((A) && (B) && (pathcmp((char *)(A), (char *)(B)) == 0)) #ifdef roundup #undef roundup #endif #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) typedef uint64_t physaddr_t; #define PADDR_NOT_AVAILABLE (0x1ULL) typedef unsigned long long int ulonglong; struct number_option { ulong num; ulonglong ll_num; ulong retflags; }; /* * program_context flags */ #define LIVE_SYSTEM (0x1ULL) #define TTY (0x2ULL) #define RUNTIME (0x4ULL) #define IN_FOREACH (0x8ULL) #define MCLXCD (0x10ULL) #define CMDLINE_IFILE (0x20ULL) #define MFD_RDWR (0x40ULL) #define KVMDUMP (0x80ULL) #define SILENT (0x100ULL) #define SADUMP (0x200ULL) #define HASH (0x400ULL) #define SCROLL (0x800ULL) #define NO_CONSOLE (0x1000ULL) #define RUNTIME_IFILE (0x2000ULL) #define DROP_CORE (0x4000ULL) #define LKCD (0x8000ULL) #define GDB_INIT (0x10000ULL) #define IN_GDB (0x20000ULL) #define RCLOCAL_IFILE (0x40000ULL) #define RCHOME_IFILE (0x80000ULL) #define GET_TIMESTAMP (0x100000ULL) #define READLINE (0x200000ULL) #define _SIGINT_ (0x400000ULL) #define IN_RESTART (0x800000ULL) #define KERNEL_DEBUG_QUERY (0x1000000ULL) #define DEVMEM (0x2000000ULL) #define REM_LIVE_SYSTEM (0x4000000ULL) #define NAMELIST_LOCAL (0x8000000ULL) #define MEMSRC_LOCAL (0x10000000ULL) #define NAMELIST_SAVED (0x20000000ULL) #define DUMPFILE_SAVED (0x40000000ULL) #define UNLINK_NAMELIST (0x80000000ULL) #define NAMELIST_UNLINKED (0x100000000ULL) #define REM_MCLXCD (0x200000000ULL) #define REM_LKCD (0x400000000ULL) #define NAMELIST_NO_GZIP (0x800000000ULL) #define UNLINK_MODULES (0x1000000000ULL) #define S390D (0x2000000000ULL) #define REM_S390D (0x4000000000ULL) #define SYSRQ (0x8000000000ULL) #define KDUMP (0x10000000000ULL) #define NETDUMP (0x20000000000ULL) #define REM_NETDUMP (0x40000000000ULL) #define SYSMAP (0x80000000000ULL) #define SYSMAP_ARG (0x100000000000ULL) #define MEMMOD (0x200000000000ULL) #define MODPRELOAD (0x400000000000ULL) #define DISKDUMP (0x800000000000ULL) #define DATADEBUG (0x1000000000000ULL) #define FINDKERNEL (0x2000000000000ULL) #define VERSION_QUERY (0x4000000000000ULL) #define READNOW (0x8000000000000ULL) #define NOCRASHRC (0x10000000000000ULL) #define INIT_IFILE (0x20000000000000ULL) #define XENDUMP (0x40000000000000ULL) #define XEN_HYPER (0x80000000000000ULL) #define XEN_CORE (0x100000000000000ULL) #define PLEASE_WAIT (0x200000000000000ULL) #define IFILE_ERROR (0x400000000000000ULL) #define KERNTYPES (0x800000000000000ULL) #define MINIMAL_MODE (0x1000000000000000ULL) #define CRASHBUILTIN (0x2000000000000000ULL) #define PRELOAD_EXTENSIONS \ (0x4000000000000000ULL) #define PROC_KCORE (0x8000000000000000ULL) #define ACTIVE() (pc->flags & LIVE_SYSTEM) #define DUMPFILE() (!(pc->flags & LIVE_SYSTEM)) #define LIVE() (pc->flags2 & LIVE_DUMP || pc->flags & LIVE_SYSTEM) #define MEMORY_SOURCES (NETDUMP|KDUMP|MCLXCD|LKCD|DEVMEM|S390D|MEMMOD|DISKDUMP|XENDUMP|CRASHBUILTIN|KVMDUMP|PROC_KCORE|SADUMP) #define DUMPFILE_TYPES (DISKDUMP|NETDUMP|KDUMP|MCLXCD|LKCD|S390D|XENDUMP|KVMDUMP|SADUMP) #define REMOTE() (pc->flags2 & REMOTE_DAEMON) #define REMOTE_ACTIVE() (pc->flags & REM_LIVE_SYSTEM) #define REMOTE_DUMPFILE() \ (pc->flags & (REM_NETDUMP|REM_MCLXCD|REM_LKCD|REM_S390D)) #define REMOTE_MEMSRC() (REMOTE_ACTIVE() || REMOTE_PAUSED() || REMOTE_DUMPFILE()) #define LKCD_DUMPFILE() (pc->flags & (LKCD|REM_LKCD)) #define NETDUMP_DUMPFILE() (pc->flags & (NETDUMP|REM_NETDUMP)) #define DISKDUMP_DUMPFILE() (pc->flags & DISKDUMP) #define KDUMP_DUMPFILE() (pc->flags & KDUMP) #define XENDUMP_DUMPFILE() (pc->flags & XENDUMP) #define XEN_HYPER_MODE() (pc->flags & XEN_HYPER) #define SYSRQ_TASK(X) ((pc->flags & SYSRQ) && is_task_active(X)) #define XEN_CORE_DUMPFILE() (pc->flags & XEN_CORE) #define LKCD_KERNTYPES() (pc->flags & KERNTYPES) #define KVMDUMP_DUMPFILE() (pc->flags & KVMDUMP) #define SADUMP_DUMPFILE() (pc->flags & SADUMP) #define NETDUMP_LOCAL (0x1) /* netdump_data flags */ #define NETDUMP_REMOTE (0x2) #define VMCORE_VALID() (nd->flags & (NETDUMP_LOCAL|NETDUMP_REMOTE|KDUMP_LOCAL)) #define NETDUMP_ELF32 (0x4) #define NETDUMP_ELF64 (0x8) #define PARTIAL_DUMP (0x10) /* netdump or diskdump */ #define KDUMP_ELF32 (0x20) #define KDUMP_ELF64 (0x40) #define KDUMP_LOCAL (0x80) #define KCORE_LOCAL (0x100) #define KCORE_ELF32 (0x200) #define KCORE_ELF64 (0x400) #define QEMU_MEM_DUMP_KDUMP_BACKUP \ (0x800) #define KVMDUMP_LOCAL (0x1) #define KVMDUMP_VALID() (kvm->flags & (KVMDUMP_LOCAL)) #define DUMPFILE_FORMAT(flags) ((flags) & \ (NETDUMP_ELF32|NETDUMP_ELF64|KDUMP_ELF32|KDUMP_ELF64)) #define DISKDUMP_LOCAL (0x1) #define KDUMP_CMPRS_LOCAL (0x2) #define ERROR_EXCLUDED (0x4) #define ZERO_EXCLUDED (0x8) #define DUMPFILE_SPLIT (0x10) #define NO_ELF_NOTES (0x20) #define LZO_SUPPORTED (0x40) #define SNAPPY_SUPPORTED (0x80) #define DISKDUMP_VALID() (dd->flags & DISKDUMP_LOCAL) #define KDUMP_CMPRS_VALID() (dd->flags & KDUMP_CMPRS_LOCAL) #define KDUMP_SPLIT() (dd->flags & DUMPFILE_SPLIT) #define XENDUMP_LOCAL (0x1) #define XENDUMP_VALID() (xd->flags & XENDUMP_LOCAL) #define SADUMP_LOCAL (0x1) #define SADUMP_DISKSET (0x2) #define SADUMP_MEDIA (0x4) #define SADUMP_ZERO_EXCLUDED (0x8) #define SADUMP_KDUMP_BACKUP (0x10) #define SADUMP_VALID() (sd->flags & SADUMP_LOCAL) #define CRASHDEBUG(x) (pc->debug >= (x)) #define CRASHDEBUG_SUSPEND(X) { pc->debug_save = pc->debug; pc->debug = X; } #define CRASHDEBUG_RESTORE() { pc->debug = pc->debug_save; } #define VERBOSE (0x1) #define ADDRESS_SPECIFIED (0x2) #define FAULT_ON_ERROR (0x1) #define RETURN_ON_ERROR (0x2) #define QUIET (0x4) #define HEX_BIAS (0x8) #define LONG_LONG (0x10) #define RETURN_PARTIAL (0x20) #define SEEK_ERROR (-1) #define READ_ERROR (-2) #define WRITE_ERROR (-3) #define PAGE_EXCLUDED (-4) #define RESTART() (longjmp(pc->main_loop_env, 1)) #define RESUME_FOREACH() (longjmp(pc->foreach_loop_env, 1)) #define INFO (1) #define FATAL (2) #define FATAL_RESTART (3) #define WARNING (4) #define NOTE (5) #define CONT (6) #define FATAL_ERROR(x) (((x) == FATAL) || ((x) == FATAL_RESTART)) #define CONSOLE_OFF(x) ((x) = console_off()) #define CONSOLE_ON(x) (console_on(x)) #define RADIX(X) (X) #define NUM_HEX (0x1) #define NUM_DEC (0x2) #define NUM_EXPR (0x4) #define NUM_ANY (NUM_HEX|NUM_DEC|NUM_EXPR) /* * program context redirect flags */ #define FROM_COMMAND_LINE (0x1) #define FROM_INPUT_FILE (0x2) #define REDIRECT_NOT_DONE (0x4) #define REDIRECT_TO_PIPE (0x8) #define REDIRECT_TO_STDPIPE (0x10) #define REDIRECT_TO_FILE (0x20) #define REDIRECT_FAILURE (0x40) #define REDIRECT_SHELL_ESCAPE (0x80) #define REDIRECT_SHELL_COMMAND (0x100) #define REDIRECT_PID_KNOWN (0x200) #define REDIRECT_MULTI_PIPE (0x400) #define PIPE_OPTIONS (FROM_COMMAND_LINE | FROM_INPUT_FILE | REDIRECT_TO_PIPE | \ REDIRECT_TO_STDPIPE | REDIRECT_TO_FILE) #define DEFAULT_REDHAT_DEBUG_LOCATION "/usr/lib/debug/lib/modules" #define MEMORY_DRIVER_MODULE "crash" #define MEMORY_DRIVER_DEVICE "/dev/crash" #define MEMORY_DRIVER_DEVICE_MODE (S_IFCHR|S_IRUSR) /* * structure definitions */ struct program_context { char *program_name; /* this program's name */ char *program_path; /* unadulterated argv[0] */ char *program_version; /* this program's version */ char *gdb_version; /* embedded gdb version */ char *prompt; /* this program's prompt */ unsigned long long flags; /* flags from above */ char *namelist; /* linux namelist */ char *dumpfile; /* dumpfile or /dev/kmem */ char *live_memsrc; /* live memory driver */ char *system_map; /* get symbol values from System.map */ char *namelist_debug; /* namelist containing debug data */ char *debuginfo_file; /* separate debuginfo file */ char *memory_module; /* alternative to mem.c driver */ char *memory_device; /* alternative to /dev/[k]mem device */ char *machine_type; /* machine's processor type */ char *editing_mode; /* readline vi or emacs */ char *server; /* network daemon */ char *server_memsrc; /* memory source on server */ char *server_namelist; /* kernel namelist on server */ int nfd; /* linux namelist fd */ int mfd; /* /dev/mem fd */ int kfd; /* /dev/kmem fd */ int dfd; /* dumpfile fd */ int confd; /* console fd */ int sockfd; /* network daemon socket */ ushort port; /* network daemon port */ int rmfd; /* remote server memory source fd */ int rkfd; /* remote server /dev/kmem fd */ ulong program_pid; /* program pid */ ulong server_pid; /* server pid */ ulong rcvbufsize; /* client-side receive buffer size */ char *home; /* user's home directory */ char command_line[BUFSIZE]; /* possibly parsed input command line */ char orig_line[BUFSIZE]; /* original input line */ char *readline; /* pointer to last readline() return */ char my_tty[10]; /* real tty name (shown by ps -ef) */ ulong debug; /* level of debug */ ulong debug_save; /* saved level for debug-suspend */ char *console; /* current debug console device */ char *redhat_debug_loc; /* location of matching debug objects */ int pipefd[2]; /* output pipe file descriptors */ FILE *nullfp; /* bitbucket */ FILE *stdpipe; /* standard pipe for output */ FILE *pipe; /* command line specified pipe */ FILE *ofile; /* command line specified output file */ FILE *ifile; /* command line specified input file */ FILE *ifile_pipe; /* output pipe specified from file */ FILE *ifile_ofile; /* output file specified from file */ FILE *symfile; /* symbol table data file */ FILE *symfile2; /* alternate access to above */ FILE *tmpfile; /* tmpfile for selective data output */ FILE *saved_fp; /* for printing while parsing tmpfile */ FILE *tmp_fp; /* stored tmpfile pointer */ char *input_file; /* input file specified at invocation */ FILE *tmpfile2; /* tmpfile2 does not use save_fp! */ int eoc_index; /* end of redirected command index */ int scroll_command; /* default scroll command for output */ #define SCROLL_NONE 0 #define SCROLL_LESS 1 #define SCROLL_MORE 2 #define SCROLL_CRASHPAGER 3 ulong redirect; /* per-cmd origin and output flags */ pid_t stdpipe_pid; /* per-cmd standard output pipe's pid */ pid_t pipe_pid; /* per-cmd output pipe's pid */ pid_t pipe_shell_pid; /* per-cmd output pipe's shell pid */ char pipe_command[BUFSIZE]; /* pipe command line */ struct command_table_entry *cmd_table; /* linux/xen command table */ char *curcmd; /* currently-executing command */ char *lastcmd; /* previously-executed command */ ulong cmdgencur; /* current command generation number */ ulong curcmd_flags; /* general purpose per-command flag */ #define XEN_MACHINE_ADDR (0x1) #define REPEAT (0x2) #define IDLE_TASK_SHOWN (0x4) #define TASK_SPECIFIED (0x8) #define MEMTYPE_UVADDR (0x10) #define MEMTYPE_FILEADDR (0x20) #define HEADER_PRINTED (0x40) #define BAD_INSTRUCTION (0x80) #define UD2A_INSTRUCTION (0x100) #define IRQ_IN_USE (0x200) #define NO_MODIFY (0x400) #define IGNORE_ERRORS (0x800) #define FROM_RCFILE (0x1000) #define MEMTYPE_KVADDR (0x2000) #define MOD_SECTIONS (0x4000) #define MOD_READNOW (0x8000) ulonglong curcmd_private; /* general purpose per-command info */ int cur_gdb_cmd; /* current gdb command */ int last_gdb_cmd; /* previously-executed gdb command */ int sigint_cnt; /* number of ignored SIGINTs */ struct gnu_request *cur_req; /* current gdb gnu_request */ struct sigaction sigaction; /* general usage sigaction. */ struct sigaction gdb_sigaction; /* gdb's SIGINT sigaction. */ jmp_buf main_loop_env; /* longjmp target default */ jmp_buf foreach_loop_env; /* longjmp target within foreach */ jmp_buf gdb_interface_env; /* longjmp target for gdb error catch */ struct termios termios_orig; /* non-raw settings */ struct termios termios_raw; /* while gathering command input */ int ncmds; /* number of commands in menu */ char **cmdlist; /* current list of available commands */ int cmdlistsz; /* space available in cmdlist */ unsigned output_radix; /* current gdb output_radix */ void *sbrk; /* current sbrk value */ struct extension_table *curext; /* extension being loaded */ int (*readmem)(int, void *, int, ulong, physaddr_t); /* memory access */ int (*writemem)(int, void *, int, ulong, physaddr_t);/* memory access */ ulong ifile_in_progress; /* original xxx_IFILE flags */ off_t ifile_offset; /* current offset into input file */ char *runtime_ifile_cmd; /* runtime command using input file */ char *kvmdump_mapfile; /* storage of physical to file offsets */ ulonglong flags2; /* flags overrun */ #define FLAT (0x01ULL) #define ELF_NOTES (0x02ULL) #define GET_OSRELEASE (0x04ULL) #define REMOTE_DAEMON (0x08ULL) #define ERASEINFO_DATA (0x10ULL) #define GDB_CMD_MODE (0x20ULL) #define LIVE_DUMP (0x40ULL) #define FLAT_FORMAT() (pc->flags2 & FLAT) #define ELF_NOTES_VALID() (pc->flags2 & ELF_NOTES) #define RADIX_OVERRIDE (0x80ULL) #define QEMU_MEM_DUMP (0x100ULL) #define GET_LOG (0x200ULL) #define VMCOREINFO (0x400ULL) #define ALLOW_FP (0x800ULL) #define REM_PAUSED_F (0x1000ULL) #define REMOTE_PAUSED() (pc->flags2 & REM_PAUSED_F) char *cleanup; char *namelist_orig; char *namelist_debug_orig; FILE *args_ifile; /* per-command args input file */ void (*cmd_cleanup)(void *); /* per-command cleanup function */ void *cmd_cleanup_arg; /* optional cleanup function argument */ ulong scope; /* optional text context address */ }; #define READMEM pc->readmem typedef void (*cmd_func_t)(void); struct command_table_entry { /* one for each command in menu */ char *name; cmd_func_t func; char **help_data; ulong flags; }; struct args_input_file { int index; int args_used; int is_gdb_cmd; int in_expression; int start; int resume; char *fileptr; }; #define REFRESH_TASK_TABLE (0x1) /* command_table_entry flags */ #define HIDDEN_COMMAND (0x2) #define CLEANUP (0x4) /* for extensions only */ #define MINIMAL (0x8) /* * A linked list of extension table structures keeps track of the current * set of shared library extensions. */ struct extension_table { void *handle; /* handle from dlopen() */ char *filename; /* name of shared library */ struct command_table_entry *command_table; /* list of commands */ ulong flags; /* registration flags */ struct extension_table *next, *prev; /* bookkeeping */ }; #define REGISTERED (0x1) /* extension_table flags */ #define DUPLICATE_COMMAND_NAME (0x2) #define NO_MINIMAL_COMMANDS (0x4) struct new_utsname { char sysname[65]; char nodename[65]; char release[65]; char version[65]; char machine[65]; char domainname[65]; }; #define NO_MODULE_ACCESS (0x1) #define TVEC_BASES_V1 (0x2) #define GCC_3_2 (0x4) #define GCC_3_2_3 (0x8) #define GCC_2_96 (0x10) #define RA_SEEK (0x20) #define NO_RA_SEEK (0x40) #define KALLSYMS_V1 (0x80) #define NO_KALLSYMS (0x100) #define PER_CPU_OFF (0x200) #define SMP (0x400) #define GCC_3_3_2 (0x800) #define KMOD_V1 (0x1000) #define KMOD_V2 (0x2000) #define KALLSYMS_V2 (0x2000) #define TVEC_BASES_V2 (0x4000) #define GCC_3_3_3 (0x8000) #define USE_OLD_BT (0x10000) #define ARCH_XEN (0x20000) #define NO_IKCONFIG (0x40000) #define DWARF_UNWIND (0x80000) #define NO_DWARF_UNWIND (0x100000) #define DWARF_UNWIND_MEMORY (0x200000) #define DWARF_UNWIND_EH_FRAME (0x400000) #define DWARF_UNWIND_CAPABLE (DWARF_UNWIND_MEMORY|DWARF_UNWIND_EH_FRAME) #define DWARF_UNWIND_MODULES (0x800000) #define BUGVERBOSE_OFF (0x1000000) #define RELOC_SET (0x2000000) #define RELOC_FORCE (0x4000000) #define ARCH_OPENVZ (0x8000000) #define ARCH_PVOPS (0x10000000) #define PRE_KERNEL_INIT (0x20000000) #define ARCH_PVOPS_XEN (0x40000000) #define IRQ_DESC_TREE (0x80000000) #define GCC_VERSION_DEPRECATED (GCC_3_2|GCC_3_2_3|GCC_2_96|GCC_3_3_2|GCC_3_3_3) /* flags2 */ #define RELOC_AUTO (0x1ULL) #define KASLR (0x2ULL) #define XEN() (kt->flags & ARCH_XEN) #define OPENVZ() (kt->flags & ARCH_OPENVZ) #define PVOPS() (kt->flags & ARCH_PVOPS) #define PVOPS_XEN() (kt->flags & ARCH_PVOPS_XEN) #define XEN_MACHINE_TO_MFN(m) ((ulonglong)(m) >> PAGESHIFT()) #define XEN_PFN_TO_PSEUDO(p) ((ulonglong)(p) << PAGESHIFT()) #define XEN_MFN_NOT_FOUND (~0UL) #define XEN_PFNS_PER_PAGE (PAGESIZE()/sizeof(ulong)) #define XEN_FOREIGN_FRAME (1UL << (BITS()-1)) #define XEN_MACHADDR_NOT_FOUND (~0ULL) #define XEN_P2M_PER_PAGE (PAGESIZE() / sizeof(unsigned long)) #define XEN_P2M_MID_PER_PAGE (PAGESIZE() / sizeof(unsigned long *)) #define XEN_P2M_TOP_PER_PAGE (PAGESIZE() / sizeof(unsigned long **)) struct kernel_table { /* kernel data */ ulong flags; ulong stext; ulong etext; ulong stext_init; ulong etext_init; ulong init_begin; ulong init_end; ulong end; int cpus; char *cpus_override; void (*display_bh)(void); ulong module_list; ulong kernel_module; int mods_installed; struct timespec date; char proc_version[BUFSIZE]; struct new_utsname utsname; uint kernel_version[3]; uint gcc_version[3]; int runq_siblings; int kernel_NR_CPUS; long __per_cpu_offset[NR_CPUS]; long *__rq_idx; long *__cpu_idx; ulong *cpu_flags; #define POSSIBLE (0x1) #define PRESENT (0x2) #define ONLINE (0x4) #define NMI (0x8) int BUG_bytes; ulong xen_flags; #define WRITABLE_PAGE_TABLES (0x1) #define SHADOW_PAGE_TABLES (0x2) #define CANONICAL_PAGE_TABLES (0x4) #define XEN_SUSPEND (0x8) char *m2p_page; ulong phys_to_machine_mapping; ulong p2m_table_size; #define P2M_MAPPING_CACHE (512) struct p2m_mapping_cache { ulong mapping; ulong pfn; ulong start; ulong end; } p2m_mapping_cache[P2M_MAPPING_CACHE]; #define P2M_MAPPING_PAGE_PFN(c) \ (PVOPS_XEN() ? kt->p2m_mapping_cache[c].pfn : \ (((kt->p2m_mapping_cache[c].mapping - kt->phys_to_machine_mapping)/PAGESIZE()) \ * XEN_PFNS_PER_PAGE)) ulong last_mapping_read; ulong p2m_cache_index; ulong p2m_pages_searched; ulong p2m_mfn_cache_hits; ulong p2m_page_cache_hits; ulong relocate; char *module_tree; struct pvops_xen_info { int p2m_top_entries; ulong p2m_top; ulong p2m_mid_missing; ulong p2m_missing; } pvops_xen; int highest_irq; #define IKCONFIG_AVAIL 0x1 /* kernel contains ikconfig data */ #define IKCONFIG_LOADED 0x2 /* ikconfig data is currently loaded */ int ikconfig_flags; int ikconfig_ents; char *hypervisor; struct vmcoreinfo_data { ulong log_buf_SYMBOL; ulong log_end_SYMBOL; ulong log_buf_len_SYMBOL; ulong logged_chars_SYMBOL; ulong log_first_idx_SYMBOL; ulong log_next_idx_SYMBOL; long log_SIZE; long log_ts_nsec_OFFSET; long log_len_OFFSET; long log_text_len_OFFSET; long log_dict_len_OFFSET; ulong phys_base_SYMBOL; ulong _stext_SYMBOL; } vmcoreinfo; ulonglong flags2; }; /* * Aid for the two versions of the kernel's module list linkage. */ #define NEXT_MODULE(next_module, modbuf) \ { \ switch (kt->flags & (KMOD_V1|KMOD_V2)) \ { \ case KMOD_V1: \ next_module = ULONG(modbuf + OFFSET(module_next)); \ break; \ case KMOD_V2: \ next_module = ULONG(modbuf + OFFSET(module_list)); \ if (next_module != kt->kernel_module) \ next_module -= OFFSET(module_list); \ break; \ } \ } #define THIS_KERNEL_VERSION ((kt->kernel_version[0] << 16) + \ (kt->kernel_version[1] << 8) + \ (kt->kernel_version[2])) #define LINUX(x,y,z) (((uint)(x) << 16) + ((uint)(y) << 8) + (uint)(z)) #define THIS_GCC_VERSION ((kt->gcc_version[0] << 16) + \ (kt->gcc_version[1] << 8) + \ (kt->gcc_version[2])) #define GCC(x,y,z) (((uint)(x) << 16) + ((uint)(y) << 8) + (uint)(z)) #define IS_KERNEL_STATIC_TEXT(x) (((ulong)(x) >= kt->stext) && \ ((ulong)(x) < kt->etext)) #define TASK_COMM_LEN 16 /* task command name length including NULL */ struct task_context { /* context stored for each task */ ulong task; ulong thread_info; ulong pid; char comm[TASK_COMM_LEN+1]; int processor; ulong ptask; ulong mm_struct; struct task_context *tc_next; }; struct task_table { /* kernel/local task table data */ struct task_context *current; struct task_context *context_array; void (*refresh_task_table)(void); ulong flags; ulong task_start; ulong task_end; void *task_local; int max_tasks; int nr_threads; ulong running_tasks; ulong retries; ulong panicmsg; int panic_processor; ulong *idle_threads; ulong *panic_threads; ulong *active_set; ulong *panic_ksp; ulong *hardirq_ctx; ulong *hardirq_tasks; ulong *softirq_ctx; ulong *softirq_tasks; ulong panic_task; ulong this_task; int pidhash_len; ulong pidhash_addr; ulong last_task_read; ulong last_thread_info_read; ulong last_mm_read; char *task_struct; char *thread_info; char *mm_struct; ulong init_pid_ns; }; #define TASK_INIT_DONE (0x1) #define TASK_ARRAY_EXISTS (0x2) #define PANIC_TASK_NOT_FOUND (0x4) #define TASK_REFRESH (0x8) #define TASK_REFRESH_OFF (0x10) #define PANIC_KSP (0x20) #define ACTIVE_SET (0x40) #define POPULATE_PANIC (0x80) #define PIDHASH (0x100) #define PID_HASH (0x200) #define THREAD_INFO (0x400) #define IRQSTACKS (0x800) #define TIMESPEC (0x1000) #define NO_TIMESPEC (0x2000) #define ACTIVE_ONLY (0x4000) #define TASK_SLUSH (20) #define NO_PROC_ID 0xFF /* No processor magic marker (from kernel) */ /* * Global "tt" points to task_table */ #define CURRENT_CONTEXT() (tt->current) #define CURRENT_TASK() (tt->current->task) #define CURRENT_PID() (tt->current->pid) #define CURRENT_COMM() (tt->current->comm) #define RUNNING_TASKS() (tt->running_tasks) #define FIRST_CONTEXT() (tt->context_array) #define NO_PID ((ulong)-1) #define NO_TASK (0) #define IS_TASK_ADDR(X) (machdep->is_task_addr(X)) #define GET_STACKBASE(X) (machdep->get_stackbase(X)) #define GET_STACKTOP(X) (machdep->get_stacktop(X)) #define STACKSIZE() (machdep->stacksize) #define LONGS_PER_STACK (machdep->stacksize/sizeof(ulong)) #define INSTACK(X,BT) \ (((ulong)(X) >= (BT)->stackbase) && ((ulong)(X) < (BT)->stacktop)) #define ALIGNED_STACK_OFFSET(task) ((ulong)(task) & (STACKSIZE()-1)) #define BITS() (machdep->bits) #define BITS32() (machdep->bits == 32) #define BITS64() (machdep->bits == 64) #define IS_KVADDR(X) (machdep->is_kvaddr(X)) #define IS_UVADDR(X,C) (machdep->is_uvaddr(X,C)) #define PID_ALIVE(x) (kill(x, 0) == 0) struct kernel_list_head { struct kernel_list_head *next, *prev; }; struct stack_hook { ulong esp; ulong eip; }; struct bt_info { ulong task; ulonglong flags; ulong instptr; ulong stkptr; ulong bptr; ulong stackbase; ulong stacktop; char *stackbuf; struct task_context *tc; struct stack_hook *hp; struct stack_hook *textlist; struct reference *ref; ulong frameptr; char *call_target; void *machdep; ulong debug; ulong eframe_ip; ulong radix; }; #define STACK_OFFSET_TYPE(OFF) \ (((ulong)(OFF) > STACKSIZE()) ? \ (ulong)((ulong)(OFF) - (ulong)(bt->stackbase)) : (ulong)(OFF)) #define GET_STACK_ULONG(OFF) \ *((ulong *)((char *)(&bt->stackbuf[(ulong)(STACK_OFFSET_TYPE(OFF))]))) #define GET_STACK_DATA(OFF, LOC, SZ) memcpy((void *)(LOC), \ (void *)(&bt->stackbuf[(ulong)STACK_OFFSET_TYPE(OFF)]), (size_t)(SZ)) struct machine_specific; /* uniquely defined below each machine's area */ struct xendump_data; struct xen_kdump_data; struct vaddr_range { ulong start; ulong end; ulong type; #define KVADDR_UNITY_MAP (1) #define KVADDR_VMALLOC (2) #define KVADDR_VMEMMAP (3) #define KVADDR_START_MAP (4) #define KVADDR_MODULES (5) #define MAX_KVADDR_RANGES KVADDR_MODULES }; #define MAX_MACHDEP_ARGS 5 /* for --machdep/-m machine-specific args */ struct machdep_table { ulong flags; ulong kvbase; ulong identity_map_base; uint pagesize; uint pageshift; ulonglong pagemask; ulong pageoffset; ulong stacksize; uint hz; ulong mhz; int bits; int nr_irqs; uint64_t memsize; int (*eframe_search)(struct bt_info *); void (*back_trace)(struct bt_info *); ulong (*processor_speed)(void); int (*uvtop)(struct task_context *, ulong, physaddr_t *, int); int (*kvtop)(struct task_context *, ulong, physaddr_t *, int); ulong (*get_task_pgd)(ulong); void (*dump_irq)(int); void (*get_stack_frame)(struct bt_info *, ulong *, ulong *); ulong (*get_stackbase)(ulong); ulong (*get_stacktop)(ulong); int (*translate_pte)(ulong, void *, ulonglong); uint64_t (*memory_size)(void); ulong (*vmalloc_start)(void); int (*is_task_addr)(ulong); int (*verify_symbol)(const char *, ulong, char); int (*dis_filter)(ulong, char *, unsigned int); int (*get_smp_cpus)(void); int (*is_kvaddr)(ulong); int (*is_uvaddr)(ulong, struct task_context *); int (*verify_paddr)(uint64_t); void (*cmd_mach)(void); void (*init_kernel_pgd)(void); struct syment *(*value_to_symbol)(ulong, ulong *); struct line_number_hook { char *func; char **file; } *line_number_hooks; ulong last_pgd_read; ulong last_pud_read; ulong last_pmd_read; ulong last_ptbl_read; char *pgd; char *pud; char *pmd; char *ptbl; int ptrs_per_pgd; char *cmdline_args[MAX_MACHDEP_ARGS]; struct machine_specific *machspec; ulong section_size_bits; ulong max_physmem_bits; ulong sections_per_root; int (*xendump_p2m_create)(struct xendump_data *); ulong (*xendump_panic_task)(struct xendump_data *); void (*get_xendump_regs)(struct xendump_data *, struct bt_info *, ulong *, ulong *); void (*clear_machdep_cache)(void); int (*xen_kdump_p2m_create)(struct xen_kdump_data *); int (*in_alternate_stack)(int, ulong); void (*dumpfile_init)(int, void *); void (*process_elf_notes)(void *, unsigned long); int (*get_kvaddr_ranges)(struct vaddr_range *); int (*verify_line_number)(ulong, ulong, ulong); void (*get_irq_affinity)(int); void (*show_interrupts)(int, ulong *); }; /* * Processor-common flags; processor-specific flags use the lower bits * as defined in their processor-specific files below. (see KSYMS_START defs). */ #define HWRESET (0x80000000) #define OMIT_FRAME_PTR (0x40000000) #define FRAMESIZE_DEBUG (0x20000000) #define MACHDEP_BT_TEXT (0x10000000) #define DEVMEMRD (0x8000000) #define INIT (0x4000000) #define VM_4_LEVEL (0x2000000) #define MCA (0x1000000) #define PAE (0x800000) #define VMEMMAP (0x400000) extern struct machdep_table *machdep; #ifndef HZ #define HZ sysconf(_SC_CLK_TCK) #endif #define IS_LAST_PGD_READ(pgd) ((ulong)(pgd) == machdep->last_pgd_read) #define IS_LAST_PMD_READ(pmd) ((ulong)(pmd) == machdep->last_pmd_read) #define IS_LAST_PTBL_READ(ptbl) ((ulong)(ptbl) == machdep->last_ptbl_read) #define IS_LAST_PUD_READ(pud) ((ulong)(pud) == machdep->last_pud_read) #define FILL_PGD(PGD, TYPE, SIZE) \ if (!IS_LAST_PGD_READ(PGD)) { \ readmem((ulonglong)((ulong)(PGD)), TYPE, machdep->pgd, \ SIZE, "pgd page", FAULT_ON_ERROR); \ machdep->last_pgd_read = (ulong)(PGD); \ } #define FILL_PUD(PUD, TYPE, SIZE) \ if (!IS_LAST_PUD_READ(PUD)) { \ readmem((ulonglong)((ulong)(PUD)), TYPE, machdep->pud, \ SIZE, "pud page", FAULT_ON_ERROR); \ machdep->last_pud_read = (ulong)(PUD); \ } #define FILL_PMD(PMD, TYPE, SIZE) \ if (!IS_LAST_PMD_READ(PMD)) { \ readmem((ulonglong)(PMD), TYPE, machdep->pmd, \ SIZE, "pmd page", FAULT_ON_ERROR); \ machdep->last_pmd_read = (ulong)(PMD); \ } #define FILL_PTBL(PTBL, TYPE, SIZE) \ if (!IS_LAST_PTBL_READ(PTBL)) { \ readmem((ulonglong)(PTBL), TYPE, machdep->ptbl, \ SIZE, "page table", FAULT_ON_ERROR); \ machdep->last_ptbl_read = (ulong)(PTBL); \ } #define SETUP_ENV (0) #define PRE_SYMTAB (1) #define PRE_GDB (2) #define POST_GDB (3) #define POST_INIT (4) #define POST_VM (5) #define LOG_ONLY (6) #define FOREACH_BT (1) #define FOREACH_VM (2) #define FOREACH_TASK (3) #define FOREACH_SET (4) #define FOREACH_FILES (5) #define FOREACH_NET (6) #define FOREACH_TEST (7) #define FOREACH_VTOP (8) #define FOREACH_SIG (9) #define FOREACH_PS (10) #define MAX_FOREACH_KEYWORDS (10) #define MAX_FOREACH_TASKS (50) #define MAX_FOREACH_PIDS (50) #define MAX_FOREACH_COMMS (50) #define MAX_FOREACH_ARGS (50) #define MAX_REGEX_ARGS (10) #define FOREACH_CMD (0x1) #define FOREACH_r_FLAG (0x2) #define FOREACH_s_FLAG (0x4) #define FOREACH_S_FLAG (0x8) #define FOREACH_i_FLAG (0x10) #define FOREACH_e_FLAG (0x20) #define FOREACH_g_FLAG (0x40) #define FOREACH_l_FLAG (0x80) #define FOREACH_p_FLAG (0x100) #define FOREACH_t_FLAG (0x200) #define FOREACH_u_FLAG (0x400) #define FOREACH_m_FLAG (0x800) #define FOREACH_v_FLAG (0x1000) #define FOREACH_KERNEL (0x2000) #define FOREACH_USER (0x4000) #define FOREACH_SPECIFIED (0x8000) #define FOREACH_ACTIVE (0x10000) #define FOREACH_k_FLAG (0x20000) #define FOREACH_c_FLAG (0x40000) #define FOREACH_f_FLAG (0x80000) #define FOREACH_o_FLAG (0x100000) #define FOREACH_T_FLAG (0x200000) #define FOREACH_F_FLAG (0x400000) #define FOREACH_x_FLAG (0x800000) #define FOREACH_d_FLAG (0x1000000) #define FOREACH_STATE (0x2000000) #define FOREACH_a_FLAG (0x4000000) #define FOREACH_G_FLAG (0x8000000) #define FOREACH_F_FLAG2 (0x10000000) #define FOREACH_PS_EXCLUSIVE \ (FOREACH_g_FLAG|FOREACH_a_FLAG|FOREACH_t_FLAG|FOREACH_c_FLAG|FOREACH_p_FLAG|FOREACH_l_FLAG|FOREACH_r_FLAG) struct foreach_data { ulong flags; int keyword_array[MAX_FOREACH_KEYWORDS]; ulong task_array[MAX_FOREACH_TASKS]; char *comm_array[MAX_FOREACH_COMMS]; ulong pid_array[MAX_FOREACH_PIDS]; ulong arg_array[MAX_FOREACH_ARGS]; struct regex_info { char *pattern; regex_t regex; } regex_info[MAX_REGEX_ARGS]; ulong state; char *reference; int keys; int pids; int tasks; int comms; int args; int regexs; }; struct reference { char *str; ulong cmdflags; ulong hexval; ulong decval; ulong ref1; ulong ref2; void *refp; }; struct offset_table { /* stash of commonly-used offsets */ long list_head_next; /* add new entries to end of table */ long list_head_prev; long task_struct_pid; long task_struct_state; long task_struct_comm; long task_struct_mm; long task_struct_tss; long task_struct_thread; long task_struct_active_mm; long task_struct_tss_eip; long task_struct_tss_esp; long task_struct_tss_ksp; long task_struct_processor; long task_struct_p_pptr; long task_struct_parent; long task_struct_has_cpu; long task_struct_cpus_runnable; long task_struct_thread_eip; long task_struct_thread_esp; long task_struct_thread_ksp; long task_struct_next_task; long task_struct_files; long task_struct_fs; long task_struct_pidhash_next; long task_struct_next_run; long task_struct_flags; long task_struct_sig; long task_struct_signal; long task_struct_blocked; long task_struct_sigpending; long task_struct_pending; long task_struct_sigqueue; long task_struct_sighand; long task_struct_start_time; long task_struct_times; long task_struct_utime; long task_struct_stime; long task_struct_cpu; long task_struct_run_list; long task_struct_pgrp; long task_struct_tgid; long task_struct_namespace; long task_struct_pids; long task_struct_last_run; long task_struct_timestamp; long task_struct_thread_info; long task_struct_nsproxy; long task_struct_rlim; long thread_info_task; long thread_info_cpu; long thread_info_previous_esp; long thread_info_flags; long nsproxy_mnt_ns; long mnt_namespace_root; long mnt_namespace_list; long pid_link_pid; long pid_hash_chain; long hlist_node_next; long hlist_node_pprev; long pid_pid_chain; long thread_struct_eip; long thread_struct_esp; long thread_struct_ksp; long thread_struct_fph; long thread_struct_rip; long thread_struct_rsp; long thread_struct_rsp0; long tms_tms_utime; long tms_tms_stime; long signal_struct_count; long signal_struct_action; long signal_struct_shared_pending; long signal_struct_rlim; long k_sigaction_sa; long sigaction_sa_handler; long sigaction_sa_flags; long sigaction_sa_mask; long sigpending_head; long sigpending_list; long sigpending_signal; long signal_queue_next; long signal_queue_info; long sigqueue_next; long sigqueue_list; long sigqueue_info; long sighand_struct_action; long siginfo_si_signo; long thread_struct_cr3; long thread_struct_ptbr; long thread_struct_pg_tables; long switch_stack_r26; long switch_stack_b0; long switch_stack_ar_bspstore; long switch_stack_ar_pfs; long switch_stack_ar_rnat; long switch_stack_pr; long cpuinfo_ia64_proc_freq; long cpuinfo_ia64_unimpl_va_mask; long cpuinfo_ia64_unimpl_pa_mask; long device_node_type; long device_node_allnext; long device_node_properties; long property_name; long property_value; long property_next; long machdep_calls_setup_residual; long RESIDUAL_VitalProductData; long VPD_ProcessorHz; long bd_info_bi_intfreq; long hwrpb_struct_cycle_freq; long hwrpb_struct_processor_offset; long hwrpb_struct_processor_size; long percpu_struct_halt_PC; long percpu_struct_halt_ra; long percpu_struct_halt_pv; long mm_struct_mmap; long mm_struct_pgd; long mm_struct_rss; long mm_struct_anon_rss; long mm_struct_file_rss; long mm_struct_total_vm; long mm_struct_start_code; long mm_struct_arg_start; long mm_struct_arg_end; long mm_struct_env_start; long mm_struct_env_end; long vm_area_struct_vm_mm; long vm_area_struct_vm_next; long vm_area_struct_vm_end; long vm_area_struct_vm_start; long vm_area_struct_vm_flags; long vm_area_struct_vm_file; long vm_area_struct_vm_offset; long vm_area_struct_vm_pgoff; long vm_struct_addr; long vm_struct_size; long vm_struct_next; long module_size_of_struct; long module_next; long module_size; long module_name; long module_nsyms; long module_syms; long module_flags; long module_num_syms; long module_list; long module_gpl_syms; long module_num_gpl_syms; long module_module_core; long module_core_size; long module_core_text_size; long module_num_symtab; long module_symtab; long module_strtab; long module_kallsyms_start; long kallsyms_header_sections; long kallsyms_header_section_off; long kallsyms_header_symbols; long kallsyms_header_symbol_off; long kallsyms_header_string_off; long kallsyms_symbol_section_off; long kallsyms_symbol_symbol_addr; long kallsyms_symbol_name_off; long kallsyms_section_start; long kallsyms_section_size; long kallsyms_section_name_off; long page_next; long page_prev; long page_next_hash; long page_list; long page_list_next; long page_list_prev; long page_inode; long page_offset; long page_count; long page_flags; long page_mapping; long page_index; long page_buffers; long page_lru; long page_pte; long swap_info_struct_swap_file; long swap_info_struct_swap_vfsmnt; long swap_info_struct_flags; long swap_info_struct_swap_map; long swap_info_struct_swap_device; long swap_info_struct_prio; long swap_info_struct_max; long swap_info_struct_pages; long swap_info_struct_old_block_size; long block_device_bd_inode; long block_device_bd_list; long block_device_bd_disk; long irq_desc_t_status; long irq_desc_t_handler; long irq_desc_t_chip; long irq_desc_t_action; long irq_desc_t_depth; long irqdesc_action; long irqdesc_ctl; long irqdesc_level; long irqaction_handler; long irqaction_flags; long irqaction_mask; long irqaction_name; long irqaction_dev_id; long irqaction_next; long hw_interrupt_type_typename; long hw_interrupt_type_startup; long hw_interrupt_type_shutdown; long hw_interrupt_type_handle; long hw_interrupt_type_enable; long hw_interrupt_type_disable; long hw_interrupt_type_ack; long hw_interrupt_type_end; long hw_interrupt_type_set_affinity; long irq_chip_typename; long irq_chip_startup; long irq_chip_shutdown; long irq_chip_enable; long irq_chip_disable; long irq_chip_ack; long irq_chip_end; long irq_chip_set_affinity; long irq_chip_mask; long irq_chip_mask_ack; long irq_chip_unmask; long irq_chip_eoi; long irq_chip_retrigger; long irq_chip_set_type; long irq_chip_set_wake; long irq_cpustat_t___softirq_active; long irq_cpustat_t___softirq_mask; long fdtable_max_fds; long fdtable_max_fdset; long fdtable_open_fds; long fdtable_fd; long files_struct_fdt; long files_struct_max_fds; long files_struct_max_fdset; long files_struct_open_fds; long files_struct_fd; long files_struct_open_fds_init; long file_f_dentry; long file_f_vfsmnt; long file_f_count; long file_f_path; long path_mnt; long path_dentry; long fs_struct_root; long fs_struct_pwd; long fs_struct_rootmnt; long fs_struct_pwdmnt; long dentry_d_inode; long dentry_d_parent; long dentry_d_name; long dentry_d_covers; long dentry_d_iname; long qstr_len; long qstr_name; long inode_i_mode; long inode_i_op; long inode_i_sb; long inode_u; long inode_i_flock; long inode_i_fop; long inode_i_mapping; long address_space_nrpages; long vfsmount_mnt_next; long vfsmount_mnt_devname; long vfsmount_mnt_dirname; long vfsmount_mnt_sb; long vfsmount_mnt_list; long vfsmount_mnt_mountpoint; long vfsmount_mnt_parent; long namespace_root; long namespace_list; long super_block_s_dirty; long super_block_s_type; long super_block_s_files; long file_system_type_name; long nlm_file_f_file; long file_lock_fl_owner; long nlm_host_h_exportent; long svc_client_cl_ident; long kmem_cache_s_c_nextp; long kmem_cache_s_c_name; long kmem_cache_s_c_num; long kmem_cache_s_c_org_size; long kmem_cache_s_c_flags; long kmem_cache_s_c_offset; long kmem_cache_s_c_firstp; long kmem_cache_s_c_gfporder; long kmem_cache_s_c_magic; long kmem_cache_s_num; long kmem_cache_s_next; long kmem_cache_s_name; long kmem_cache_s_objsize; long kmem_cache_s_flags; long kmem_cache_s_gfporder; long kmem_cache_s_slabs; long kmem_cache_s_slabs_full; long kmem_cache_s_slabs_partial; long kmem_cache_s_slabs_free; long kmem_cache_s_cpudata; long kmem_cache_s_c_align; long kmem_cache_s_colour_off; long cpucache_s_avail; long cpucache_s_limit; long kmem_cache_s_array; long array_cache_avail; long array_cache_limit; long kmem_cache_s_lists; long kmem_list3_slabs_partial; long kmem_list3_slabs_full; long kmem_list3_slabs_free; long kmem_list3_free_objects; long kmem_list3_shared; long kmem_slab_s_s_nextp; long kmem_slab_s_s_freep; long kmem_slab_s_s_inuse; long kmem_slab_s_s_mem; long kmem_slab_s_s_index; long kmem_slab_s_s_offset; long kmem_slab_s_s_magic; long slab_s_list; long slab_s_s_mem; long slab_s_inuse; long slab_s_free; long slab_list; long slab_s_mem; long slab_inuse; long slab_free; long net_device_next; long net_device_name; long net_device_type; long net_device_addr_len; long net_device_ip_ptr; long net_device_dev_list; long net_dev_base_head; long device_next; long device_name; long device_type; long device_ip_ptr; long device_addr_len; long socket_sk; long sock_daddr; long sock_rcv_saddr; long sock_dport; long sock_sport; long sock_num; long sock_type; long sock_family; long sock_common_skc_family; long sock_sk_type; long inet_sock_inet; long inet_opt_daddr; long inet_opt_rcv_saddr; long inet_opt_dport; long inet_opt_sport; long inet_opt_num; long ipv6_pinfo_rcv_saddr; long ipv6_pinfo_daddr; long timer_list_list; long timer_list_next; long timer_list_entry; long timer_list_expires; long timer_list_function; long timer_vec_root_vec; long timer_vec_vec; long tvec_root_s_vec; long tvec_s_vec; long tvec_t_base_s_tv1; long wait_queue_task; long wait_queue_next; long __wait_queue_task; long __wait_queue_head_task_list; long __wait_queue_task_list; long pglist_data_node_zones; long pglist_data_node_mem_map; long pglist_data_node_start_paddr; long pglist_data_node_start_mapnr; long pglist_data_node_size; long pglist_data_node_id; long pglist_data_node_next; long pglist_data_nr_zones; long pglist_data_node_start_pfn; long pglist_data_pgdat_next; long pglist_data_node_present_pages; long pglist_data_node_spanned_pages; long pglist_data_bdata; long page_cache_bucket_chain; long zone_struct_free_pages; long zone_struct_free_area; long zone_struct_zone_pgdat; long zone_struct_name; long zone_struct_size; long zone_struct_memsize; long zone_struct_zone_start_pfn; long zone_struct_zone_start_paddr; long zone_struct_zone_start_mapnr; long zone_struct_zone_mem_map; long zone_struct_inactive_clean_pages; long zone_struct_inactive_clean_list; long zone_struct_inactive_dirty_pages; long zone_struct_active_pages; long zone_struct_pages_min; long zone_struct_pages_low; long zone_struct_pages_high; long zone_free_pages; long zone_free_area; long zone_zone_pgdat; long zone_zone_mem_map; long zone_name; long zone_spanned_pages; long zone_zone_start_pfn; long zone_pages_min; long zone_pages_low; long zone_pages_high; long zone_vm_stat; long neighbour_next; long neighbour_primary_key; long neighbour_ha; long neighbour_dev; long neighbour_nud_state; long neigh_table_hash_buckets; long neigh_table_key_len; long in_device_ifa_list; long in_ifaddr_ifa_next; long in_ifaddr_ifa_address; long pci_dev_global_list; long pci_dev_next; long pci_dev_bus; long pci_dev_devfn; long pci_dev_class; long pci_dev_device; long pci_dev_vendor; long pci_bus_number; long resource_entry_t_from; long resource_entry_t_num; long resource_entry_t_name; long resource_entry_t_next; long resource_name; long resource_start; long resource_end; long resource_sibling; long resource_child; long runqueue_curr; long runqueue_idle; long runqueue_active; long runqueue_expired; long runqueue_arrays; long runqueue_cpu; long cpu_s_idle; long cpu_s_curr; long prio_array_nr_active; long prio_array_queue; long user_regs_struct_ebp; long user_regs_struct_esp; long user_regs_struct_rip; long user_regs_struct_cs; long user_regs_struct_eflags; long user_regs_struct_rsp; long user_regs_struct_ss; long e820map_nr_map; long e820entry_addr; long e820entry_size; long e820entry_type; long char_device_struct_next; long char_device_struct_name; long char_device_struct_fops; long char_device_struct_major; long gendisk_major; long gendisk_disk_name; long gendisk_fops; long blk_major_name_next; long blk_major_name_major; long blk_major_name_name; long radix_tree_root_height; long radix_tree_root_rnode; long x8664_pda_pcurrent; long x8664_pda_data_offset; long x8664_pda_kernelstack; long x8664_pda_irqrsp; long x8664_pda_irqstackptr; long x8664_pda_level4_pgt; long x8664_pda_cpunumber; long x8664_pda_me; long tss_struct_ist; long mem_section_section_mem_map; long vcpu_guest_context_user_regs; long cpu_user_regs_eip; long cpu_user_regs_esp; long cpu_user_regs_rip; long cpu_user_regs_rsp; long unwind_table_core; long unwind_table_init; long unwind_table_address; long unwind_table_size; long unwind_table_link; long unwind_table_name; long rq_cfs; long rq_rt; long rq_nr_running; long cfs_rq_rb_leftmost; long cfs_rq_nr_running; long cfs_rq_tasks_timeline; long task_struct_se; long sched_entity_run_node; long rt_rq_active; long kmem_cache_size; long kmem_cache_objsize; long kmem_cache_offset; long kmem_cache_order; long kmem_cache_local_node; long kmem_cache_objects; long kmem_cache_inuse; long kmem_cache_align; long kmem_cache_name; long kmem_cache_list; long kmem_cache_node; long kmem_cache_cpu_slab; long page_inuse; /* long page_offset; use "old" page->offset */ long page_slab; long page_first_page; long page_freelist; long kmem_cache_node_nr_partial; long kmem_cache_node_nr_slabs; long kmem_cache_node_partial; long kmem_cache_node_full; long pid_numbers; long upid_nr; long upid_ns; long upid_pid_chain; long pid_tasks; long kmem_cache_cpu_freelist; long kmem_cache_cpu_page; long kmem_cache_cpu_node; long kmem_cache_flags; long zone_nr_active; long zone_nr_inactive; long zone_all_unreclaimable; long zone_present_pages; long zone_flags; long zone_pages_scanned; long pcpu_info_vcpu; long pcpu_info_idle; long vcpu_struct_rq; long task_struct_sched_info; long sched_info_last_arrival; long page_objects; long kmem_cache_oo; long char_device_struct_cdev; long char_device_struct_baseminor; long cdev_ops; long probe_next; long probe_dev; long probe_data; long kobj_map_probes; long task_struct_prio; long zone_watermark; long module_sect_attrs; long module_sect_attrs_attrs; long module_sect_attrs_nsections; long module_sect_attr_mattr; long module_sect_attr_name; long module_sect_attr_address; long module_attribute_attr; long attribute_owner; long module_sect_attr_attr; long module_sections_attrs; long swap_info_struct_inuse_pages; long s390_lowcore_psw_save_area; long mm_struct_rss_stat; long mm_rss_stat_count; long module_module_init; long module_init_text_size; long cpu_context_save_fp; long cpu_context_save_sp; long cpu_context_save_pc; long elf_prstatus_pr_pid; long elf_prstatus_pr_reg; long irq_desc_t_name; long thread_info_cpu_context; long unwind_table_list; long unwind_table_start; long unwind_table_stop; long unwind_table_begin_addr; long unwind_table_end_addr; long unwind_idx_addr; long unwind_idx_insn; long signal_struct_nr_threads; long module_init_size; long module_percpu; long radix_tree_node_slots; long s390_stack_frame_back_chain; long s390_stack_frame_r14; long user_regs_struct_eip; long user_regs_struct_rax; long user_regs_struct_eax; long user_regs_struct_rbx; long user_regs_struct_ebx; long user_regs_struct_rcx; long user_regs_struct_ecx; long user_regs_struct_rdx; long user_regs_struct_edx; long user_regs_struct_rsi; long user_regs_struct_esi; long user_regs_struct_rdi; long user_regs_struct_edi; long user_regs_struct_ds; long user_regs_struct_es; long user_regs_struct_fs; long user_regs_struct_gs; long user_regs_struct_rbp; long user_regs_struct_r8; long user_regs_struct_r9; long user_regs_struct_r10; long user_regs_struct_r11; long user_regs_struct_r12; long user_regs_struct_r13; long user_regs_struct_r14; long user_regs_struct_r15; long sched_entity_cfs_rq; long sched_entity_my_q; long sched_entity_on_rq; long task_struct_on_rq; long cfs_rq_curr; long irq_desc_t_irq_data; long irq_desc_t_kstat_irqs; long irq_desc_t_affinity; long irq_data_chip; long irq_data_affinity; long kernel_stat_irqs; long socket_alloc_vfs_inode; long class_devices; long class_p; long class_private_devices; long device_knode_class; long device_node; long gendisk_dev; long gendisk_kobj; long gendisk_part0; long gendisk_queue; long hd_struct_dev; long klist_k_list; long klist_node_n_klist; long klist_node_n_node; long kobject_entry; long kset_list; long request_list_count; long request_queue_in_flight; long request_queue_rq; long subsys_private_klist_devices; long subsystem_kset; long mount_mnt_parent; long mount_mnt_mountpoint; long mount_mnt_list; long mount_mnt_devname; long mount_mnt; long task_struct_exit_state; long timekeeper_xtime; long file_f_op; long file_private_data; long hstate_order; long hugetlbfs_sb_info_hstate; long idr_layer_ary; long idr_layer_layer; long idr_layers; long idr_top; long ipc_id_ary_p; long ipc_ids_entries; long ipc_ids_max_id; long ipc_ids_ipcs_idr; long ipc_ids_in_use; long ipc_namespace_ids; long kern_ipc_perm_deleted; long kern_ipc_perm_key; long kern_ipc_perm_mode; long kern_ipc_perm_uid; long kern_ipc_perm_id; long kern_ipc_perm_seq; long nsproxy_ipc_ns; long shmem_inode_info_swapped; long shmem_inode_info_vfs_inode; long shm_file_data_file; long shmid_kernel_shm_file; long shmid_kernel_shm_nattch; long shmid_kernel_shm_perm; long shmid_kernel_shm_segsz; long shmid_kernel_id; long sem_array_sem_perm; long sem_array_sem_id; long sem_array_sem_nsems; long msg_queue_q_perm; long msg_queue_q_id; long msg_queue_q_cbytes; long msg_queue_q_qnum; long super_block_s_fs_info; long rq_timestamp; long radix_tree_node_height; long rb_root_rb_node; long rb_node_rb_left; long rb_node_rb_right; long rt_prio_array_queue; long task_struct_rt; long sched_rt_entity_run_list; long log_ts_nsec; long log_len; long log_text_len; long log_dict_len; long log_level; long log_flags_level; long timekeeper_xtime_sec; long neigh_table_hash_mask; long sched_rt_entity_my_q; long neigh_table_hash_shift; long neigh_table_nht_ptr; long task_group_parent; long task_group_css; long cgroup_subsys_state_cgroup; long cgroup_dentry; long task_group_rt_rq; long rt_rq_tg; long task_group_cfs_rq; long cfs_rq_tg; long task_group_siblings; long task_group_children; long task_group_cfs_bandwidth; long cfs_rq_throttled; long task_group_rt_bandwidth; long rt_rq_rt_throttled; long rt_rq_highest_prio; long rt_rq_rt_nr_running; long vmap_area_va_start; long vmap_area_va_end; long vmap_area_list; long vmap_area_flags; long vmap_area_vm; long hrtimer_cpu_base_clock_base; long hrtimer_clock_base_offset; long hrtimer_clock_base_active; long hrtimer_clock_base_first; long hrtimer_clock_base_get_time; long hrtimer_base_first; long hrtimer_base_pending; long hrtimer_base_get_time; long hrtimer_node; long hrtimer_list; long hrtimer_softexpires; long hrtimer_expires; long hrtimer_function; long timerqueue_head_next; long timerqueue_node_expires; long timerqueue_node_node; long ktime_t_tv64; long ktime_t_sec; long ktime_t_nsec; long module_taints; long module_gpgsig_ok; long module_license_gplok; long tnt_bit; long tnt_true; long tnt_false; long task_struct_thread_context_fp; long task_struct_thread_context_sp; long task_struct_thread_context_pc; long page_slab_page; long trace_print_flags_mask; long trace_print_flags_name; long task_struct_rss_stat; long task_rss_stat_count; long page_s_mem; long page_active; }; struct size_table { /* stash of commonly-used sizes */ long page; long free_area_struct; long zone_struct; long free_area; long zone; long kmem_slab_s; long kmem_cache_s; long kmem_bufctl_t; long slab_s; long slab; long cpucache_s; long array_cache; long swap_info_struct; long mm_struct; long vm_area_struct; long pglist_data; long page_cache_bucket; long pt_regs; long task_struct; long thread_info; long softirq_state; long desc_struct; long umode_t; long dentry; long files_struct; long fdtable; long fs_struct; long file; long inode; long vfsmount; long super_block; long irqdesc; long module; long list_head; long hlist_node; long hlist_head; long irq_cpustat_t; long cpuinfo_x86; long cpuinfo_ia64; long timer_list; long timer_vec_root; long timer_vec; long tvec_root_s; long tvec_s; long tvec_t_base_s; long wait_queue; long __wait_queue; long device; long net_device; long sock; long signal_struct; long sigpending_signal; long signal_queue; long sighand_struct; long sigqueue; long k_sigaction; long resource_entry_t; long resource; long runqueue; long irq_desc_t; long task_union; long thread_union; long prio_array; long user_regs_struct; long switch_stack; long vm_area_struct_vm_flags; long e820map; long e820entry; long cpu_s; long pgd_t; long kallsyms_header; long kallsyms_symbol; long kallsyms_section; long irq_ctx; long block_device; long blk_major_name; long gendisk; long address_space; long char_device_struct; long inet_sock; long in6_addr; long socket; long spinlock_t; long radix_tree_root; long radix_tree_node; long x8664_pda; long ppc64_paca; long gate_struct; long tss_struct; long task_struct_start_time; long cputime_t; long mem_section; long pid_link; long unwind_table; long rlimit; long kmem_cache; long kmem_cache_node; long upid; long kmem_cache_cpu; long cfs_rq; long pcpu_info; long vcpu_struct; long cdev; long probe; long kobj_map; long page_flags; long module_sect_attr; long task_struct_utime; long task_struct_stime; long cpu_context_save; long elf_prstatus; long note_buf; long unwind_idx; long softirq_action; long irq_data; long s390_stack_frame; long percpu_data; long sched_entity; long kernel_stat; long subsystem; long class_private; long rq_in_flight; long class_private_devices; long mount; long hstate; long ipc_ids; long shmid_kernel; long sem_array; long msg_queue; long log; long log_level; long rt_rq; long task_group; long vmap_area; long hrtimer_clock_base; long hrtimer_base; long tnt; long trace_print_flags; }; struct array_table { int kmem_cache_s_name; int kmem_cache_s_c_name; int kmem_cache_s_array; int kmem_cache_s_cpudata; int irq_desc; int irq_action; int log_buf; int timer_vec_vec; int timer_vec_root_vec; int tvec_s_vec; int tvec_root_s_vec; int page_hash_table; int net_device_name; int neigh_table_hash_buckets; int neighbour_ha; int swap_info; int pglist_data_node_zones; int zone_struct_free_area; int zone_free_area; int free_area; int free_area_DIMENSION; int prio_array_queue; int height_to_maxindex; int pid_hash; int kmem_cache_node; int kmem_cache_cpu_slab; int rt_prio_array_queue; }; /* * The following set of macros use gdb to determine structure, union, * or member sizes/offsets. They should be used only during initialization * of the offset_table or size_table, or with data structures whose names * or members are only known/specified during runtime. */ #define MEMBER_SIZE_REQUEST ((struct datatype_member *)(-1)) #define ANON_MEMBER_OFFSET_REQUEST ((struct datatype_member *)(-2)) #define MEMBER_TYPE_REQUEST ((struct datatype_member *)(-3)) #define STRUCT_SIZE_REQUEST ((struct datatype_member *)(-4)) #define STRUCT_SIZE(X) datatype_info((X), NULL, STRUCT_SIZE_REQUEST) #define UNION_SIZE(X) datatype_info((X), NULL, STRUCT_SIZE_REQUEST) #define STRUCT_EXISTS(X) (datatype_info((X), NULL, STRUCT_SIZE_REQUEST) >= 0) #define DATATYPE_SIZE(X) datatype_info((X)->name, NULL, (X)) #define MEMBER_OFFSET(X,Y) datatype_info((X), (Y), NULL) #define MEMBER_EXISTS(X,Y) (datatype_info((X), (Y), NULL) >= 0) #define MEMBER_SIZE(X,Y) datatype_info((X), (Y), MEMBER_SIZE_REQUEST) #define MEMBER_TYPE(X,Y) datatype_info((X), (Y), MEMBER_TYPE_REQUEST) #define ANON_MEMBER_OFFSET(X,Y) datatype_info((X), (Y), ANON_MEMBER_OFFSET_REQUEST) /* * The following set of macros can only be used with pre-intialized fields * in the offset table, size table or array_table. */ #define OFFSET(X) (OFFSET_verify(offset_table.X, (char *)__FUNCTION__, __FILE__, __LINE__, #X)) #define SIZE(X) (SIZE_verify(size_table.X, (char *)__FUNCTION__, __FILE__, __LINE__, #X)) #define INVALID_OFFSET (-1) #define INVALID_MEMBER(X) (offset_table.X == INVALID_OFFSET) #define INVALID_SIZE(X) (size_table.X == -1) #define VALID_SIZE(X) (size_table.X >= 0) #define VALID_STRUCT(X) (size_table.X >= 0) #define VALID_MEMBER(X) (offset_table.X >= 0) #define ARRAY_LENGTH(X) (array_table.X) #define ASSIGN_OFFSET(X) (offset_table.X) #define ASSIGN_SIZE(X) (size_table.X) #define OFFSET_OPTION(X,Y) (OFFSET_option(offset_table.X, offset_table.Y, (char *)__FUNCTION__, __FILE__, __LINE__, #X, #Y)) #define SIZE_OPTION(X,Y) (SIZE_option(size_table.X, size_table.Y, (char *)__FUNCTION__, __FILE__, __LINE__, #X, #Y)) #define MEMBER_OFFSET_INIT(X, Y, Z) (ASSIGN_OFFSET(X) = MEMBER_OFFSET(Y, Z)) #define STRUCT_SIZE_INIT(X, Y) (ASSIGN_SIZE(X) = STRUCT_SIZE(Y)) #define ARRAY_LENGTH_INIT(A, B, C, D, E) ((A) = get_array_length(C, D, E)) #define ARRAY_LENGTH_INIT_ALT(A, B, C, D, E) ((A) = get_array_length_alt(B, C, D, E)) #define MEMBER_SIZE_INIT(X, Y, Z) (ASSIGN_SIZE(X) = MEMBER_SIZE(Y, Z)) #define ANON_MEMBER_OFFSET_INIT(X, Y, Z) (ASSIGN_OFFSET(X) = ANON_MEMBER_OFFSET(Y, Z)) /* * For use with non-debug kernels. */ struct builtin_debug_table { char *release; char *machine_type; struct offset_table *offset_table; struct size_table *size_table; struct array_table *array_table; }; /* * Facilitators for pulling correctly-sized data out of a buffer at a * known address. */ #define INT(ADDR) *((int *)((char *)(ADDR))) #define UINT(ADDR) *((uint *)((char *)(ADDR))) #define LONG(ADDR) *((long *)((char *)(ADDR))) #define ULONG(ADDR) *((ulong *)((char *)(ADDR))) #define ULONGLONG(ADDR) *((ulonglong *)((char *)(ADDR))) #define ULONG_PTR(ADDR) *((ulong **)((char *)(ADDR))) #define USHORT(ADDR) *((ushort *)((char *)(ADDR))) #define SHORT(ADDR) *((short *)((char *)(ADDR))) #define UCHAR(ADDR) *((unsigned char *)((char *)(ADDR))) #define VOID_PTR(ADDR) *((void **)((char *)(ADDR))) struct node_table { int node_id; ulong pgdat; ulong mem_map; ulong size; ulong present; ulonglong start_paddr; ulong start_mapnr; }; struct meminfo; struct slab_data; #define VMA_CACHE (20) struct vm_table { /* kernel VM-related data */ ulong flags; ulong kernel_pgd[NR_CPUS]; ulong high_memory; ulong vmalloc_start; ulong mem_map; long total_pages; ulong totalram_pages; ulong totalhigh_pages; ulong num_physpages; ulong max_mapnr; ulong kmem_max_c_num; ulong kmem_max_limit; ulong kmem_max_cpus; ulong kmem_cache_count; ulong kmem_cache_len_nodes; ulong PG_reserved; ulong PG_slab; ulong PG_head_tail_mask; int kmem_cache_namelen; ulong page_hash_table; int page_hash_table_len; int paddr_prlen; int numnodes; int nr_zones; int nr_free_areas; struct node_table *node_table; void (*dump_free_pages)(struct meminfo *); void (*dump_kmem_cache)(struct meminfo *); struct slab_data *slab_data; uint nr_swapfiles; ulong last_swap_read; char *swap_info_struct; char *vma_cache; ulong cached_vma[VMA_CACHE]; ulong cached_vma_hits[VMA_CACHE]; int vma_cache_index; ulong vma_cache_fills; void *mem_sec; char *mem_section; int ZONE_HIGHMEM; ulong *node_online_map; int node_online_map_len; int nr_vm_stat_items; char **vm_stat_items; int cpu_slab_type; int nr_vm_event_items; char **vm_event_items; int nr_bad_slab_caches; ulong *bad_slab_caches; int nr_pageflags; struct pageflags_data { ulong mask; char *name; } *pageflags_data; }; #define NODES (0x1) #define ZONES (0x2) #define PERCPU_KMALLOC_V1 (0x4) #define COMMON_VADDR (0x8) #define KMEM_CACHE_INIT (0x10) #define V_MEM_MAP (0x20) #define PERCPU_KMALLOC_V2 (0x40) #define KMEM_CACHE_UNAVAIL (0x80) #define FLATMEM (0x100) #define DISCONTIGMEM (0x200) #define SPARSEMEM (0x400) #define SPARSEMEM_EX (0x800) #define PERCPU_KMALLOC_V2_NODES (0x1000) #define KMEM_CACHE_DELAY (0x2000) #define NODES_ONLINE (0x4000) #define VM_STAT (0x8000) #define KMALLOC_SLUB (0x10000) #define CONFIG_NUMA (0x20000) #define VM_EVENT (0x40000) #define PGCNT_ADJ (0x80000) #define VM_INIT (0x100000) #define SWAPINFO_V1 (0x200000) #define SWAPINFO_V2 (0x400000) #define NODELISTS_IS_PTR (0x800000) #define KMALLOC_COMMON (0x1000000) #define USE_VMAP_AREA (0x2000000) #define PAGEFLAGS (0x4000000) #define SLAB_OVERLOAD_PAGE (0x8000000) #define IS_FLATMEM() (vt->flags & FLATMEM) #define IS_DISCONTIGMEM() (vt->flags & DISCONTIGMEM) #define IS_SPARSEMEM() (vt->flags & SPARSEMEM) #define IS_SPARSEMEM_EX() (vt->flags & SPARSEMEM_EX) #define COMMON_VADDR_SPACE() (vt->flags & COMMON_VADDR) #define PADDR_PRLEN (vt->paddr_prlen) struct datatype_member { /* minimal definition of a structure/union */ char *name; /* and possibly a member within it */ char *member; ulong type; long size; long member_offset; long member_size; int member_typecode; ulong flags; char *tagname; /* tagname and value for enums */ long value; ulong vaddr; }; #define union_name struct_name struct list_data { /* generic structure used by do_list() to walk */ ulong flags; /* through linked lists in the kernel */ ulong start; long member_offset; long list_head_offset; ulong end; ulong searchfor; char **structname; int structname_args; char *header; ulong *list_ptr; }; #define LIST_OFFSET_ENTERED (VERBOSE << 1) #define LIST_START_ENTERED (VERBOSE << 2) #define LIST_HEAD_FORMAT (VERBOSE << 3) #define LIST_HEAD_POINTER (VERBOSE << 4) #define RETURN_ON_DUPLICATE (VERBOSE << 5) #define RETURN_ON_LIST_ERROR (VERBOSE << 6) #define LIST_STRUCT_RADIX_10 (VERBOSE << 7) #define LIST_STRUCT_RADIX_16 (VERBOSE << 8) #define LIST_HEAD_REVERSE (VERBOSE << 9) #define LIST_ALLOCATE (VERBOSE << 10) struct tree_data { ulong flags; ulong start; long node_member_offset; char **structname; int structname_args; int count; }; #define TREE_ROOT_OFFSET_ENTERED (VERBOSE << 1) #define TREE_NODE_OFFSET_ENTERED (VERBOSE << 2) #define TREE_NODE_POINTER (VERBOSE << 3) #define TREE_POSITION_DISPLAY (VERBOSE << 4) #define TREE_STRUCT_RADIX_10 (VERBOSE << 5) #define TREE_STRUCT_RADIX_16 (VERBOSE << 6) #define ALIAS_RUNTIME (1) #define ALIAS_RCLOCAL (2) #define ALIAS_RCHOME (3) #define ALIAS_BUILTIN (4) struct alias_data { /* command alias storage */ struct alias_data *next; char *alias; int argcnt; int size; int origin; char *args[MAXARGS]; char argbuf[1]; }; struct rb_node { unsigned long rb_parent_color; #define RB_RED 0 #define RB_BLACK 1 struct rb_node *rb_right; struct rb_node *rb_left; }; struct rb_root { struct rb_node *rb_node; }; #define NUMBER_STACKFRAMES 4 #define SAVE_RETURN_ADDRESS(retaddr) \ { \ int i; \ int saved_stacks; \ \ saved_stacks = backtrace((void **)retaddr, NUMBER_STACKFRAMES); \ \ /* explicitely zero out the invalid addresses */ \ for (i = saved_stacks; i < NUMBER_STACKFRAMES; i++) \ retaddr[i] = 0; \ } #endif /* !GDB_COMMON */ #define SYMBOL_NAME_USED (0x1) #define MODULE_SYMBOL (0x2) #define IS_MODULE_SYMBOL(SYM) ((SYM)->flags & MODULE_SYMBOL) struct syment { ulong value; char *name; struct syment *val_hash_next; struct syment *name_hash_next; char type; unsigned char cnt; unsigned char flags; unsigned char pad2; }; #define NAMESPACE_INIT (1) #define NAMESPACE_REUSE (2) #define NAMESPACE_FREE (3) #define NAMESPACE_INSTALL (4) #define NAMESPACE_COMPLETE (5) struct symbol_namespace { char *address; size_t size; long index; long cnt; }; #define SYMVAL_HASH (512) #define SYMVAL_HASH_INDEX(vaddr) \ (((vaddr) >> machdep->pageshift) % SYMVAL_HASH) #define SYMNAME_HASH (512) #define SYMNAME_HASH_INDEX(name) \ ((name[0] ^ (name[strlen(name)-1] * name[strlen(name)/2])) % SYMNAME_HASH) #define PATCH_KERNEL_SYMBOLS_START ((char *)(1)) #define PATCH_KERNEL_SYMBOLS_STOP ((char *)(2)) #ifndef GDB_COMMON struct symbol_table_data { ulong flags; #ifdef GDB_5_3 struct _bfd *bfd; #else struct bfd *bfd; #endif struct sec *sections; struct syment *symtable; struct syment *symend; long symcnt; ulong syment_size; struct symval_hash_chain { struct syment *val_hash_head; struct syment *val_hash_last; } symval_hash[SYMVAL_HASH]; double val_hash_searches; double val_hash_iterations; struct syment *symname_hash[SYMNAME_HASH]; struct symbol_namespace kernel_namespace; struct syment *ext_module_symtable; struct syment *ext_module_symend; long ext_module_symcnt; struct symbol_namespace ext_module_namespace; int mods_installed; struct load_module *current; struct load_module *load_modules; off_t dwarf_eh_frame_file_offset; ulong dwarf_eh_frame_size; ulong first_ksymbol; ulong __per_cpu_start; ulong __per_cpu_end; off_t dwarf_debug_frame_file_offset; ulong dwarf_debug_frame_size; ulong first_section_start; ulong last_section_end; }; /* flags for st */ #define KERNEL_SYMS (0x1) #define MODULE_SYMS (0x2) #define LOAD_MODULE_SYMS (0x4) #define INSMOD_BUILTIN (0x8) #define GDB_SYMS_PATCHED (0x10) #define GDB_PATCHED() (st->flags & GDB_SYMS_PATCHED) #define NO_SEC_LOAD (0x20) #define NO_SEC_CONTENTS (0x40) #define FORCE_DEBUGINFO (0x80) #define CRC_MATCHES (0x100) #define ADD_SYMBOL_FILE (0x200) #define USE_OLD_ADD_SYM (0x400) #define PERCPU_SYMS (0x800) #define MODSECT_UNKNOWN (0x1000) #define MODSECT_V1 (0x2000) #define MODSECT_V2 (0x4000) #define MODSECT_V3 (0x8000) #define MODSECT_VMASK (MODSECT_V1|MODSECT_V2|MODSECT_V3) #define NO_STRIP (0x10000) #define NO_LINE_NUMBERS() ((st->flags & GDB_SYMS_PATCHED) && !(kt->flags2 & KASLR)) #endif /* !GDB_COMMON */ #define ALL_MODULES (0) #define MAX_MOD_NAMELIST (256) #define MAX_MOD_NAME (64) #define MAX_MOD_SEC_NAME (64) #define MOD_EXT_SYMS (0x1) #define MOD_LOAD_SYMS (0x2) #define MOD_REMOTE (0x4) #define MOD_KALLSYMS (0x8) #define MOD_INITRD (0x10) #define MOD_NOPATCH (0x20) #define MOD_INIT (0x40) #define MOD_DO_READNOW (0x80) #define SEC_FOUND (0x10000) struct mod_section_data { #if defined(GDB_5_3) || defined(GDB_6_0) struct sec *section; #else struct bfd_section *section; #endif char name[MAX_MOD_SEC_NAME]; ulong offset; ulong size; int priority; int flags; }; struct load_module { ulong mod_base; ulong module_struct; long mod_size; char mod_namelist[MAX_MOD_NAMELIST]; char mod_name[MAX_MOD_NAME]; ulong mod_flags; struct syment *mod_symtable; struct syment *mod_symend; long mod_ext_symcnt; struct syment *mod_ext_symtable; struct syment *mod_ext_symend; long mod_load_symcnt; struct syment *mod_load_symtable; struct syment *mod_load_symend; long mod_symalloc; struct symbol_namespace mod_load_namespace; ulong mod_size_of_struct; ulong mod_text_start; ulong mod_etext_guess; ulong mod_rodata_start; ulong mod_data_start; ulong mod_bss_start; int mod_sections; struct mod_section_data *mod_section_data; ulong mod_init_text_size; ulong mod_init_module_ptr; ulong mod_init_size; struct syment *mod_init_symtable; struct syment *mod_init_symend; ulong mod_percpu; ulong mod_percpu_size; }; #define IN_MODULE(A,L) \ (((ulong)(A) >= (L)->mod_base) && ((ulong)(A) < ((L)->mod_base+(L)->mod_size))) #define IN_MODULE_INIT(A,L) \ (((ulong)(A) >= (L)->mod_init_module_ptr) && ((ulong)(A) < ((L)->mod_init_module_ptr+(L)->mod_init_size))) #define IN_MODULE_PERCPU(A,L) \ (((ulong)(A) >= (L)->mod_percpu) && ((ulong)(A) < ((L)->mod_percpu+(L)->mod_percpu_size))) #define MODULE_PERCPU_SYMS_LOADED(L) ((L)->mod_percpu && (L)->mod_percpu_size) #ifndef GDB_COMMON #define KVADDR (0x1) #define UVADDR (0x2) #define PHYSADDR (0x4) #define XENMACHADDR (0x8) #define FILEADDR (0x10) #define AMBIGUOUS (~0) #define USE_USER_PGD (UVADDR << 2) #define VERIFY_ADDR (0x8) /* vm_area_dump() flags -- must follow */ #define PRINT_INODES (0x10) /* KVADDR, UVADDR, and PHYSADDR */ #define PRINT_MM_STRUCT (0x20) #define PRINT_VMA_STRUCTS (0x40) #define PRINT_SINGLE_VMA (0x80) #define PRINT_RADIX_10 (0x100) #define PRINT_RADIX_16 (0x200) #define MIN_PAGE_SIZE (4096) #define PTOB(X) ((ulonglong)(X) << machdep->pageshift) #define BTOP(X) ((ulonglong)(X) >> machdep->pageshift) #define PAGESIZE() (machdep->pagesize) #define PAGESHIFT() (machdep->pageshift) #define PAGEOFFSET(X) (((ulong)(X)) & machdep->pageoffset) #define VIRTPAGEBASE(X) (((ulong)(X)) & (ulong)machdep->pagemask) #define PHYSPAGEBASE(X) (((physaddr_t)(X)) & (physaddr_t)machdep->pagemask) /* * Sparse memory stuff * These must follow the definitions in the kernel mmzone.h */ #define SECTION_SIZE_BITS() (machdep->section_size_bits) #define MAX_PHYSMEM_BITS() (machdep->max_physmem_bits) #define SECTIONS_SHIFT() (MAX_PHYSMEM_BITS() - SECTION_SIZE_BITS()) #define PA_SECTION_SHIFT() (SECTION_SIZE_BITS()) #define PFN_SECTION_SHIFT() (SECTION_SIZE_BITS() - PAGESHIFT()) #define NR_MEM_SECTIONS() (1UL << SECTIONS_SHIFT()) #define PAGES_PER_SECTION() (1UL << PFN_SECTION_SHIFT()) #define PAGE_SECTION_MASK() (~(PAGES_PER_SECTION()-1)) #define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT()) #define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT()) #define SECTIONS_PER_ROOT() (machdep->sections_per_root) /* CONFIG_SPARSEMEM_EXTREME */ #define _SECTIONS_PER_ROOT_EXTREME() (PAGESIZE() / SIZE(mem_section)) /* !CONFIG_SPARSEMEM_EXTREME */ #define _SECTIONS_PER_ROOT() (1) #define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT()) #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) #define NR_SECTION_ROOTS() (DIV_ROUND_UP(NR_MEM_SECTIONS(), SECTIONS_PER_ROOT())) #define SECTION_ROOT_MASK() (SECTIONS_PER_ROOT() - 1) /* * Machine specific stuff */ #ifdef ARM #define _32BIT_ #define MACHINE_TYPE "ARM" #define PAGEBASE(X) (((ulong)(X)) & (ulong)machdep->pagemask) #define PTOV(X) \ ((unsigned long)(X)-(machdep->machspec->phys_base)+(machdep->kvbase)) #define VTOP(X) \ ((unsigned long)(X)-(machdep->kvbase)+(machdep->machspec->phys_base)) #define IS_VMALLOC_ADDR(X) arm_is_vmalloc_addr((ulong)(X)) #define DEFAULT_MODULES_VADDR (machdep->kvbase - 16 * 1024 * 1024) #define MODULES_VADDR (machdep->machspec->modules_vaddr) #define MODULES_END (machdep->machspec->modules_end) #define VMALLOC_START (machdep->machspec->vmalloc_start_addr) #define VMALLOC_END (machdep->machspec->vmalloc_end) #define PGDIR_SHIFT (21) #define PTRS_PER_PTE (512) #define PTRS_PER_PGD (2048) #define PGD_OFFSET(vaddr) ((vaddr) >> PGDIR_SHIFT) #define PTE_OFFSET(vaddr) (((vaddr) >> PAGESHIFT()) & (PTRS_PER_PTE - 1)) #define __SWP_TYPE_SHIFT 3 #define __SWP_TYPE_BITS 6 #define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1) #define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) #define SWP_TYPE(entry) (((entry) >> __SWP_TYPE_SHIFT) & __SWP_TYPE_MASK) #define SWP_OFFSET(entry) ((entry) >> __SWP_OFFSET_SHIFT) #define __swp_type(entry) SWP_TYPE(entry) #define __swp_offset(entry) SWP_OFFSET(entry) #define TIF_SIGPENDING (2) #define _SECTION_SIZE_BITS 28 #define _MAX_PHYSMEM_BITS 32 #endif /* ARM */ #ifndef EM_AARCH64 #define EM_AARCH64 183 #endif #ifdef ARM64 #define _64BIT_ #define MACHINE_TYPE "ARM64" #define PTOV(X) \ ((unsigned long)(X)-(machdep->machspec->phys_offset)+(machdep->kvbase)) #define VTOP(X) \ ((unsigned long)(X)-(machdep->kvbase)+(machdep->machspec->phys_offset)) #define USERSPACE_TOP (machdep->machspec->userspace_top) #define PAGE_OFFSET (machdep->machspec->page_offset) #define VMALLOC_START (machdep->machspec->vmalloc_start_addr) #define VMALLOC_END (machdep->machspec->vmalloc_end) #define VMEMMAP_VADDR (machdep->machspec->vmemmap_vaddr) #define VMEMMAP_END (machdep->machspec->vmemmap_end) #define MODULES_VADDR (machdep->machspec->modules_vaddr) #define MODULES_END (machdep->machspec->modules_end) #define IS_VMALLOC_ADDR(X) arm64_IS_VMALLOC_ADDR((ulong)(X)) #define PAGEBASE(X) (((ulong)(X)) & (ulong)machdep->pagemask) /* * 40-bit physical address supported. (512GB) */ #define PHYS_MASK_SHIFT (40) #define PHYS_MASK (((1UL) << PHYS_MASK_SHIFT) - 1) typedef signed int s32; /* * 3-levels / 4K pages */ #define PTRS_PER_PGD_L3_4K (512) #define PTRS_PER_PMD_L3_4K (512) #define PTRS_PER_PTE_L3_4K (512) #define PGDIR_SHIFT_L3_4K (30) #define PGDIR_SIZE_L3_4K ((1UL) << PGDIR_SHIFT_L3_4K) #define PGDIR_MASK_L3 4K (~(PGDIR_SIZE_L3_4K-1)) #define PMD_SHIFT_L3_4K (21) #define PMD_SIZE_L3_4K (1UL << PMD_SHIFT_4K) #define PMD_MASK_L3 4K (~(PMD_SIZE_4K-1)) /* * 2-levels / 64K pages */ #define PTRS_PER_PGD_L2_64K (1024) #define PTRS_PER_PTE_L2_64K (8192) #define PGDIR_SHIFT_L2_64K (29) #define PGDIR_SIZE_L2_64K ((1UL) << PGDIR_SHIFT_L2_64K) #define PGDIR_MASK_L2_64K (~(PGDIR_SIZE_L2_64K-1)) /* * Software defined PTE bits definition. * (arch/arm64/include/asm/pgtable.h) */ #define PTE_VALID (1UL << 0) #define PTE_PROT_NONE (1UL << 1) /* only when !PTE_VALID */ #define PTE_FILE (1UL << 2) /* only when !pte_present() */ #define PTE_DIRTY (1UL << 55) #define PTE_SPECIAL (1UL << 56) /* * HugeTLB/THP 3.10 support proposal swaps PTE_PROT_NONE * and PTE_FILE bit positions: */ #define PTE_FILE_3_10 (1UL << 1) #define PTE_PROT_NONE_3_10 (1UL << 2) /* * Level 3 descriptor (PTE). * (arch/arm64/include/asm/pgtable-hwdef.h) */ #define PTE_TYPE_MASK (3UL << 0) #define PTE_TYPE_FAULT (0UL << 0) #define PTE_TYPE_PAGE (3UL << 0) #define PTE_USER (1UL << 6) /* AP[1] */ #define PTE_RDONLY (1UL << 7) /* AP[2] */ #define PTE_SHARED (3UL << 8) /* SH[1:0], inner shareable */ #define PTE_AF (1UL << 10) /* Access Flag */ #define PTE_NG (1UL << 11) /* nG */ #define PTE_PXN (1UL << 53) /* Privileged XN */ #define PTE_UXN (1UL << 54) /* User XN */ /* * swap entry: * bits 0-1: present (must be zero) * bit 2: PTE_FILE * bits 3-8: swap type * bits 9-63: swap offset * * HugeTLB/THP 3.10 support proposal swaps PTE_PROT_NONE * and PTE_FILE bit positions: * * bits 0, 2: present (must both be zero) * bit 1: PTE_FILE * bits 3-8: swap type * bits 9-63: swap offset */ #define __SWP_TYPE_SHIFT 3 #define __SWP_TYPE_BITS 6 #define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1) #define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) #define __swp_type(x) (((x) >> __SWP_TYPE_SHIFT) & __SWP_TYPE_MASK) #define __swp_offset(x) ((x) >> __SWP_OFFSET_SHIFT) #define SWP_TYPE(x) __swp_type(x) #define SWP_OFFSET(x) __swp_offset(x) #define KSYMS_START (0x1) #define PHYS_OFFSET (0x2) #define VM_L2_64K (0x4) #define VM_L3_4K (0x8) /* * source: Documentation/arm64/memory.txt */ #define ARM64_USERSPACE_TOP (0x0000007fffffffffUL) #define ARM64_VMALLOC_START (0xffffff8000000000UL) #define ARM64_VMALLOC_END (0xffffffbbfffeffffUL) #define ARM64_VMEMMAP_VADDR (0xffffffbc00000000UL) #define ARM64_VMEMMAP_END (0xffffffbffbbfffffUL) #define ARM64_MODULES_VADDR (0xffffffbffc000000UL) #define ARM64_MODULES_END (0xffffffbfffffffffUL) #define ARM64_PAGE_OFFSET (0xffffffc000000000UL) #define ARM64_STACK_SIZE (8192) #define _SECTION_SIZE_BITS 30 #define _MAX_PHYSMEM_BITS 40 typedef unsigned long long __u64; typedef unsigned long long u64; struct arm64_user_pt_regs { __u64 regs[31]; __u64 sp; __u64 pc; __u64 pstate; }; struct arm64_pt_regs { union { struct arm64_user_pt_regs user_regs; struct { u64 regs[31]; u64 sp; u64 pc; u64 pstate; }; }; u64 orig_x0; u64 syscallno; }; #define TIF_SIGPENDING (0) #define display_idt_table() \ error(FATAL, "-d option is not applicable to ARM64 architecture\n") struct machine_specific { ulong flags; ulong userspace_top; ulong page_offset; ulong vmalloc_start_addr; ulong vmalloc_end; ulong vmemmap_vaddr; ulong vmemmap_end; ulong modules_vaddr; ulong modules_end; ulong phys_offset; ulong __exception_text_start; ulong __exception_text_end; struct arm64_pt_regs *panic_task_regs; ulong pte_protnone; ulong pte_file; }; struct arm64_stackframe { unsigned long fp; unsigned long sp; unsigned long pc; }; #endif /* ARM64 */ #ifdef X86 #define _32BIT_ #define MACHINE_TYPE "X86" #define PTOV(X) ((unsigned long)(X)+(machdep->kvbase)) #define VTOP(X) ((unsigned long)(X)-(machdep->kvbase)) #define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start) #define KVBASE_MASK (0x1ffffff) #define PGDIR_SHIFT_2LEVEL (22) #define PTRS_PER_PTE_2LEVEL (1024) #define PTRS_PER_PGD_2LEVEL (1024) #define PGDIR_SHIFT_3LEVEL (30) #define PTRS_PER_PTE_3LEVEL (512) #define PTRS_PER_PGD_3LEVEL (4) #define PMD_SHIFT (21) /* only used by PAE translators */ #define PTRS_PER_PMD (512) /* only used by PAE translators */ #define _PAGE_PRESENT 0x001 #define _PAGE_RW 0x002 #define _PAGE_USER 0x004 #define _PAGE_PWT 0x008 #define _PAGE_PCD 0x010 #define _PAGE_ACCESSED 0x020 #define _PAGE_DIRTY 0x040 #define _PAGE_4M 0x080 /* 4 MB page, Pentium+, if present.. */ #define _PAGE_PSE 0x080 /* 4 MB (or 2MB) page, Pentium+, if present.. */ #define _PAGE_GLOBAL 0x100 /* Global TLB entry PPro+ */ #define _PAGE_PROTNONE (machdep->machspec->page_protnone) #define _PAGE_NX (0x8000000000000000ULL) #define NONPAE_PAGEBASE(X) (((unsigned long)(X)) & (unsigned long)machdep->pagemask) #define NX_BIT_MASK (0x7fffffffffffffffULL) #define PAE_PAGEBASE(X) (((unsigned long long)(X)) & ((unsigned long long)machdep->pagemask) & NX_BIT_MASK) #define SWP_TYPE(entry) (((entry) >> 1) & 0x3f) #define SWP_OFFSET(entry) ((entry) >> 8) #define __swp_type_PAE(entry) (((entry) >> 32) & 0x1f) #define __swp_type_nonPAE(entry) (((entry) >> 1) & 0x1f) #define __swp_offset_PAE(entry) (((entry) >> 32) >> 5) #define __swp_offset_nonPAE(entry) ((entry) >> 8) #define __swp_type(entry) (machdep->flags & PAE ? \ __swp_type_PAE(entry) : __swp_type_nonPAE(entry)) #define __swp_offset(entry) (machdep->flags & PAE ? \ __swp_offset_PAE(entry) : __swp_offset_nonPAE(entry)) #define TIF_SIGPENDING (2) // CONFIG_X86_PAE #define _SECTION_SIZE_BITS_PAE_ORIG 30 #define _SECTION_SIZE_BITS_PAE_2_6_26 29 #define _MAX_PHYSMEM_BITS_PAE 36 // !CONFIG_X86_PAE #define _SECTION_SIZE_BITS 26 #define _MAX_PHYSMEM_BITS 32 #define IS_LAST_PMD_READ_PAE(pmd) ((ulong)(pmd) == machdep->machspec->last_pmd_read_PAE) #define IS_LAST_PTBL_READ_PAE(ptbl) ((ulong)(ptbl) == machdep->machspec->last_ptbl_read_PAE) #define FILL_PMD_PAE(PMD, TYPE, SIZE) \ if (!IS_LAST_PMD_READ_PAE(PMD)) { \ readmem((ulonglong)(PMD), TYPE, machdep->pmd, \ SIZE, "pmd page", FAULT_ON_ERROR); \ machdep->machspec->last_pmd_read_PAE = (ulonglong)(PMD); \ } #define FILL_PTBL_PAE(PTBL, TYPE, SIZE) \ if (!IS_LAST_PTBL_READ_PAE(PTBL)) { \ readmem((ulonglong)(PTBL), TYPE, machdep->ptbl, \ SIZE, "page table", FAULT_ON_ERROR); \ machdep->machspec->last_ptbl_read_PAE = (ulonglong)(PTBL); \ } #endif /* X86 */ #ifdef X86_64 #define _64BIT_ #define MACHINE_TYPE "X86_64" #define USERSPACE_TOP (machdep->machspec->userspace_top) #define PAGE_OFFSET (machdep->machspec->page_offset) #define VMALLOC_START (machdep->machspec->vmalloc_start_addr) #define VMALLOC_END (machdep->machspec->vmalloc_end) #define VMEMMAP_VADDR (machdep->machspec->vmemmap_vaddr) #define VMEMMAP_END (machdep->machspec->vmemmap_end) #define MODULES_VADDR (machdep->machspec->modules_vaddr) #define MODULES_END (machdep->machspec->modules_end) #define __START_KERNEL_map 0xffffffff80000000UL #define MODULES_LEN (MODULES_END - MODULES_VADDR) #define USERSPACE_TOP_ORIG 0x0000008000000000 #define PAGE_OFFSET_ORIG 0x0000010000000000 #define VMALLOC_START_ADDR_ORIG 0xffffff0000000000 #define VMALLOC_END_ORIG 0xffffff7fffffffff #define MODULES_VADDR_ORIG 0xffffffffa0000000 #define MODULES_END_ORIG 0xffffffffafffffff #define USERSPACE_TOP_2_6_11 0x0000800000000000 #define PAGE_OFFSET_2_6_11 0xffff810000000000 #define VMALLOC_START_ADDR_2_6_11 0xffffc20000000000 #define VMALLOC_END_2_6_11 0xffffe1ffffffffff #define MODULES_VADDR_2_6_11 0xffffffff88000000 #define MODULES_END_2_6_11 0xfffffffffff00000 #define VMEMMAP_VADDR_2_6_24 0xffffe20000000000 #define VMEMMAP_END_2_6_24 0xffffe2ffffffffff #define MODULES_VADDR_2_6_26 0xffffffffa0000000 #define PAGE_OFFSET_2_6_27 0xffff880000000000 #define MODULES_END_2_6_27 0xffffffffff000000 #define USERSPACE_TOP_XEN 0x0000800000000000 #define PAGE_OFFSET_XEN 0xffff880000000000 #define VMALLOC_START_ADDR_XEN 0xffffc20000000000 #define VMALLOC_END_XEN 0xffffe1ffffffffff #define MODULES_VADDR_XEN 0xffffffff88000000 #define MODULES_END_XEN 0xfffffffffff00000 #define USERSPACE_TOP_XEN_RHEL4 0x0000008000000000 #define PAGE_OFFSET_XEN_RHEL4 0xffffff8000000000 #define VMALLOC_START_ADDR_XEN_RHEL4 0xffffff0000000000 #define VMALLOC_END_XEN_RHEL4 0xffffff7fffffffff #define MODULES_VADDR_XEN_RHEL4 0xffffffffa0000000 #define MODULES_END_XEN_RHEL4 0xffffffffafffffff #define VMALLOC_START_ADDR_2_6_31 0xffffc90000000000 #define VMALLOC_END_2_6_31 0xffffe8ffffffffff #define VMEMMAP_VADDR_2_6_31 0xffffea0000000000 #define VMEMMAP_END_2_6_31 0xffffeaffffffffff #define MODULES_VADDR_2_6_31 0xffffffffa0000000 #define MODULES_END_2_6_31 0xffffffffff000000 #define PTOV(X) ((unsigned long)(X)+(machdep->kvbase)) #define VTOP(X) x86_64_VTOP((ulong)(X)) #define IS_VMALLOC_ADDR(X) x86_64_IS_VMALLOC_ADDR((ulong)(X)) #define PML4_SHIFT 39 #define PTRS_PER_PML4 512 #define PGDIR_SHIFT 30 #define PTRS_PER_PGD 512 #define PMD_SHIFT 21 #define PTRS_PER_PMD 512 #define PTRS_PER_PTE 512 #define pml4_index(address) (((address) >> PML4_SHIFT) & (PTRS_PER_PML4-1)) #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) #define IS_LAST_PML4_READ(pml4) ((ulong)(pml4) == machdep->machspec->last_pml4_read) #define FILL_PML4() { \ if (!(pc->flags & RUNTIME) || ACTIVE()) \ if (!IS_LAST_PML4_READ(vt->kernel_pgd[0])) \ readmem(vt->kernel_pgd[0], KVADDR, machdep->machspec->pml4, \ PAGESIZE(), "init_level4_pgt", FAULT_ON_ERROR); \ machdep->machspec->last_pml4_read = (ulong)(vt->kernel_pgd[0]); \ } #define FILL_PML4_HYPER() { \ if (!machdep->machspec->last_pml4_read) { \ unsigned long idle_pg_table = \ symbol_exists("idle_pg_table_4") ? symbol_value("idle_pg_table_4") : \ symbol_value("idle_pg_table"); \ readmem(idle_pg_table, KVADDR, \ machdep->machspec->pml4, PAGESIZE(), "idle_pg_table", \ FAULT_ON_ERROR); \ machdep->machspec->last_pml4_read = idle_pg_table; \ }\ } #define IS_LAST_UPML_READ(pml) ((ulong)(pml) == machdep->machspec->last_upml_read) #define FILL_UPML(PML, TYPE, SIZE) \ if (!IS_LAST_UPML_READ(PML)) { \ readmem((ulonglong)((ulong)(PML)), TYPE, machdep->machspec->upml, \ SIZE, "pml page", FAULT_ON_ERROR); \ machdep->machspec->last_upml_read = (ulong)(PML); \ } /* * PHYSICAL_PAGE_MASK changed (enlarged) between 2.4 and 2.6, so * for safety, use the 2.6 values to generate it. */ #define __PHYSICAL_MASK_SHIFT 40 #define __PHYSICAL_MASK ((1UL << __PHYSICAL_MASK_SHIFT) - 1) #define __VIRTUAL_MASK_SHIFT 48 #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1) #define PAGE_SHIFT 12 #define PAGE_SIZE (1UL << PAGE_SHIFT) #define PHYSICAL_PAGE_MASK (~(PAGE_SIZE-1) & (__PHYSICAL_MASK << PAGE_SHIFT)) #define _PAGE_BIT_NX 63 #define _PAGE_PRESENT 0x001 #define _PAGE_RW 0x002 #define _PAGE_USER 0x004 #define _PAGE_PWT 0x008 #define _PAGE_PCD 0x010 #define _PAGE_ACCESSED 0x020 #define _PAGE_DIRTY 0x040 #define _PAGE_PSE 0x080 /* 2MB page */ #define _PAGE_FILE 0x040 /* set:pagecache, unset:swap */ #define _PAGE_GLOBAL 0x100 /* Global TLB entry */ #define _PAGE_PROTNONE (machdep->machspec->page_protnone) #define _PAGE_NX (1UL<<_PAGE_BIT_NX) #define SWP_TYPE(entry) (((entry) >> 1) & 0x3f) #define SWP_OFFSET(entry) ((entry) >> 8) #define __swp_type(entry) SWP_TYPE(entry) #define __swp_offset(entry) SWP_OFFSET(entry) #define TIF_SIGPENDING (2) #define PAGEBASE(X) (((ulong)(X)) & (ulong)machdep->pagemask) #define _CPU_PDA_READ2(CPU, BUFFER) \ ((readmem(symbol_value("_cpu_pda"), \ KVADDR, &cpu_pda_addr, sizeof(unsigned long), \ "_cpu_pda addr", RETURN_ON_ERROR)) && \ (readmem(cpu_pda_addr + ((CPU) * sizeof(void *)), \ KVADDR, &cpu_pda_addr, sizeof(unsigned long), \ "_cpu_pda addr", RETURN_ON_ERROR)) && \ (cpu_pda_addr) && \ (readmem(cpu_pda_addr, KVADDR, (BUFFER), SIZE(x8664_pda), \ "cpu_pda entry", RETURN_ON_ERROR))) #define _CPU_PDA_READ(CPU, BUFFER) \ ((STRNEQ("_cpu_pda", closest_symbol((symbol_value("_cpu_pda") + \ ((CPU) * sizeof(unsigned long)))))) && \ (readmem(symbol_value("_cpu_pda") + ((CPU) * sizeof(void *)), \ KVADDR, &cpu_pda_addr, sizeof(unsigned long), \ "_cpu_pda addr", RETURN_ON_ERROR)) && \ (readmem(cpu_pda_addr, KVADDR, (BUFFER), SIZE(x8664_pda), \ "cpu_pda entry", RETURN_ON_ERROR))) #define CPU_PDA_READ(CPU, BUFFER) \ (STRNEQ("cpu_pda", closest_symbol((symbol_value("cpu_pda") + \ ((CPU) * SIZE(x8664_pda))))) && \ readmem(symbol_value("cpu_pda") + ((CPU) * SIZE(x8664_pda)), \ KVADDR, (BUFFER), SIZE(x8664_pda), "cpu_pda entry", \ RETURN_ON_ERROR)) #define VALID_LEVEL4_PGT_ADDR(X) \ (((X) == VIRTPAGEBASE(X)) && IS_KVADDR(X) && !IS_VMALLOC_ADDR(X)) #define _SECTION_SIZE_BITS 27 #define _MAX_PHYSMEM_BITS 40 #define _MAX_PHYSMEM_BITS_2_6_26 44 #define _MAX_PHYSMEM_BITS_2_6_31 46 #endif /* X86_64 */ #ifdef ALPHA #define _64BIT_ #define MACHINE_TYPE "ALPHA" #define PAGEBASE(X) (((unsigned long)(X)) & (unsigned long)machdep->pagemask) #define PTOV(X) ((unsigned long)(X)+(machdep->kvbase)) #define VTOP(X) ((unsigned long)(X)-(machdep->kvbase)) #define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start) #define KSEG_BASE_48_BIT (0xffff800000000000) #define KSEG_BASE (0xfffffc0000000000) #define _PFN_MASK (0xFFFFFFFF00000000) #define VMALLOC_START (0xFFFFFE0000000000) #define MIN_SYMBOL_VALUE (KSEG_BASE_48_BIT) #define PGDIR_SHIFT (PAGESHIFT() + 2*(PAGESHIFT()-3)) #define PMD_SHIFT (PAGESHIFT() + (PAGESHIFT()-3)) #define PTRS_PER_PAGE (1024) #define PTRS_PER_PGD (1UL << (PAGESHIFT()-3)) /* * OSF/1 PAL-code-imposed page table bits */ #define _PAGE_VALID 0x0001 #define _PAGE_FOR 0x0002 /* used for page protection (fault on read) */ #define _PAGE_FOW 0x0004 /* used for page protection (fault on write) */ #define _PAGE_FOE 0x0008 /* used for page protection (fault on exec) */ #define _PAGE_ASM 0x0010 #define _PAGE_KRE 0x0100 /* xxx - see below on the "accessed" bit */ #define _PAGE_URE 0x0200 /* xxx */ #define _PAGE_KWE 0x1000 /* used to do the dirty bit in software */ #define _PAGE_UWE 0x2000 /* used to do the dirty bit in software */ /* .. and these are ours ... */ #define _PAGE_DIRTY 0x20000 #define _PAGE_ACCESSED 0x40000 #define SWP_TYPE(entry) (((entry) >> 32) & 0xff) #define SWP_OFFSET(entry) ((entry) >> 40) #define __swp_type(entry) SWP_TYPE(entry) #define __swp_offset(entry) SWP_OFFSET(entry) #define TIF_SIGPENDING (2) #endif /* ALPHA */ #ifdef PPC #define _32BIT_ #define MACHINE_TYPE "PPC" #define PAGEBASE(X) ((X) & machdep->pagemask) #define PTOV(X) ((unsigned long)(X)+(machdep->kvbase)) #define VTOP(X) ((unsigned long)(X)-(machdep->kvbase)) #define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start) /* Holds the platform specific info for page translation */ struct machine_specific { char *platform; /* page address translation bits */ int pte_size; int pte_rpn_shift; /* page flags */ ulong _page_present; ulong _page_user; ulong _page_rw; ulong _page_guarded; ulong _page_coherent; ulong _page_no_cache; ulong _page_writethru; ulong _page_dirty; ulong _page_accessed; ulong _page_hwwrite; ulong _page_shared; ulong _page_k_rw; /* platform special vtop */ int (*vtop_special)(ulong vaddr, physaddr_t *paddr, int verbose); void *mmu_special; }; /* machdep flags for ppc32 specific */ #define IS_PAE() (machdep->flags & PAE) #define IS_BOOKE() (machdep->flags & CPU_BOOKE) /* Page translation bits */ #define PPC_PLATFORM (machdep->machspec->platform) #define PTE_SIZE (machdep->machspec->pte_size) #define PTE_RPN_SHIFT (machdep->machspec->pte_rpn_shift) #define PAGE_SHIFT (12) #define PTE_T_LOG2 (ffs(PTE_SIZE) - 1) #define PTE_SHIFT (PAGE_SHIFT - PTE_T_LOG2) #define PGDIR_SHIFT (PAGE_SHIFT + PTE_SHIFT) #define PTRS_PER_PGD (1 << (32 - PGDIR_SHIFT)) #define PTRS_PER_PTE (1 << PTE_SHIFT) /* special vtop */ #define VTOP_SPECIAL (machdep->machspec->vtop_special) #define MMU_SPECIAL (machdep->machspec->mmu_special) /* PFN shifts */ #define BOOKE3E_PTE_RPN_SHIFT (24) /* PAGE flags */ #define _PAGE_PRESENT (machdep->machspec->_page_present) /* software: pte contains a translation */ #define _PAGE_USER (machdep->machspec->_page_user) /* matches one of the PP bits */ #define _PAGE_RW (machdep->machspec->_page_rw) /* software: user write access allowed */ #define _PAGE_GUARDED (machdep->machspec->_page_guarded) #define _PAGE_COHERENT (machdep->machspec->_page_coherent /* M: enforce memory coherence (SMP systems) */) #define _PAGE_NO_CACHE (machdep->machspec->_page_no_cache) /* I: cache inhibit */ #define _PAGE_WRITETHRU (machdep->machspec->_page_writethru) /* W: cache write-through */ #define _PAGE_DIRTY (machdep->machspec->_page_dirty) /* C: page changed */ #define _PAGE_ACCESSED (machdep->machspec->_page_accessed) /* R: page referenced */ #define _PAGE_HWWRITE (machdep->machspec->_page_hwwrite) /* software: _PAGE_RW & _PAGE_DIRTY */ #define _PAGE_SHARED (machdep->machspec->_page_shared) #define _PAGE_K_RW (machdep->machspec->_page_k_rw) /* privilege only write access allowed */ /* Default values for PAGE flags */ #define DEFAULT_PAGE_PRESENT 0x001 #define DEFAULT_PAGE_USER 0x002 #define DEFAULT_PAGE_RW 0x004 #define DEFAULT_PAGE_GUARDED 0x008 #define DEFAULT_PAGE_COHERENT 0x010 #define DEFAULT_PAGE_NO_CACHE 0x020 #define DEFAULT_PAGE_WRITETHRU 0x040 #define DEFAULT_PAGE_DIRTY 0x080 #define DEFAULT_PAGE_ACCESSED 0x100 #define DEFAULT_PAGE_HWWRITE 0x200 #define DEFAULT_PAGE_SHARED 0 /* PPC44x PAGE flags: Values from kernel asm/pte-44x.h */ #define PPC44x_PAGE_PRESENT 0x001 #define PPC44x_PAGE_RW 0x002 #define PPC44x_PAGE_ACCESSED 0x008 #define PPC44x_PAGE_DIRTY 0x010 #define PPC44x_PAGE_USER 0x040 #define PPC44x_PAGE_GUARDED 0x100 #define PPC44x_PAGE_COHERENT 0x200 #define PPC44x_PAGE_NO_CACHE 0x400 #define PPC44x_PAGE_WRITETHRU 0x800 #define PPC44x_PAGE_HWWRITE 0 #define PPC44x_PAGE_SHARED 0 /* BOOK3E */ #define BOOK3E_PAGE_PRESENT 0x000001 #define BOOK3E_PAGE_BAP_SR 0x000004 #define BOOK3E_PAGE_BAP_UR 0x000008 /* User Readable */ #define BOOK3E_PAGE_BAP_SW 0x000010 #define BOOK3E_PAGE_BAP_UW 0x000020 /* User Writable */ #define BOOK3E_PAGE_DIRTY 0x001000 #define BOOK3E_PAGE_ACCESSED 0x040000 #define BOOK3E_PAGE_GUARDED 0x100000 #define BOOK3E_PAGE_COHERENT 0x200000 #define BOOK3E_PAGE_NO_CACHE 0x400000 #define BOOK3E_PAGE_WRITETHRU 0x800000 #define BOOK3E_PAGE_HWWRITE 0 #define BOOK3E_PAGE_SHARED 0 #define BOOK3E_PAGE_USER (BOOK3E_PAGE_BAP_SR | BOOK3E_PAGE_BAP_UR) #define BOOK3E_PAGE_RW (BOOK3E_PAGE_BAP_SW | BOOK3E_PAGE_BAP_UW) #define BOOK3E_PAGE_KERNEL_RW (BOOK3E_PAGE_BAP_SW | BOOK3E_PAGE_BAP_SR | BOOK3E_PAGE_DIRTY) /* FSL BOOKE */ #define FSL_BOOKE_PAGE_PRESENT 0x00001 #define FSL_BOOKE_PAGE_USER 0x00002 #define FSL_BOOKE_PAGE_RW 0x00004 #define FSL_BOOKE_PAGE_DIRTY 0x00008 #define FSL_BOOKE_PAGE_ACCESSED 0x00020 #define FSL_BOOKE_PAGE_GUARDED 0x00080 #define FSL_BOOKE_PAGE_COHERENT 0x00100 #define FSL_BOOKE_PAGE_NO_CACHE 0x00200 #define FSL_BOOKE_PAGE_WRITETHRU 0x00400 #define FSL_BOOKE_PAGE_HWWRITE 0 #define FSL_BOOKE_PAGE_SHARED 0 #define SWP_TYPE(entry) (((entry) >> 1) & 0x7f) #define SWP_OFFSET(entry) ((entry) >> 8) #define __swp_type(entry) SWP_TYPE(entry) #define __swp_offset(entry) SWP_OFFSET(entry) #define TIF_SIGPENDING (2) #define _SECTION_SIZE_BITS 24 #define _MAX_PHYSMEM_BITS 44 #define STACK_FRAME_OVERHEAD 16 #define STACK_FRAME_LR_SAVE (sizeof(ulong)) #define STACK_FRAME_MARKER (2 * sizeof(ulong)) #define STACK_FRAME_REGS_MARKER 0x72656773 #define PPC_STACK_SIZE 8192 #endif /* PPC */ #ifdef IA64 #define _64BIT_ #define MACHINE_TYPE "IA64" #define PAGEBASE(X) (((unsigned long)(X)) & (unsigned long)machdep->pagemask) #define REGION_SHIFT (61) #define VADDR_REGION(X) ((ulong)(X) >> REGION_SHIFT) #define KERNEL_CACHED_REGION (7) #define KERNEL_UNCACHED_REGION (6) #define KERNEL_VMALLOC_REGION (5) #define USER_STACK_REGION (4) #define USER_DATA_REGION (3) #define USER_TEXT_REGION (2) #define USER_SHMEM_REGION (1) #define USER_IA32_EMUL_REGION (0) #define KERNEL_VMALLOC_BASE ((ulong)KERNEL_VMALLOC_REGION << REGION_SHIFT) #define KERNEL_UNCACHED_BASE ((ulong)KERNEL_UNCACHED_REGION << REGION_SHIFT) #define KERNEL_CACHED_BASE ((ulong)KERNEL_CACHED_REGION << REGION_SHIFT) #define _SECTION_SIZE_BITS 30 #define _MAX_PHYSMEM_BITS 50 /* * As of 2.6, these are no longer straight forward. */ #define PTOV(X) ia64_PTOV((ulong)(X)) #define VTOP(X) ia64_VTOP((ulong)(X)) #define IS_VMALLOC_ADDR(X) ia64_IS_VMALLOC_ADDR((ulong)(X)) #define SWITCH_STACK_ADDR(X) (ia64_get_switch_stack((ulong)(X))) #define __IA64_UL(x) ((unsigned long)(x)) #define IA64_MAX_PHYS_BITS (50) /* max # of phys address bits (architected) */ /* * How many pointers will a page table level hold expressed in shift */ #define PTRS_PER_PTD_SHIFT (PAGESHIFT()-3) /* * Definitions for fourth level: */ #define PTRS_PER_PTE (__IA64_UL(1) << (PTRS_PER_PTD_SHIFT)) /* * Definitions for third level: * * PMD_SHIFT determines the size of the area a third-level page table * can map. */ #define PMD_SHIFT (PAGESHIFT() + (PTRS_PER_PTD_SHIFT)) #define PMD_SIZE (1UL << PMD_SHIFT) #define PMD_MASK (~(PMD_SIZE-1)) #define PTRS_PER_PMD (1UL << (PTRS_PER_PTD_SHIFT)) /* * PUD_SHIFT determines the size of the area a second-level page table * can map */ #define PUD_SHIFT (PMD_SHIFT + (PTRS_PER_PTD_SHIFT)) #define PUD_SIZE (1UL << PUD_SHIFT) #define PUD_MASK (~(PUD_SIZE-1)) #define PTRS_PER_PUD (1UL << (PTRS_PER_PTD_SHIFT)) /* * Definitions for first level: * * PGDIR_SHIFT determines what a first-level page table entry can map. */ #define PGDIR_SHIFT_4L (PUD_SHIFT + (PTRS_PER_PTD_SHIFT)) #define PGDIR_SHIFT_3L (PMD_SHIFT + (PTRS_PER_PTD_SHIFT)) /* Turns out 4L & 3L PGDIR_SHIFT are the same (for now) */ #define PGDIR_SHIFT PGDIR_SHIFT_4L #define PGDIR_SIZE (__IA64_UL(1) << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1)) #define PTRS_PER_PGD_SHIFT PTRS_PER_PTD_SHIFT #define PTRS_PER_PGD (1UL << PTRS_PER_PGD_SHIFT) #define USER_PTRS_PER_PGD (5*PTRS_PER_PGD/8) /* regions 0-4 are user regions */ #define FIRST_USER_ADDRESS 0 /* * First, define the various bits in a PTE. Note that the PTE format * matches the VHPT short format, the firt doubleword of the VHPD long * format, and the first doubleword of the TLB insertion format. */ #define _PAGE_P (1 << 0) /* page present bit */ #define _PAGE_MA_WB (0x0 << 2) /* write back memory attribute */ #define _PAGE_MA_UC (0x4 << 2) /* uncacheable memory attribute */ #define _PAGE_MA_UCE (0x5 << 2) /* UC exported attribute */ #define _PAGE_MA_WC (0x6 << 2) /* write coalescing memory attribute */ #define _PAGE_MA_NAT (0x7 << 2) /* not-a-thing attribute */ #define _PAGE_MA_MASK (0x7 << 2) #define _PAGE_PL_0 (0 << 7) /* privilege level 0 (kernel) */ #define _PAGE_PL_1 (1 << 7) /* privilege level 1 (unused) */ #define _PAGE_PL_2 (2 << 7) /* privilege level 2 (unused) */ #define _PAGE_PL_3 (3 << 7) /* privilege level 3 (user) */ #define _PAGE_PL_MASK (3 << 7) #define _PAGE_AR_R (0 << 9) /* read only */ #define _PAGE_AR_RX (1 << 9) /* read & execute */ #define _PAGE_AR_RW (2 << 9) /* read & write */ #define _PAGE_AR_RWX (3 << 9) /* read, write & execute */ #define _PAGE_AR_R_RW (4 << 9) /* read / read & write */ #define _PAGE_AR_RX_RWX (5 << 9) /* read & exec / read, write & exec */ #define _PAGE_AR_RWX_RW (6 << 9) /* read, write & exec / read & write */ #define _PAGE_AR_X_RX (7 << 9) /* exec & promote / read & exec */ #define _PAGE_AR_MASK (7 << 9) #define _PAGE_AR_SHIFT 9 #define _PAGE_A (1 << 5) /* page accessed bit */ #define _PAGE_D (1 << 6) /* page dirty bit */ #define _PAGE_PPN_MASK (((__IA64_UL(1) << IA64_MAX_PHYS_BITS) - 1) & ~0xfffUL) #define _PAGE_ED (__IA64_UL(1) << 52) /* exception deferral */ #define _PAGE_PROTNONE (__IA64_UL(1) << 63) #define _PFN_MASK _PAGE_PPN_MASK #define _PAGE_CHG_MASK (_PFN_MASK | _PAGE_A | _PAGE_D) #define _PAGE_SIZE_4K 12 #define _PAGE_SIZE_8K 13 #define _PAGE_SIZE_16K 14 #define _PAGE_SIZE_64K 16 #define _PAGE_SIZE_256K 18 #define _PAGE_SIZE_1M 20 #define _PAGE_SIZE_4M 22 #define _PAGE_SIZE_16M 24 #define _PAGE_SIZE_64M 26 #define _PAGE_SIZE_256M 28 #define __ACCESS_BITS _PAGE_ED | _PAGE_A | _PAGE_P | _PAGE_MA_WB #define __DIRTY_BITS_NO_ED _PAGE_A | _PAGE_P | _PAGE_D | _PAGE_MA_WB #define __DIRTY_BITS _PAGE_ED | __DIRTY_BITS_NO_ED #define EFI_PAGE_SHIFT (12) /* * NOTE: #include'ing <asm/efi.h> creates too many compiler problems, so * this stuff is hardwired here; it's probably etched in stone somewhere. */ struct efi_memory_desc_t { uint32_t type; uint32_t pad; uint64_t phys_addr; uint64_t virt_addr; uint64_t num_pages; uint64_t attribute; } desc; /* Memory types: */ #define EFI_RESERVED_TYPE 0 #define EFI_LOADER_CODE 1 #define EFI_LOADER_DATA 2 #define EFI_BOOT_SERVICES_CODE 3 #define EFI_BOOT_SERVICES_DATA 4 #define EFI_RUNTIME_SERVICES_CODE 5 #define EFI_RUNTIME_SERVICES_DATA 6 #define EFI_CONVENTIONAL_MEMORY 7 #define EFI_UNUSABLE_MEMORY 8 #define EFI_ACPI_RECLAIM_MEMORY 9 #define EFI_ACPI_MEMORY_NVS 10 #define EFI_MEMORY_MAPPED_IO 11 #define EFI_MEMORY_MAPPED_IO_PORT_SPACE 12 #define EFI_PAL_CODE 13 #define EFI_MAX_MEMORY_TYPE 14 /* Attribute values: */ #define EFI_MEMORY_UC 0x0000000000000001 /* uncached */ #define EFI_MEMORY_WC 0x0000000000000002 /* write-coalescing */ #define EFI_MEMORY_WT 0x0000000000000004 /* write-through */ #define EFI_MEMORY_WB 0x0000000000000008 /* write-back */ #define EFI_MEMORY_WP 0x0000000000001000 /* write-protect */ #define EFI_MEMORY_RP 0x0000000000002000 /* read-protect */ #define EFI_MEMORY_XP 0x0000000000004000 /* execute-protect */ #define EFI_MEMORY_RUNTIME 0x8000000000000000 /* range requires runtime mapping */ #define SWP_TYPE(entry) (((entry) >> 1) & 0xff) #define SWP_OFFSET(entry) ((entry) >> 9) #define __swp_type(entry) ((entry >> 2) & 0x7f) #define __swp_offset(entry) ((entry << 1) >> 10) #define TIF_SIGPENDING (1) #define KERNEL_TR_PAGE_SIZE (1 << _PAGE_SIZE_64M) #define KERNEL_TR_PAGE_MASK (~(KERNEL_TR_PAGE_SIZE - 1)) #define UNKNOWN_PHYS_START ((ulong)(-1)) #define DEFAULT_PHYS_START (KERNEL_TR_PAGE_SIZE * 1) #define IA64_GET_STACK_ULONG(OFF) \ ((INSTACK(OFF,bt)) ? (GET_STACK_ULONG(OFF)) : get_init_stack_ulong((unsigned long)OFF)) #endif /* IA64 */ #ifdef PPC64 #define _64BIT_ #define MACHINE_TYPE "PPC64" #define PPC64_64K_PAGE_SIZE 65536 #define PPC64_STACK_SIZE 16384 #define PAGEBASE(X) (((ulong)(X)) & (ulong)machdep->pagemask) #define PTOV(X) ((unsigned long)(X)+(machdep->identity_map_base)) #define VTOP(X) ((unsigned long)(X)-(machdep->identity_map_base)) #define BOOK3E_VMBASE 0x8000000000000000 #define IS_VMALLOC_ADDR(X) machdep->machspec->is_vmaddr(X) #define KERNELBASE machdep->pageoffset #define PGDIR_SHIFT (machdep->pageshift + (machdep->pageshift -3) + (machdep->pageshift - 2)) #define PMD_SHIFT (machdep->pageshift + (machdep->pageshift - 3)) #define PGD_MASK (~((1UL << PGDIR_SHIFT) - 1)) #define PMD_MASK (~((1UL << PMD_SHIFT) - 1)) /* shift to put page number into pte */ #define PTE_SHIFT 16 #define PMD_TO_PTEPAGE_SHIFT 2 /* Used for 2.6 or later */ #define PTE_INDEX_SIZE 9 #define PMD_INDEX_SIZE 10 #define PGD_INDEX_SIZE 10 #define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) #define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) #define PGD_OFFSET_24(vaddr) ((vaddr >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) #define PGD_OFFSET(vaddr) ((vaddr >> PGDIR_SHIFT) & 0x7ff) #define PMD_OFFSET(vaddr) ((vaddr >> PMD_SHIFT) & (PTRS_PER_PMD - 1)) /* 4-level page table support */ /* 4K pagesize */ #define PTE_INDEX_SIZE_L4_4K 9 #define PMD_INDEX_SIZE_L4_4K 7 #define PUD_INDEX_SIZE_L4_4K 7 #define PGD_INDEX_SIZE_L4_4K 9 #define PTE_SHIFT_L4_4K 17 #define PMD_MASKED_BITS_4K 0 /* 64K pagesize */ #define PTE_INDEX_SIZE_L4_64K 12 #define PMD_INDEX_SIZE_L4_64K 12 #define PUD_INDEX_SIZE_L4_64K 0 #define PGD_INDEX_SIZE_L4_64K 4 #define PTE_INDEX_SIZE_L4_64K_3_10 8 #define PMD_INDEX_SIZE_L4_64K_3_10 10 #define PGD_INDEX_SIZE_L4_64K_3_10 12 #define PTE_SHIFT_L4_64K_V1 32 #define PTE_SHIFT_L4_64K_V2 30 #define PTE_SHIFT_L4_BOOK3E_64K 28 #define PTE_SHIFT_L4_BOOK3E_4K 24 #define PMD_MASKED_BITS_64K 0x1ff #define PD_HUGE 0x8000000000000000 #define HUGE_PTE_MASK 0x03 #define HUGEPD_SHIFT_MASK 0x3f #define L4_MASK (THIS_KERNEL_VERSION >= LINUX(3,10,0) ? 0xfff : 0x1ff) #define L4_OFFSET(vaddr) ((vaddr >> (machdep->machspec->l4_shift)) & L4_MASK) #define PGD_OFFSET_L4(vaddr) \ ((vaddr >> (machdep->machspec->l3_shift)) & (machdep->machspec->ptrs_per_l3 - 1)) #define PMD_OFFSET_L4(vaddr) \ ((vaddr >> (machdep->machspec->l2_shift)) & (machdep->machspec->ptrs_per_l2 - 1)) #define _PAGE_PRESENT (machdep->machspec->_page_present) /* software: pte contains a translation */ #define _PAGE_USER (machdep->machspec->_page_user) /* matches one of the PP bits */ #define _PAGE_RW (machdep->machspec->_page_rw) /* software: user write access allowed */ #define _PAGE_GUARDED (machdep->machspec->_page_guarded) #define _PAGE_COHERENT (machdep->machspec->_page_coherent /* M: enforce memory coherence (SMP systems) */) #define _PAGE_NO_CACHE (machdep->machspec->_page_no_cache) /* I: cache inhibit */ #define _PAGE_WRITETHRU (machdep->machspec->_page_writethru) /* W: cache write-through */ #define _PAGE_DIRTY (machdep->machspec->_page_dirty) /* C: page changed */ #define _PAGE_ACCESSED (machdep->machspec->_page_accessed) /* R: page referenced */ #define TIF_SIGPENDING (2) #define SWP_TYPE(entry) (((entry) >> 1) & 0x7f) #define SWP_OFFSET(entry) ((entry) >> 8) #define __swp_type(entry) SWP_TYPE(entry) #define __swp_offset(entry) SWP_OFFSET(entry) #define MSR_PR_LG 14 /* Problem State / Privilege Level */ /* Used to find the user or kernel-mode frame*/ #define STACK_FRAME_OVERHEAD 112 #define EXCP_FRAME_MARKER 0x7265677368657265 #define _SECTION_SIZE_BITS 24 #define _MAX_PHYSMEM_BITS 44 #define _MAX_PHYSMEM_BITS_3_7 46 #endif /* PPC64 */ #ifdef S390 #define _32BIT_ #define MACHINE_TYPE "S390" #define PTOV(X) ((unsigned long)(X)+(machdep->kvbase)) #define VTOP(X) ((unsigned long)(X)-(machdep->kvbase)) #define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start) #define PTRS_PER_PTE 1024 #define PTRS_PER_PMD 1 #define PTRS_PER_PGD 512 #define SEGMENT_TABLE_SIZE ((sizeof(ulong)*4) * PTRS_PER_PGD) #define SWP_TYPE(entry) (((entry) >> 2) & 0x1f) #define SWP_OFFSET(entry) ((((entry) >> 11) & 0xfffffffe) | \ (((entry) >> 7) & 0x1)) #define __swp_type(entry) SWP_TYPE(entry) #define __swp_offset(entry) SWP_OFFSET(entry) #define TIF_SIGPENDING (2) #define _SECTION_SIZE_BITS 25 #define _MAX_PHYSMEM_BITS 31 #endif /* S390 */ #ifdef S390X #define _64BIT_ #define MACHINE_TYPE "S390X" #define PTOV(X) ((unsigned long)(X)+(machdep->kvbase)) #define VTOP(X) ((unsigned long)(X)-(machdep->kvbase)) #define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start) #define PTRS_PER_PTE 512 #define PTRS_PER_PMD 1024 #define PTRS_PER_PGD 2048 #define SEGMENT_TABLE_SIZE ((sizeof(ulong)*2) * PTRS_PER_PMD) #define SWP_TYPE(entry) (((entry) >> 2) & 0x1f) #define SWP_OFFSET(entry) ((((entry) >> 11) & 0xfffffffffffffffe) | \ (((entry) >> 7) & 0x1)) #define __swp_type(entry) SWP_TYPE(entry) #define __swp_offset(entry) SWP_OFFSET(entry) #define TIF_SIGPENDING (2) #define _SECTION_SIZE_BITS 28 #define _MAX_PHYSMEM_BITS_OLD 42 #define _MAX_PHYSMEM_BITS_NEW 46 #endif /* S390X */ #ifdef PLATFORM #define SWP_TYPE(entry) (error("PLATFORM_SWP_TYPE: TBD\n")) #define SWP_OFFSET(entry) (error("PLATFORM_SWP_OFFSET: TBD\n")) #define __swp_type(entry) SWP_TYPE(entry) #define __swp_offset(entry) SWP_OFFSET(entry) #endif /* PLATFORM */ #define KILOBYTES(x) ((x) * (1024)) #define MEGABYTES(x) ((x) * (1048576)) #define GIGABYTES(x) ((x) * (1073741824)) #define MEGABYTE_MASK (MEGABYTES(1)-1) #define SIZEOF_64BIT (8) #define SIZEOF_32BIT (4) #define SIZEOF_16BIT (2) #define SIZEOF_8BIT (1) #ifdef ARM #define MAX_HEXADDR_STRLEN (8) #define UVADDR_PRLEN (8) #endif #ifdef X86 #define MAX_HEXADDR_STRLEN (8) #define UVADDR_PRLEN (8) #endif #ifdef ALPHA #define MAX_HEXADDR_STRLEN (16) #define UVADDR_PRLEN (11) #endif #ifdef PPC #define MAX_HEXADDR_STRLEN (8) #define UVADDR_PRLEN (8) #endif #ifdef IA64 #define MAX_HEXADDR_STRLEN (16) #define UVADDR_PRLEN (16) #endif #ifdef S390 #define MAX_HEXADDR_STRLEN (8) #define UVADDR_PRLEN (8) #endif #ifdef S390X #define MAX_HEXADDR_STRLEN (16) #define UVADDR_PRLEN (16) #endif #ifdef X86_64 #define MAX_HEXADDR_STRLEN (16) #define UVADDR_PRLEN (10) #endif #ifdef PPC64 #define MAX_HEXADDR_STRLEN (16) #define UVADDR_PRLEN (16) #endif #ifdef ARM64 #define MAX_HEXADDR_STRLEN (16) #define UVADDR_PRLEN (10) #endif #define BADADDR ((ulong)(-1)) #define BADVAL ((ulong)(-1)) #define UNUSED (-1) #define UNINITIALIZED (BADVAL) #define BITS_PER_BYTE (8) #define BITS_PER_LONG (BITS_PER_BYTE * sizeof(long)) #define NUM_TO_BIT(x) (1UL<<((x)%BITS_PER_LONG)) #define NUM_IN_BITMAP(bitmap, x) (bitmap[(x)/BITS_PER_LONG] & NUM_TO_BIT(x)) #define SET_BIT(bitmap, x) (bitmap[(x)/BITS_PER_LONG] |= NUM_TO_BIT(x)) /* * precision lengths for fprintf */ #define VADDR_PRLEN (sizeof(char *) == 8 ? 16 : 8) #define LONG_LONG_PRLEN (16) #define LONG_PRLEN (sizeof(long) == 8 ? 16 : 8) #define INT_PRLEN (sizeof(int) == 8 ? 16 : 8) #define CHAR_PRLEN (2) #define SHORT_PRLEN (4) #define MINSPACE (-100) #define SYNOPSIS (0x1) #define COMPLETE_HELP (0x2) #define PIPE_TO_SCROLL (0x4) #define MUST_HELP (0x8) #define LEFT_JUSTIFY (1) #define RIGHT_JUSTIFY (2) #define CENTER (0x1) #define LJUST (0x2) #define RJUST (0x4) #define LONG_DEC (0x8) #define LONG_HEX (0x10) #define INT_DEC (0x20) #define INT_HEX (0x40) #define LONGLONG_HEX (0x80) #define ZERO_FILL (0x100) #define INIT_TIME (1) #define RUN_TIME (2) /* * IRQ line status. * For kernels up to and including 2.6.17 */ #define IRQ_INPROGRESS_2_6_17 1 /* IRQ handler active - do not enter! */ #define IRQ_DISABLED_2_6_17 2 /* IRQ disabled - do not enter! */ #define IRQ_PENDING_2_6_17 4 /* IRQ pending - replay on enable */ #define IRQ_REPLAY_2_6_17 8 /* IRQ has been replayed but not acked yet */ #define IRQ_AUTODETECT_2_6_17 16 /* IRQ is being autodetected */ #define IRQ_WAITING_2_6_17 32 /* IRQ not yet seen - for autodetection */ #define IRQ_LEVEL_2_6_17 64 /* IRQ level triggered */ #define IRQ_MASKED_2_6_17 128 /* IRQ masked - shouldn't be seen again */ /* * For kernel 2.6.21 and later */ #define IRQ_TYPE_NONE_2_6_21 0x00000000 /* Default, unspecified type */ #define IRQ_TYPE_EDGE_RISING_2_6_21 0x00000001 /* Edge rising type */ #define IRQ_TYPE_EDGE_FALLING_2_6_21 0x00000002 /* Edge falling type */ #define IRQ_TYPE_EDGE_BOTH_2_6_21 (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING) #define IRQ_TYPE_LEVEL_HIGH_2_6_21 0x00000004 /* Level high type */ #define IRQ_TYPE_LEVEL_LOW_2_6_21 0x00000008 /* Level low type */ #define IRQ_TYPE_SENSE_MASK_2_6_21 0x0000000f /* Mask of the above */ #define IRQ_TYPE_PROBE_2_6_21 0x00000010 /* Probing in progress */ #define IRQ_INPROGRESS_2_6_21 0x00000100 /* IRQ handler active - do not enter! */ #define IRQ_DISABLED_2_6_21 0x00000200 /* IRQ disabled - do not enter! */ #define IRQ_PENDING_2_6_21 0x00000400 /* IRQ pending - replay on enable */ #define IRQ_REPLAY_2_6_21 0x00000800 /* IRQ has been replayed but not acked yet */ #define IRQ_AUTODETECT_2_6_21 0x00001000 /* IRQ is being autodetected */ #define IRQ_WAITING_2_6_21 0x00002000 /* IRQ not yet seen - for autodetection */ #define IRQ_LEVEL_2_6_21 0x00004000 /* IRQ level triggered */ #define IRQ_MASKED_2_6_21 0x00008000 /* IRQ masked - shouldn't be seen again */ #define IRQ_PER_CPU_2_6_21 0x00010000 /* IRQ is per CPU */ #define IRQ_NOPROBE_2_6_21 0x00020000 /* IRQ is not valid for probing */ #define IRQ_NOREQUEST_2_6_21 0x00040000 /* IRQ cannot be requested */ #define IRQ_NOAUTOEN_2_6_21 0x00080000 /* IRQ will not be enabled on request irq */ #define IRQ_WAKEUP_2_6_21 0x00100000 /* IRQ triggers system wakeup */ #define IRQ_MOVE_PENDING_2_6_21 0x00200000 /* need to re-target IRQ destination */ #define IRQ_NO_BALANCING_2_6_21 0x00400000 /* IRQ is excluded from balancing */ #define IRQ_SPURIOUS_DISABLED_2_6_21 0x00800000 /* IRQ was disabled by the spurious trap */ #define IRQ_MOVE_PCNTXT_2_6_21 0x01000000 /* IRQ migration from process context */ #define IRQ_AFFINITY_SET_2_6_21 0x02000000 /* IRQ affinity was set from userspace*/ /* * Select proper IRQ value depending on kernel version */ #define IRQ_TYPE_NONE \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_NONE_2_6_21 : 0) #define IRQ_TYPE_EDGE_RISING \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_EDGE_RISING_2_6_21 : 0) #define IRQ_TYPE_EDGE_FALLING \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_EDGE_FALLING_2_6_21 : 0) #define IRQ_TYPE_EDGE_BOTH \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_EDGE_BOTH_2_6_21 : 0) #define IRQ_TYPE_LEVEL_HIGH \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_LEVEL_HIGH_2_6_21 : 0) #define IRQ_TYPE_LEVEL_LOW \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_LEVEL_LOW_2_6_21 : 0) #define IRQ_TYPE_SENSE_MASK \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_SENSE_MASK_2_6_21 : 0) #define IRQ_TYPE_PROBE \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_PROBE_2_6_21 : 0) #define IRQ_INPROGRESS \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_INPROGRESS_2_6_21 : IRQ_INPROGRESS_2_6_17) #define IRQ_DISABLED \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_DISABLED_2_6_21 : IRQ_DISABLED_2_6_17) #define IRQ_PENDING \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_PENDING_2_6_21 : IRQ_PENDING_2_6_17) #define IRQ_REPLAY \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_REPLAY_2_6_21 : IRQ_REPLAY_2_6_17) #define IRQ_AUTODETECT \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_AUTODETECT_2_6_21 : IRQ_AUTODETECT_2_6_17) #define IRQ_WAITING \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_WAITING_2_6_21 : IRQ_WAITING_2_6_17) #define IRQ_LEVEL \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_LEVEL_2_6_21 : IRQ_LEVEL_2_6_17) #define IRQ_MASKED \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_MASKED_2_6_21 : IRQ_MASKED_2_6_17) #define IRQ_PER_CPU \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_PER_CPU_2_6_21 : 0) #define IRQ_NOPROBE \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_NOPROBE_2_6_21 : 0) #define IRQ_NOREQUEST \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_NOREQUEST_2_6_21 : 0) #define IRQ_NOAUTOEN \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_NOAUTOEN_2_6_21 : 0) #define IRQ_WAKEUP \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_WAKEUP_2_6_21 : 0) #define IRQ_MOVE_PENDING \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_MOVE_PENDING_2_6_21 : 0) #define IRQ_NO_BALANCING \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_NO_BALANCING_2_6_21 : 0) #define IRQ_SPURIOUS_DISABLED \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_SPURIOUS_DISABLED_2_6_21 : 0) #define IRQ_MOVE_PCNTXT \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_MOVE_PCNTXT_2_6_21 : 0) #define IRQ_AFFINITY_SET \ (THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_AFFINITY_SET_2_6_21 : 0) #ifdef ARM #define SA_PROBE SA_ONESHOT #define SA_SAMPLE_RANDOM SA_RESTART #define SA_SHIRQ 0x04000000 #define SA_RESTORER 0x04000000 #endif #ifdef X86 #define SA_PROBE SA_ONESHOT #define SA_SAMPLE_RANDOM SA_RESTART #define SA_SHIRQ 0x04000000 #define SA_RESTORER 0x04000000 #endif #ifdef X86_64 #define SA_PROBE SA_ONESHOT #define SA_SAMPLE_RANDOM SA_RESTART #define SA_SHIRQ 0x04000000 #define SA_RESTORER 0x04000000 #endif #ifdef ALPHA #define SA_PROBE SA_ONESHOT #define SA_SAMPLE_RANDOM SA_RESTART #define SA_SHIRQ 0x40000000 #endif #ifdef PPC #define SA_PROBE SA_ONESHOT #define SA_SAMPLE_RANDOM SA_RESTART #define SA_SHIRQ 0x04000000 #define SA_RESTORER 0x04000000 #endif #ifdef PPC64 #define SA_PROBE SA_ONESHOT #define SA_SAMPLE_RANDOM SA_RESTART #define SA_SHIRQ 0x04000000 #define SA_RESTORER 0x04000000u #endif #ifdef IA64 #define SA_PROBE SA_ONESHOT #define SA_SAMPLE_RANDOM SA_RESTART #define SA_SHIRQ 0x04000000 #define SA_RESTORER 0x04000000 #endif #ifdef S390 #define SA_PROBE SA_ONESHOT #define SA_SAMPLE_RANDOM SA_RESTART #define SA_SHIRQ 0x04000000 #define SA_RESTORER 0x04000000 #endif #ifdef S390X #define SA_PROBE SA_ONESHOT #define SA_SAMPLE_RANDOM SA_RESTART #define SA_SHIRQ 0x04000000 #define SA_RESTORER 0x04000000 #endif #define ACTION_FLAGS (SA_INTERRUPT|SA_PROBE|SA_SAMPLE_RANDOM|SA_SHIRQ) #endif /* !GDB_COMMON */ /* * Common request structure for BFD or GDB data or commands. */ struct gnu_request { int command; char *buf; FILE *fp; ulong addr; ulong addr2; ulong count; ulong flags; char *name; ulong length; int typecode; #if defined(GDB_5_3) || defined(GDB_6_0) || defined(GDB_6_1) || defined(GDB_7_0) char *typename; #else char *type_name; #endif char *target_typename; ulong target_length; int target_typecode; int is_typedef; char *member; long member_offset; long member_length; int member_typecode; long value; char *tagname; ulong pc; ulong sp; ulong ra; int curframe; ulong frame; ulong prevsp; ulong prevpc; ulong lastsp; ulong task; ulong debug; struct stack_hook *hookp; }; /* * GNU commands */ #define GNU_DATATYPE_INIT (1) #define GNU_DISASSEMBLE (2) #define GNU_GET_LINE_NUMBER (3) #define GNU_PASS_THROUGH (4) #define GNU_GET_DATATYPE (5) #define GNU_COMMAND_EXISTS (6) #define GNU_STACK_TRACE (7) #define GNU_ALPHA_FRAME_OFFSET (8) #define GNU_FUNCTION_NUMARGS (9) #define GNU_RESOLVE_TEXT_ADDR (10) #define GNU_ADD_SYMBOL_FILE (11) #define GNU_DELETE_SYMBOL_FILE (12) #define GNU_VERSION (13) #define GNU_PATCH_SYMBOL_VALUES (14) #define GNU_GET_SYMBOL_TYPE (15) #define GNU_USER_PRINT_OPTION (16) #define GNU_SET_CRASH_BLOCK (17) #define GNU_DEBUG_COMMAND (100) /* * GNU flags */ #define GNU_PRINT_LINE_NUMBERS (0x1) #define GNU_FUNCTION_ONLY (0x2) #define GNU_PRINT_ENUMERATORS (0x4) #define GNU_RETURN_ON_ERROR (0x8) #define GNU_COMMAND_FAILED (0x10) #define GNU_FROM_TTY_OFF (0x20) #define GNU_NO_READMEM (0x40) #define GNU_VAR_LENGTH_TYPECODE (0x80) #undef TRUE #undef FALSE #define TRUE (1) #define FALSE (0) #ifdef GDB_COMMON /* * function prototypes required by modified gdb source files. */ int console(char *, ...); int gdb_CRASHDEBUG(ulong); int gdb_readmem_callback(ulong, void *, int, int); void patch_load_module(struct objfile *objfile, struct minimal_symbol *msymbol); int patch_kernel_symbol(struct gnu_request *); struct syment *symbol_search(char *); int gdb_line_number_callback(ulong, ulong, ulong); int gdb_print_callback(ulong); #endif #ifndef GDB_COMMON /* * WARNING: the following type codes are type_code enums from gdb/gdbtypes.h */ enum type_code { TYPE_CODE_UNDEF, /* Not used; catches errors */ TYPE_CODE_PTR, /* Pointer type */ TYPE_CODE_ARRAY, /* Array type with lower & upper bounds. */ TYPE_CODE_STRUCT, /* C struct or Pascal record */ TYPE_CODE_UNION, /* C union or Pascal variant part */ TYPE_CODE_ENUM, /* Enumeration type */ #if defined(GDB_5_3) || defined(GDB_6_0) || defined(GDB_6_1) || defined(GDB_7_0) || defined(GDB_7_3_1) || defined(GDB_7_6) #if defined(GDB_7_0) || defined(GDB_7_3_1) || defined(GDB_7_6) TYPE_CODE_FLAGS, /* Bit flags type */ #endif TYPE_CODE_FUNC, /* Function type */ TYPE_CODE_INT, /* Integer type */ /* Floating type. This is *NOT* a complex type. Beware, there are parts of GDB which bogusly assume that TYPE_CODE_FLT can mean complex. */ TYPE_CODE_FLT, /* Void type. The length field specifies the length (probably always one) which is used in pointer arithmetic involving pointers to this type, but actually dereferencing such a pointer is invalid; a void type has no length and no actual representation in memory or registers. A pointer to a void type is a generic pointer. */ TYPE_CODE_VOID, TYPE_CODE_SET, /* Pascal sets */ TYPE_CODE_RANGE, /* Range (integers within spec'd bounds) */ /* * NOTE: the remainder of the type codes are not list or used here... */ #endif }; #define PF_EXITING 0x00000004 /* getting shut down */ extern long _ZOMBIE_; #define IS_ZOMBIE(task) (task_state(task) & _ZOMBIE_) #define IS_EXITING(task) (task_flags(task) & PF_EXITING) /* * ps command options. */ #define PS_BY_PID (0x1) #define PS_BY_TASK (0x2) #define PS_BY_CMD (0x4) #define PS_SHOW_ALL (0x8) #define PS_PPID_LIST (0x10) #define PS_CHILD_LIST (0x20) #define PS_KERNEL (0x40) #define PS_USER (0x80) #define PS_TIMES (0x100) #define PS_KSTACKP (0x200) #define PS_LAST_RUN (0x400) #define PS_ARGV_ENVP (0x800) #define PS_TGID_LIST (0x1000) #define PS_RLIMIT (0x2000) #define PS_GROUP (0x4000) #define PS_BY_REGEX (0x8000) #define PS_NO_HEADER (0x10000) #define PS_EXCLUSIVE (PS_TGID_LIST|PS_ARGV_ENVP|PS_TIMES|PS_CHILD_LIST|PS_PPID_LIST|PS_LAST_RUN|PS_RLIMIT) #define MAX_PS_ARGS (100) /* maximum command-line specific requests */ struct psinfo { int argc; ulong pid[MAX_PS_ARGS]; int type[MAX_PS_ARGS]; ulong task[MAX_PS_ARGS]; char comm[MAX_PS_ARGS][TASK_COMM_LEN+1]; struct regex_data { char *pattern; regex_t regex; } regex_data[MAX_PS_ARGS]; int regexs; }; #define IS_A_NUMBER(X) (decimal(X, 0) || hexadecimal(X, 0)) #define AMBIGUOUS_NUMBER(X) (decimal(X, 0) && hexadecimal(X, 0)) #define is_mclx_compressed_dump(X) (va_server_init((X), 0, 0, 0) == 0) struct task_mem_usage { ulong rss; ulong total_vm; double pct_physmem; ulong mm_struct_addr; ulong pgd_addr; }; /* * Global data (global_data.c) */ extern FILE *fp; extern struct program_context program_context, *pc; extern struct task_table task_table, *tt; extern struct kernel_table kernel_table, *kt; extern struct command_table_entry linux_command_table[]; extern char *args[MAXARGS]; extern int argcnt; extern int argerrs; extern struct offset_table offset_table; extern struct size_table size_table; extern struct array_table array_table; extern struct vm_table vm_table, *vt; extern struct machdep_table *machdep; extern struct symbol_table_data symbol_table_data, *st; extern struct extension_table *extension_table; /* * Generated in build_data.c */ extern char *build_command; extern char *build_data; extern char *build_target; extern char *build_version; extern char *compiler_version; /* * command prototypes */ void cmd_quit(void); /* main.c */ void cmd_mach(void); /* main.c */ void cmd_help(void); /* help.c */ void cmd_test(void); /* test.c */ void cmd_ascii(void); /* tools.c */ void cmd_set(void); /* tools.c */ void cmd_eval(void); /* tools.c */ void cmd_list(void); /* tools.c */ void cmd_tree(void); /* tools.c */ void cmd_template(void); /* tools.c */ void cmd_alias(void); /* cmdline.c */ void cmd_repeat(void); /* cmdline.c */ void cmd_rd(void); /* memory.c */ void cmd_wr(void); /* memory.c */ void cmd_ptov(void); /* memory.c */ void cmd_vtop(void); /* memory.c */ void cmd_vm(void); /* memory.c */ void cmd_ptob(void); /* memory.c */ void cmd_btop(void); /* memory.c */ void cmd_kmem(void); /* memory.c */ void cmd_search(void); /* memory.c */ void cmd_swap(void); /* memory.c */ void cmd_pte(void); /* memory.c */ void cmd_ps(void); /* task.c */ void cmd_task(void); /* task.c */ void cmd_foreach(void); /* task.c */ void cmd_runq(void); /* task.c */ void cmd_sig(void); /* task.c */ void cmd_bt(void); /* kernel.c */ void cmd_dis(void); /* kernel.c */ void cmd_mod(void); /* kernel.c */ void cmd_log(void); /* kernel.c */ void cmd_sys(void); /* kernel.c */ void cmd_irq(void); /* kernel.c */ void cmd_timer(void); /* kernel.c */ void cmd_waitq(void); /* kernel.c */ void cmd_sym(void); /* symbols.c */ void cmd_struct(void); /* symbols.c */ void cmd_union(void); /* symbols.c */ void cmd_pointer(void); /* symbols.c */ void cmd_whatis(void); /* symbols.c */ void cmd_p(void); /* symbols.c */ void cmd_mount(void); /* filesys.c */ void cmd_files(void); /* filesys.c */ void cmd_fuser(void); /* filesys.c */ void cmd_dev(void); /* dev.c */ void cmd_gdb(void); /* gdb_interface.c */ void cmd_net(void); /* net.c */ void cmd_extend(void); /* extensions.c */ #if defined(S390) || defined(S390X) void cmd_s390dbf(void); #endif void cmd_map(void); /* kvmdump.c */ void cmd_ipcs(void); /* ipcs.c */ /* * main.c */ void main_loop(void); void exec_command(void); struct command_table_entry *get_command_table_entry(char *); void program_usage(int); #define LONG_FORM (1) #define SHORT_FORM (0) void dump_program_context(void); void dump_build_data(void); #ifdef ARM #define machdep_init(X) arm_init(X) #endif #ifdef ARM64 #define machdep_init(X) arm64_init(X) #endif #ifdef X86 #define machdep_init(X) x86_init(X) #endif #ifdef ALPHA #define machdep_init(X) alpha_init(X) #endif #ifdef PPC #define machdep_init(X) ppc_init(X) #endif #ifdef IA64 #define machdep_init(X) ia64_init(X) #endif #ifdef S390 #define machdep_init(X) s390_init(X) #endif #ifdef S390X #define machdep_init(X) s390x_init(X) #endif #ifdef X86_64 #define machdep_init(X) x86_64_init(X) #endif #ifdef PPC64 #define machdep_init(X) ppc64_init(X) #endif int clean_exit(int); int untrusted_file(FILE *, char *); char *readmem_function_name(void); char *writemem_function_name(void); /* * cmdline.c */ void restart(int); void alias_init(char *); struct alias_data *is_alias(char *); void deallocate_alias(char *); void cmdline_init(void); void set_command_prompt(char *); void exec_input_file(void); void process_command_line(void); void dump_history(void); void resolve_rc_cmd(char *, int); void dump_alias_data(void); int output_open(void); #define output_closed() (!output_open()) void close_output(void); int interruptible(void); int received_SIGINT(void); void debug_redirect(char *); int CRASHPAGER_valid(void); char *setup_scroll_command(void); int minimal_functions(char *); int is_args_input_file(struct command_table_entry *, struct args_input_file *); void exec_args_input_file(struct command_table_entry *, struct args_input_file *); /* * tools.c */ int __error(int, char *, ...); #define error __error /* avoid conflict with gdb error() */ int console(char *, ...); void create_console_device(char *); int console_off(void); int console_on(int); int console_verbatim(char *); int whitespace(int); int ascii(int); int ascii_string(char *); char *clean_line(char *); char *strip_line_end(char *); char *strip_linefeeds(char *); char *strip_beginning_whitespace(char *); char *strip_ending_whitespace(char *); char *strip_ending_char(char *, char); char *strip_beginning_char(char *, char); char *strip_comma(char *); char *strip_hex(char *); char *upper_case(char *, char *); char *first_nonspace(char *); char *first_space(char *); char *replace_string(char *, char *, char); void string_insert(char *, char *); char *strstr_rightmost(char *, char *); char *null_first_space(char *); int parse_line(char *, char **); void print_verbatim(FILE *, char *); char *fixup_percent(char *); int can_eval(char *); ulong eval(char *, int, int *); ulonglong evall(char *, int, int *); int eval_common(char *, int, int *, struct number_option *); ulong htol(char *, int, int *); ulong dtol(char *, int, int *); unsigned int dtoi(char *, int, int *); ulong stol(char *, int, int *); ulonglong stoll(char *, int, int *); ulonglong htoll(char *, int, int *); ulonglong dtoll(char *, int, int *); int decimal(char *, int); int hexadecimal(char *, int); int hexadecimal_only(char *, int); ulong convert(char *, int, int *, ulong); void pad_line(FILE *, int, char); #define INDENT(x) pad_line(fp, x, ' ') char *mkstring(char *, int, ulong, const char *); #define MKSTR(X) ((const char *)(X)) int count_leading_spaces(char *); int count_chars(char *, char); long count_buffer_chars(char *, char, long); char *space(int); char *concat_args(char *, int, int); char *shift_string_left(char *, int); char *shift_string_right(char *, int); int bracketed(char *, char *, int); void backspace(int); int do_list(struct list_data *); int do_rdtree(struct tree_data *); int do_rbtree(struct tree_data *); int retrieve_list(ulong *, int); long power(long, int); long long ll_power(long long, long long); void hq_init(void); int hq_open(void); int hq_close(void); int hq_enter(ulong); int hq_entry_exists(ulong); int hq_is_open(void); int hq_is_inuse(void); long get_embedded(void); void dump_embedded(char *); char *ordinal(ulong, char *); char *first_nonspace(char *); void dump_hash_table(int); void dump_shared_bufs(void); void drop_core(char *); int extract_hex(char *, ulong *, char, ulong); int count_bits_int(int); int count_bits_long(ulong); int highest_bit_long(ulong); int lowest_bit_long(ulong); void buf_init(void); void sym_buf_init(void); void free_all_bufs(void); char *getbuf(long); void freebuf(char *); char *resizebuf(char *, long, long); #define GETBUF(X) getbuf((long)(X)) #define FREEBUF(X) freebuf((char *)(X)) #define RESIZEBUF(X,Y,Z) (X) = resizebuf((char *)(X), (long)(Y), (long)(Z)); void sigsetup(int, void *, struct sigaction *, struct sigaction *); #define SIGACTION(s, h, a, o) sigsetup(s, h, a, o) char *convert_time(ulonglong, char *); void stall(ulong); char *pages_to_size(ulong, char *); int clean_arg(void); int empty_list(ulong); int machine_type(char *); int machine_type_mismatch(char *, char *, char *, ulong); void command_not_supported(void); void option_not_supported(int); void please_wait(char *); void please_wait_done(void); int pathcmp(char *, char *); int calculate(char *, ulong *, ulonglong *, ulong); int endian_mismatch(char *, char, ulong); uint16_t swap16(uint16_t, int); uint32_t swap32(uint32_t, int); ulong *get_cpumask_buf(void); int make_cpumask(char *, ulong *, int, int *); size_t strlcpy(char *, char *, size_t); struct rb_node *rb_first(struct rb_root *); struct rb_node *rb_parent(struct rb_node *, struct rb_node *); struct rb_node *rb_right(struct rb_node *, struct rb_node *); struct rb_node *rb_left(struct rb_node *, struct rb_node *); struct rb_node *rb_next(struct rb_node *); struct rb_node *rb_last(struct rb_root *); /* * symbols.c */ void symtab_init(void); char *check_specified_kernel_debug_file(void); void no_debugging_data(int); void get_text_init_space(void); int is_kernel_text(ulong); int is_kernel_data(ulong); int is_init_data(ulong value); int is_kernel_text_offset(ulong); int is_rodata(ulong, struct syment **); void datatype_init(void); struct syment *symbol_search(char *); struct syment *value_search(ulong, ulong *); struct syment *value_search_base_kernel(ulong, ulong *); struct syment *value_search_module(ulong, ulong *); struct syment *symbol_search_next(char *, struct syment *); ulong highest_bss_symbol(void); int in_ksymbol_range(ulong); int module_symbol(ulong, struct syment **, struct load_module **, char *, ulong); #define IS_MODULE_VADDR(X) \ (module_symbol((ulong)(X), NULL, NULL, NULL, *gdb_output_radix)) char *closest_symbol(ulong); ulong closest_symbol_value(ulong); #define SAME_FUNCTION(X,Y) (closest_symbol_value(X) == closest_symbol_value(Y)) void show_symbol(struct syment *, ulong, ulong); #define SHOW_LINENUM (0x1) #define SHOW_SECTION (0x2) #define SHOW_HEX_OFFS (0x4) #define SHOW_DEC_OFFS (0x8) #define SHOW_RADIX() (*gdb_output_radix == 16 ? SHOW_HEX_OFFS : SHOW_DEC_OFFS) #define SHOW_MODULE (0x10) int symbol_query(char *, char *, struct syment **); struct syment *next_symbol(char *, struct syment *); struct syment *prev_symbol(char *, struct syment *); void get_symbol_data(char *, long, void *); int try_get_symbol_data(char *, long, void *); char *value_to_symstr(ulong, char *, ulong); char *value_symbol(ulong); ulong symbol_value(char *); ulong symbol_value_module(char *, char *); struct syment *per_cpu_symbol_search(char *); int symbol_exists(char *s); int kernel_symbol_exists(char *s); struct syment *kernel_symbol_search(char *); int get_syment_array(char *, struct syment **, int); void set_temporary_radix(unsigned int, unsigned int *); void restore_current_radix(unsigned int); void dump_struct(char *, ulong, unsigned); void dump_struct_member(char *, ulong, unsigned); void dump_union(char *, ulong, unsigned); void store_module_symbols_v1(ulong, int); void store_module_symbols_v2(ulong, int); int is_datatype_command(void); int is_typedef(char *); int arg_to_datatype(char *, struct datatype_member *, ulong); void dump_symbol_table(void); void dump_struct_table(ulong); void dump_offset_table(char *, ulong); int is_elf_file(char *); int is_kernel(char *); int is_shared_object(char *); int file_elf_version(char *); int is_system_map(char *); int is_compressed_kernel(char *, char **); int select_namelist(char *); int get_array_length(char *, int *, long); int get_array_length_alt(char *, char *, int *, long); int builtin_array_length(char *, int, int *); char *get_line_number(ulong, char *, int); char *get_build_directory(char *); int datatype_exists(char *); int get_function_numargs(ulong); int is_module_name(char *, ulong *, struct load_module **); int is_module_address(ulong, char *); ulong lowest_module_address(void); ulong highest_module_address(void); int load_module_symbols(char *, char *, ulong); void delete_load_module(ulong); ulong gdb_load_module_callback(ulong, char *); char *load_module_filter(char *, int); #define LM_P_FILTER (1) #define LM_DIS_FILTER (2) long datatype_info(char *, char *, struct datatype_member *); int get_symbol_type(char *, char *, struct gnu_request *); int get_symbol_length(char *); int text_value_cache(ulong, uint32_t, uint32_t *); int text_value_cache_byte(ulong, unsigned char *); void dump_text_value_cache(int); void clear_text_value_cache(void); void dump_numargs_cache(void); int patch_kernel_symbol(struct gnu_request *); struct syment *generic_machdep_value_to_symbol(ulong, ulong *); long OFFSET_verify(long, char *, char *, int, char *); long SIZE_verify(long, char *, char *, int, char *); long OFFSET_option(long, long, char *, char *, int, char *, char *); long SIZE_option(long, long, char *, char *, int, char *, char *); void dump_trace(void **); int enumerator_value(char *, long *); int dump_enumerator_list(char *); struct load_module *init_module_function(ulong); /* * memory.c */ void mem_init(void); void vm_init(void); int readmem(ulonglong, int, void *, long, char *, ulong); int writemem(ulonglong, int, void *, long, char *, ulong); int generic_verify_paddr(uint64_t); int read_dev_mem(int, void *, int, ulong, physaddr_t); int read_memory_device(int, void *, int, ulong, physaddr_t); int read_mclx_dumpfile(int, void *, int, ulong, physaddr_t); int read_lkcd_dumpfile(int, void *, int, ulong, physaddr_t); int read_daemon(int, void *, int, ulong, physaddr_t); int write_dev_mem(int, void *, int, ulong, physaddr_t); int write_memory_device(int, void *, int, ulong, physaddr_t); int write_mclx_dumpfile(int, void *, int, ulong, physaddr_t); int write_lkcd_dumpfile(int, void *, int, ulong, physaddr_t); int write_daemon(int, void *, int, ulong, physaddr_t); int kvtop(struct task_context *, ulong, physaddr_t *, int); int uvtop(struct task_context *, ulong, physaddr_t *, int); void do_vtop(ulong, struct task_context *, ulong); void raw_stack_dump(ulong, ulong); void raw_data_dump(ulong, long, int); int accessible(ulong); ulong vm_area_dump(ulong, ulong, ulong, struct reference *); #define IN_TASK_VMA(TASK,VA) (vm_area_dump((TASK), UVADDR|VERIFY_ADDR, (VA), 0)) char *fill_vma_cache(ulong); void clear_vma_cache(void); void dump_vma_cache(ulong); int is_page_ptr(ulong, physaddr_t *); void dump_vm_table(int); int read_string(ulong, char *, int); void get_task_mem_usage(ulong, struct task_mem_usage *); char *get_memory_size(char *); uint64_t generic_memory_size(void); char *swap_location(ulonglong, char *); void clear_swap_info_cache(void); uint memory_page_size(void); void force_page_size(char *); ulong first_vmalloc_address(void); ulong last_vmalloc_address(void); int in_vmlist_segment(ulong); int phys_to_page(physaddr_t, ulong *); int generic_get_kvaddr_ranges(struct vaddr_range *); int l1_cache_size(void); int dumpfile_memory(int); #define DUMPFILE_MEM_USED (1) #define DUMPFILE_FREE_MEM (2) #define DUMPFILE_MEM_DUMP (3) #define DUMPFILE_ENVIRONMENT (4) uint64_t total_node_memory(void); int generic_is_kvaddr(ulong); int generic_is_uvaddr(ulong, struct task_context *); void fill_stackbuf(struct bt_info *); void alter_stackbuf(struct bt_info *); int vaddr_type(ulong, struct task_context *); char *format_stack_entry(struct bt_info *bt, char *, ulong, ulong); int in_user_stack(ulong, ulong); /* * filesys.c */ void fd_init(void); void vfs_init(void); int is_a_tty(char *); int file_exists(char *, struct stat *); int file_readable(char *); int is_directory(char *); char *search_directory_tree(char *, char *, int); void open_tmpfile(void); void close_tmpfile(void); void open_tmpfile2(void); void set_tmpfile2(FILE *); void close_tmpfile2(void); void open_files_dump(ulong, int, struct reference *); void get_pathname(ulong, char *, int, int, ulong); char *vfsmount_devname(ulong, char *, int); ulong file_to_dentry(ulong); ulong file_to_vfsmnt(ulong); int get_proc_version(void); int file_checksum(char *, long *); void dump_filesys_table(int); char *fill_file_cache(ulong); void clear_file_cache(void); char *fill_dentry_cache(ulong); void clear_dentry_cache(void); char *fill_inode_cache(ulong); void clear_inode_cache(void); int monitor_memory(long *, long *, long *, long *); int is_readable(char *); #define RADIX_TREE_COUNT (1) #define RADIX_TREE_SEARCH (2) #define RADIX_TREE_DUMP (3) #define RADIX_TREE_GATHER (4) struct radix_tree_pair { ulong index; void *value; }; ulong do_radix_tree(ulong, int, struct radix_tree_pair *); int file_dump(ulong, ulong, ulong, int, int); #define DUMP_FULL_NAME 1 #define DUMP_INODE_ONLY 2 #define DUMP_DENTRY_ONLY 4 #define DUMP_EMPTY_FILE 8 #endif /* !GDB_COMMON */ int same_file(char *, char *); #ifndef GDB_COMMON int cleanup_memory_driver(void); /* * help.c */ #define HELP_COLUMNS 5 #define START_OF_HELP_DATA(X) "START_OF_HELP_DATA" X #define END_OF_HELP_DATA "END_OF_HELP_DATA" void help_init(void); void cmd_usage(char *, int); void display_version(void); void display_help_screen(char *); #ifdef ARM #define dump_machdep_table(X) arm_dump_machdep_table(X) #endif #ifdef ARM64 #define dump_machdep_table(X) arm64_dump_machdep_table(X) #endif #ifdef X86 #define dump_machdep_table(X) x86_dump_machdep_table(X) #endif #ifdef ALPHA #define dump_machdep_table(X) alpha_dump_machdep_table(X) #endif #ifdef PPC #define dump_machdep_table(X) ppc_dump_machdep_table(X) #endif #ifdef IA64 #define dump_machdep_table(X) ia64_dump_machdep_table(X) #endif #ifdef S390 #define dump_machdep_table(X) s390_dump_machdep_table(X) #endif #ifdef S390X #define dump_machdep_table(X) s390x_dump_machdep_table(X) #endif #ifdef X86_64 #define dump_machdep_table(X) x86_64_dump_machdep_table(X) #endif #ifdef PPC64 #define dump_machdep_table(X) ppc64_dump_machdep_table(X) #endif extern char *help_pointer[]; extern char *help_alias[]; extern char *help_ascii[]; extern char *help_bt[]; extern char *help_btop[]; extern char *help_dev[]; extern char *help_dis[]; extern char *help_eval[]; extern char *help_exit[]; extern char *help_extend[]; extern char *help_files[]; extern char *help_foreach[]; extern char *help_fuser[]; extern char *help_gdb[]; extern char *help_help[]; extern char *help_irq[]; extern char *help_kmem[]; extern char *help__list[]; extern char *help_tree[]; extern char *help_log[]; extern char *help_mach[]; extern char *help_mod[]; extern char *help_mount[]; extern char *help_net[]; extern char *help_p[]; extern char *help_ps[]; extern char *help_pte[]; extern char *help_ptob[]; extern char *help_ptov[]; extern char *help_quit[]; extern char *help_rd[]; extern char *help_repeat[]; extern char *help_runq[]; extern char *help_ipcs[]; extern char *help_search[]; extern char *help_set[]; extern char *help_sig[]; extern char *help_struct[]; extern char *help_swap[]; extern char *help_sym[]; extern char *help_sys[]; extern char *help_task[]; extern char *help_timer[]; extern char *help_union[]; extern char *help_vm[]; extern char *help_vtop[]; extern char *help_waitq[]; extern char *help_whatis[]; extern char *help_wr[]; #if defined(S390) || defined(S390X) extern char *help_s390dbf[]; #endif extern char *help_map[]; /* * task.c */ void task_init(void); int set_context(ulong, ulong); void show_context(struct task_context *); ulong pid_to_task(ulong); ulong task_to_pid(ulong); int task_exists(ulong); int is_kernel_thread(ulong); int is_idle_thread(ulong); void get_idle_threads(ulong *, int); char *task_state_string(ulong, char *, int); ulong task_flags(ulong); ulong task_state(ulong); ulong task_mm(ulong, int); ulong task_tgid(ulong); ulonglong task_last_run(ulong); ulong vaddr_in_task_struct(ulong); int comm_exists(char *); struct task_context *task_to_context(ulong); struct task_context *pid_to_context(ulong); struct task_context *tgid_to_context(ulong); ulong stkptr_to_task(ulong); ulong task_to_thread_info(ulong); ulong task_to_stackbase(ulong); int str_to_context(char *, ulong *, struct task_context **); #define STR_PID (0x1) #define STR_TASK (0x2) #define STR_INVALID (0x4) char *get_panicmsg(char *); char *task_cpu(int, char *, int); void print_task_header(FILE *, struct task_context *, int); ulong get_active_task(int); int is_task_active(ulong); int is_panic_thread(ulong); int get_panic_ksp(struct bt_info *, ulong *); void foreach(struct foreach_data *); int pid_exists(ulong); #define TASKS_PER_PID(x) pid_exists(x) char *fill_task_struct(ulong); #define IS_LAST_TASK_READ(task) ((ulong)(task) == tt->last_task_read) char *fill_thread_info(ulong); #define IS_LAST_THREAD_INFO_READ(ti) ((ulong)(ti) == tt->last_thread_info_read) char *fill_mm_struct(ulong); #define IS_LAST_MM_READ(mm) ((ulong)(mm) == tt->last_mm_read) void do_task(ulong, ulong, struct reference *, unsigned int); void clear_task_cache(void); int get_active_set(void); void clear_active_set(void); void do_sig(ulong, ulong, struct reference *); void modify_signame(int, char *, char *); ulong generic_get_stackbase(ulong); ulong generic_get_stacktop(ulong); void dump_task_table(int); void sort_context_array(void); int in_irq_ctx(ulonglong, int, ulong); /* * extensions.c */ void register_extension(struct command_table_entry *); void dump_extension_table(int); void load_extension(char *); void unload_extension(char *); void preload_extensions(void); /* Hooks for sial */ unsigned long get_curtask(void); char *crash_global_cmd(void); struct command_table_entry *crash_cmd_table(void); /* * kernel.c */ void kernel_init(void); void module_init(void); void verify_version(void); void verify_spinlock(void); void non_matching_kernel(void); struct load_module *modref_to_load_module(char *); int load_module_symbols_helper(char *); void unlink_module(struct load_module *); int check_specified_module_tree(char *, char *); int is_system_call(char *, ulong); void generic_dump_irq(int); void generic_get_irq_affinity(int); void generic_show_interrupts(int, ulong *); int generic_dis_filter(ulong, char *, unsigned int); int kernel_BUG_encoding_bytes(void); void display_sys_stats(void); char *get_uptime(char *, ulonglong *); void clone_bt_info(struct bt_info *, struct bt_info *, struct task_context *); void dump_kernel_table(int); void dump_bt_info(struct bt_info *, char *where); void dump_log(int); #define SHOW_LOG_LEVEL (0x1) #define SHOW_LOG_DICT (0x2) #define SHOW_LOG_TEXT (0x4) void set_cpu(int); void clear_machdep_cache(void); struct stack_hook *gather_text_list(struct bt_info *); int get_cpus_online(void); int get_cpus_present(void); int get_cpus_possible(void); int get_highest_cpu_online(void); int get_highest_cpu_present(void); int get_cpus_to_display(void); void get_log_from_vmcoreinfo(char *file, char *(*)(const char *)); int in_cpu_map(int, int); void paravirt_init(void); void print_stack_text_syms(struct bt_info *, ulong, ulong); void back_trace(struct bt_info *); int in_alternate_stack(int, ulong); ulong cpu_map_addr(const char *type); #define BT_RAW (0x1ULL) #define BT_SYMBOLIC_ARGS (0x2ULL) #define BT_FULL (0x4ULL) #define BT_TEXT_SYMBOLS (0x8ULL) #define BT_TEXT_SYMBOLS_PRINT (0x10ULL) #define BT_TEXT_SYMBOLS_NOPRINT (0x20ULL) #define BT_USE_GDB (0x40ULL) #define BT_EXCEPTION_FRAME (0x80ULL) #define BT_LINE_NUMBERS (0x100ULL) #define BT_USER_EFRAME (0x200ULL) #define BT_INCOMPLETE_USER_EFRAME (BT_USER_EFRAME) #define BT_SAVE_LASTSP (0x400ULL) #define BT_FROM_EXCEPTION (0x800ULL) #define BT_FROM_CALLFRAME (0x1000ULL) #define BT_EFRAME_SEARCH (0x2000ULL) #define BT_SPECULATE (0x4000ULL) #define BT_FRAMESIZE_DISABLE (BT_SPECULATE) #define BT_RESCHEDULE (0x8000ULL) #define BT_SCHEDULE (BT_RESCHEDULE) #define BT_RET_FROM_SMP_FORK (0x10000ULL) #define BT_STRACE (0x20000ULL) #define BT_KSTACKP (0x40000ULL) #define BT_LOOP_TRAP (0x80000ULL) #define BT_BUMP_FRAME_LEVEL (0x100000ULL) #define BT_EFRAME_COUNT (0x200000ULL) #define BT_CPU_IDLE (0x400000ULL) #define BT_WRAP_TRAP (0x800000ULL) #define BT_KERNEL_THREAD (0x1000000ULL) #define BT_ERROR_MASK (BT_LOOP_TRAP|BT_WRAP_TRAP|BT_KERNEL_THREAD|BT_CPU_IDLE) #define BT_UNWIND_ERROR (0x2000000ULL) #define BT_OLD_BACK_TRACE (0x4000000ULL) #define BT_FRAMESIZE_DEBUG (0x8000000ULL) #define BT_CONTEXT_SWITCH (0x10000000ULL) #define BT_HARDIRQ (0x20000000ULL) #define BT_SOFTIRQ (0x40000000ULL) #define BT_CHECK_CALLER (0x80000000ULL) #define BT_NO_CHECK_CALLER (0x100000000ULL) #define BT_EXCEPTION_STACK (0x200000000ULL) #define BT_IRQSTACK (0x400000000ULL) #define BT_DUMPFILE_SEARCH (0x800000000ULL) #define BT_EFRAME_SEARCH2 (0x1000000000ULL) #define BT_START (0x2000000000ULL) #define BT_TEXT_SYMBOLS_ALL (0x4000000000ULL) #define BT_XEN_STOP_THIS_CPU (0x8000000000ULL) #define BT_THREAD_GROUP (0x10000000000ULL) #define BT_SAVE_EFRAME_IP (0x20000000000ULL) #define BT_FULL_SYM_SLAB (0x40000000000ULL) #define BT_KDUMP_ELF_REGS (0x80000000000ULL) #define BT_USER_SPACE (0x100000000000ULL) #define BT_KERNEL_SPACE (0x200000000000ULL) #define BT_FULL_SYM_SLAB2 (0x400000000000ULL) #define BT_EFRAME_TARGET (0x800000000000ULL) #define BT_SYMBOL_OFFSET (BT_SYMBOLIC_ARGS) #define BT_REF_HEXVAL (0x1) #define BT_REF_SYMBOL (0x2) #define BT_REF_FOUND (0x4) #define BT_REFERENCE_CHECK(X) ((X)->ref) #define BT_REFERENCE_FOUND(X) ((X)->ref && ((X)->ref->cmdflags & BT_REF_FOUND)) #define NO_MODULES() \ (!kt->module_list || (kt->module_list == kt->kernel_module)) #define USER_EFRAME_ADDR(task) \ ((ulong)task + UNION_SIZE("task_union") - SIZE(pt_regs)) struct remote_file { char *filename; char *local; int fd; int flags; int type; long csum; off_t size; }; #define REMOTE_VERBOSE (O_RDWR << 1) #define REMOTE_COPY_DONE (REMOTE_VERBOSE << 1) #define TYPE_ELF (REMOTE_VERBOSE << 2) #define TYPE_DEVMEM (REMOTE_VERBOSE << 3) #define TYPE_MCLXCD (REMOTE_VERBOSE << 4) #define TYPE_LKCD (REMOTE_VERBOSE << 5) #define TYPE_S390D (REMOTE_VERBOSE << 6) #define TYPE_NETDUMP (REMOTE_VERBOSE << 7) ulonglong xen_m2p(ulonglong); void read_in_kernel_config(int); #define IKCFG_INIT (0) #define IKCFG_READ (1) #define IKCFG_SETUP (2) #define IKCFG_FREE (3) int get_kernel_config(char *, char **); enum { IKCONFIG_N, IKCONFIG_Y, IKCONFIG_M, IKCONFIG_STR, }; #define MAGIC_START "IKCFG_ST" #define MAGIC_END "IKCFG_ED" #define MAGIC_SIZE (sizeof(MAGIC_START) - 1) /* * dev.c */ void dev_init(void); void dump_dev_table(void); #ifdef ARM void arm_init(int); void arm_dump_machdep_table(ulong); int arm_is_vmalloc_addr(ulong); void arm_dump_backtrace_entry(struct bt_info *, int, ulong, ulong); #define display_idt_table() \ error(FATAL, "-d option is not applicable to ARM architecture\n") struct arm_pt_regs { ulong uregs[18]; }; #define ARM_cpsr uregs[16] #define ARM_pc uregs[15] #define ARM_lr uregs[14] #define ARM_sp uregs[13] #define ARM_ip uregs[12] #define ARM_fp uregs[11] #define ARM_r10 uregs[10] #define ARM_r9 uregs[9] #define ARM_r8 uregs[8] #define ARM_r7 uregs[7] #define ARM_r6 uregs[6] #define ARM_r5 uregs[5] #define ARM_r4 uregs[4] #define ARM_r3 uregs[3] #define ARM_r2 uregs[2] #define ARM_r1 uregs[1] #define ARM_r0 uregs[0] #define ARM_ORIG_r0 uregs[17] #define KSYMS_START (0x1) #define PHYS_BASE (0x2) #define PGTABLE_V2 (0x4) #define IDMAP_PGD (0x8) #define KVBASE_MASK (0x1ffffff) struct machine_specific { ulong phys_base; ulong vmalloc_start_addr; ulong modules_vaddr; ulong modules_end; ulong kernel_text_start; ulong kernel_text_end; ulong exception_text_start; ulong exception_text_end; struct arm_pt_regs *crash_task_regs; int unwind_index_prel31; }; int init_unwind_tables(void); void unwind_backtrace(struct bt_info *); #endif /* ARM */ /* * arm64.c */ #ifdef ARM64 void arm64_init(int); void arm64_dump_machdep_table(ulong); int arm64_IS_VMALLOC_ADDR(ulong); #endif /* * alpha.c */ #ifdef ALPHA void alpha_init(int); void alpha_dump_machdep_table(ulong); #define display_idt_table() \ error(FATAL, "-d option is not applicable to alpha architecture\n") #define HWRESET_TASK(X) ((machdep->flags & HWRESET) && is_task_active(X) && \ (task_to_context(X)->processor == 0)) #endif /* * x86.c */ #ifdef X86 void x86_init(int); void x86_dump_machdep_table(ulong); void x86_display_idt_table(void); #define display_idt_table() x86_display_idt_table() #define KSYMS_START (0x1) void x86_dump_eframe_common(struct bt_info *bt, ulong *, int); char *x86_function_called_by(ulong); struct syment *x86_jmp_error_code(ulong); struct syment *x86_text_lock_jmp(ulong, ulong *); struct machine_specific { ulong *idt_table; ulong entry_tramp_start; ulong entry_tramp_end; physaddr_t entry_tramp_start_phys; ulonglong last_pmd_read_PAE; ulonglong last_ptbl_read_PAE; ulong page_protnone; int max_numnodes; ulong *remap_start_vaddr; ulong *remap_end_vaddr; ulong *remap_start_pfn; }; struct syment *x86_is_entry_tramp_address(ulong, ulong *); #endif /* * x86_64.c */ #ifdef X86_64 void x86_64_init(int); void x86_64_dump_machdep_table(ulong); ulong x86_64_PTOV(ulong); ulong x86_64_VTOP(ulong); int x86_64_IS_VMALLOC_ADDR(ulong); void x86_64_display_idt_table(void); #define display_idt_table() x86_64_display_idt_table() long x86_64_exception_frame(ulong, ulong, char *, struct bt_info *, FILE *); #define EFRAME_INIT (0) struct x86_64_pt_regs_offsets { long r15; long r14; long r13; long r12; long rbp; long rbx; /* arguments: non interrupts/non tracing syscalls only save upto here*/ long r11; long r10; long r9; long r8; long rax; long rcx; long rdx; long rsi; long rdi; long orig_rax; /* end of arguments */ /* cpu exception frame or undefined */ long rip; long cs; long eflags; long rsp; long ss; }; #define MAX_EXCEPTION_STACKS 7 #define NMI_STACK 2 /* ebase[] index to NMI exception stack */ #define DEBUG_STACK 3 /* ebase[] index to DEBUG exception stack */ struct x86_64_stkinfo { ulong ebase[NR_CPUS][MAX_EXCEPTION_STACKS]; int esize[MAX_EXCEPTION_STACKS]; ulong ibase[NR_CPUS]; int isize; }; struct machine_specific { ulong userspace_top; ulong page_offset; ulong vmalloc_start_addr; ulong vmalloc_end; ulong vmemmap_vaddr; ulong vmemmap_end; ulong modules_vaddr; ulong modules_end; ulong phys_base; char *pml4; char *upml; ulong last_upml_read; ulong last_pml4_read; char *irqstack; ulong irq_eframe_link; struct x86_64_pt_regs_offsets pto; struct x86_64_stkinfo stkinfo; ulong *current; ulong *crash_nmi_rsp; ulong vsyscall_page; ulong thread_return; ulong page_protnone; ulong GART_start; ulong GART_end; }; #define KSYMS_START (0x1) #define PT_REGS_INIT (0x2) #define VM_ORIG (0x4) #define VM_2_6_11 (0x8) #define VM_XEN (0x10) #define NO_TSS (0x20) #define SCHED_TEXT (0x40) #define PHYS_BASE (0x80) #define VM_XEN_RHEL4 (0x100) #define FRAMEPOINTER (0x200) #define GART_REGION (0x400) #define VM_FLAGS (VM_ORIG|VM_2_6_11|VM_XEN|VM_XEN_RHEL4) #define _2MB_PAGE_MASK (~((MEGABYTES(2))-1)) #endif #if defined(X86) || defined(X86_64) /* * unwind_x86_32_64.c */ void init_unwind_table(void); int dwarf_backtrace(struct bt_info *, int, ulong); void dwarf_debug(struct bt_info *); int dwarf_print_stack_entry(struct bt_info *, int); #endif /* * ppc64.c */ #ifdef PPC64 /* * This structure was copied from kernel source * in include/asm-ppc/ptrace.h */ struct ppc64_pt_regs { long gpr[32]; long nip; long msr; long orig_gpr3; /* Used for restarting system calls */ long ctr; long link; long xer; long ccr; long mq; /* 601 only (not used at present) */ /* Used on APUS to hold IPL value. */ long trap; /* Reason for being here */ long dar; /* Fault registers */ long dsisr; long result; /* Result of a system call */ }; struct ppc64_vmemmap { unsigned long phys; unsigned long virt; }; /* * Used to store the HW interrupt stack. It is only for 2.4. */ struct machine_specific { ulong hwintrstack[NR_CPUS]; char *hwstackbuf; uint hwstacksize; char *level4; ulong last_level4_read; uint l4_index_size; uint l3_index_size; uint l2_index_size; uint l1_index_size; uint ptrs_per_l3; uint ptrs_per_l2; uint ptrs_per_l1; uint l4_shift; uint l3_shift; uint l2_shift; uint l1_shift; uint pte_shift; uint l2_masked_bits; int vmemmap_cnt; int vmemmap_psize; ulong vmemmap_base; struct ppc64_vmemmap *vmemmap_list; ulong _page_present; ulong _page_user; ulong _page_rw; ulong _page_guarded; ulong _page_coherent; ulong _page_no_cache; ulong _page_writethru; ulong _page_dirty; ulong _page_accessed; int (*is_kvaddr)(ulong); int (*is_vmaddr)(ulong); }; #define IS_LAST_L4_READ(l4) ((ulong)(l4) == machdep->machspec->last_level4_read) #define FILL_L4(L4, TYPE, SIZE) \ if (!IS_LAST_L4_READ(L4)) { \ readmem((ulonglong)((ulong)(L4)), TYPE, machdep->machspec->level4, \ SIZE, "level4 page", FAULT_ON_ERROR); \ machdep->machspec->last_level4_read = (ulong)(L4); \ } void ppc64_init(int); void ppc64_dump_machdep_table(ulong); #define display_idt_table() \ error(FATAL, "-d option is not applicable to PowerPC architecture\n") #define KSYMS_START (0x1) #define VM_ORIG (0x2) #define VMEMMAP_AWARE (0x4) #define BOOK3E (0x8) #define REGION_SHIFT (60UL) #define REGION_ID(addr) (((unsigned long)(addr)) >> REGION_SHIFT) #define VMEMMAP_REGION_ID (0xfUL) #endif /* * ppc.c */ #ifdef PPC void ppc_init(int); void ppc_dump_machdep_table(ulong); void ppc_relocate_nt_prstatus_percpu(void **, uint *); #define display_idt_table() \ error(FATAL, "-d option is not applicable to PowerPC architecture\n") #define KSYMS_START (0x1) /* This should match PPC_FEATURE_BOOKE from include/asm-powerpc/cputable.h */ #define CPU_BOOKE (0x00008000) #else #define ppc_relocate_nt_prstatus_percpu(X,Y) do {} while (0) #endif /* * lkcd_fix_mem.c */ struct _dump_header_asm_s; struct _dump_header_s; ulong get_lkcd_switch_stack(ulong); int fix_addr_v8(struct _dump_header_asm_s *); int lkcd_dump_init_v8_arch(struct _dump_header_s *dh); int fix_addr_v7(int); int get_lkcd_regs_for_cpu_arch(int cpu, ulong *eip, ulong *esp); int lkcd_get_kernel_start_v8(ulong *addr); /* * lkcd_v8.c */ int get_lkcd_regs_for_cpu_v8(struct bt_info *bt, ulong *eip, ulong *esp); /* * ia64.c */ #ifdef IA64 void ia64_init(int); void ia64_dump_machdep_table(ulong); void ia64_dump_line_number(ulong); ulong ia64_get_switch_stack(ulong); void ia64_exception_frame(ulong, struct bt_info *bt); ulong ia64_PTOV(ulong); ulong ia64_VTOP(ulong); int ia64_IS_VMALLOC_ADDR(ulong); #define display_idt_table() \ error(FATAL, "-d option TBD on ia64 architecture\n"); int ia64_in_init_stack(ulong addr); int ia64_in_mca_stack_hyper(ulong addr, struct bt_info *bt); physaddr_t ia64_xen_kdump_p2m(struct xen_kdump_data *xkd, physaddr_t pseudo); #define OLD_UNWIND (0x1) /* CONFIG_IA64_NEW_UNWIND not turned on */ #define NEW_UNWIND (0x2) /* CONFIG_IA64_NEW_UNWIND turned on */ #define NEW_UNW_V1 (0x4) #define NEW_UNW_V2 (0x8) #define NEW_UNW_V3 (0x10) #define UNW_OUT_OF_SYNC (0x20) /* shared data structures out of sync */ #define UNW_READ (0x40) /* kernel unw has been read successfully */ #define MEM_LIMIT (0x80) #define UNW_PTREGS (0x100) #define UNW_R0 (0x200) #undef IA64_RBS_OFFSET #undef IA64_STK_OFFSET #define IA64_RBS_OFFSET ((SIZE(task_struct) + 15) & ~15) #define IA64_STK_OFFSET (STACKSIZE()) struct machine_specific { ulong cpu_data_address; ulong unimpl_va_mask; ulong unimpl_pa_mask; long unw_tables_offset; long unw_kernel_table_offset; long unw_pt_regs_offsets; int script_index; struct unw_script *script_cache; ulong script_cache_fills; ulong script_cache_hits; void *unw; ulong mem_limit; ulong kernel_region; ulong kernel_start; ulong phys_start; ulong vmalloc_start; char *ia64_memmap; uint64_t efi_memmap_size; uint64_t efi_memdesc_size; void (*unwind_init)(void); void (*unwind)(struct bt_info *); void (*dump_unwind_stats)(void); int (*unwind_debug)(ulong); int ia64_init_stack_size; }; /* * unwind.c */ void unwind_init_v1(void); void unwind_v1(struct bt_info *); void dump_unwind_stats_v1(void); int unwind_debug_v1(ulong); void unwind_init_v2(void); void unwind_v2(struct bt_info *); void dump_unwind_stats_v2(void); int unwind_debug_v2(ulong); void unwind_init_v3(void); void unwind_v3(struct bt_info *); void dump_unwind_stats_v3(void); int unwind_debug_v3(ulong); #endif /* IA64 */ /* * s390.c */ #ifdef S390 void s390_init(int); void s390_dump_machdep_table(ulong); #define display_idt_table() \ error(FATAL, "-d option is not applicable to S390 architecture\n") #define KSYMS_START (0x1) #endif /* * s390_dump.c */ int is_s390_dump(char *); FILE* s390_dump_init(char *); int read_s390_dumpfile(int, void *, int, ulong, physaddr_t); int write_s390_dumpfile(int, void *, int, ulong, physaddr_t); uint s390_page_size(void); int s390_memory_used(void); int s390_free_memory(void); int s390_memory_dump(FILE *); ulong get_s390_panic_task(void); void get_s390_panicmsg(char *); /* * s390x.c */ #ifdef S390X void s390x_init(int); void s390x_dump_machdep_table(ulong); #define display_idt_table() \ error(FATAL, "-d option is not applicable to S390X architecture\n") #define KSYMS_START (0x1) #endif /* * netdump.c */ int is_netdump(char *, ulong); uint netdump_page_size(void); int read_netdump(int, void *, int, ulong, physaddr_t); int write_netdump(int, void *, int, ulong, physaddr_t); int netdump_free_memory(void); int netdump_memory_used(void); int netdump_init(char *, FILE *); ulong get_netdump_panic_task(void); ulong get_netdump_switch_stack(ulong); FILE *set_netdump_fp(FILE *); int netdump_memory_dump(FILE *); void get_netdump_regs(struct bt_info *, ulong *, ulong *); int is_partial_netdump(void); void get_netdump_regs_x86(struct bt_info *, ulong *, ulong *); void get_netdump_regs_x86_64(struct bt_info *, ulong *, ulong *); void dump_registers_for_elf_dumpfiles(void); struct vmcore_data; struct vmcore_data *get_kdump_vmcore_data(void); int read_kdump(int, void *, int, ulong, physaddr_t); int write_kdump(int, void *, int, ulong, physaddr_t); int is_kdump(char *, ulong); int kdump_init(char *, FILE *); ulong get_kdump_panic_task(void); uint kdump_page_size(void); int kdump_free_memory(void); int kdump_memory_used(void); int kdump_memory_dump(FILE *); void get_kdump_regs(struct bt_info *, ulong *, ulong *); void xen_kdump_p2m_mfn(char *); int is_sadump_xen(void); void set_xen_phys_start(char *); ulong xen_phys_start(void); int xen_major_version(void); int xen_minor_version(void); int get_netdump_arch(void); int exist_regs_in_elf_notes(struct task_context *); void *get_regs_from_elf_notes(struct task_context *); void map_cpus_to_prstatus(void); int arm_kdump_phys_base(ulong *); int is_proc_kcore(char *, ulong); int proc_kcore_init(FILE *); int read_proc_kcore(int, void *, int, ulong, physaddr_t); int write_proc_kcore(int, void *, int, ulong, physaddr_t); int kcore_memory_dump(FILE *); void dump_registers_for_qemu_mem_dump(void); void kdump_backup_region_init(void); struct ramdump_def { char *path; ulong start_paddr; ulong size; }; char *ramdump_to_elf(struct ramdump_def *ramdump, int nodes, char *elf); /* * diskdump.c */ int is_diskdump(char *); uint diskdump_page_size(void); int read_diskdump(int, void *, int, ulong, physaddr_t); int write_diskdump(int, void *, int, ulong, physaddr_t); int diskdump_free_memory(void); int diskdump_memory_used(void); int diskdump_init(char *, FILE *); ulong get_diskdump_panic_task(void); ulong get_diskdump_switch_stack(ulong); int diskdump_memory_dump(FILE *); FILE *set_diskdump_fp(FILE *); void get_diskdump_regs(struct bt_info *, ulong *, ulong *); int diskdump_phys_base(unsigned long *); ulong *diskdump_flags; int is_partial_diskdump(void); int dumpfile_is_split(void); void show_split_dumpfiles(void); void x86_process_elf_notes(void *, unsigned long); void *diskdump_get_prstatus_percpu(int); void map_cpus_to_prstatus_kdump_cmprs(void); void diskdump_display_regs(int, FILE *); void process_elf32_notes(void *, ulong); void process_elf64_notes(void *, ulong); void dump_registers_for_compressed_kdump(void); /* * makedumpfile.c */ void check_flattened_format(char *file); int is_flattened_format(char *file); int read_flattened_format(int fd, off_t offset, void *buf, size_t size); void dump_flat_header(FILE *); /* * xendump.c */ int is_xendump(char *); int read_xendump(int, void *, int, ulong, physaddr_t); int write_xendump(int, void *, int, ulong, physaddr_t); uint xendump_page_size(void); int xendump_free_memory(void); int xendump_memory_used(void); int xendump_init(char *, FILE *); int xendump_memory_dump(FILE *); ulong get_xendump_panic_task(void); void get_xendump_regs(struct bt_info *, ulong *, ulong *); char *xc_core_mfn_to_page(ulong, char *); int xc_core_mfn_to_page_index(ulong); void xendump_panic_hook(char *); int read_xendump_hyper(int, void *, int, ulong, physaddr_t); struct xendump_data *get_xendump_data(void); /* * kvmdump.c */ int is_kvmdump(char *); int is_kvmdump_mapfile(char *); int kvmdump_init(char *, FILE *); int read_kvmdump(int, void *, int, ulong, physaddr_t); int write_kvmdump(int, void *, int, ulong, physaddr_t); int kvmdump_free_memory(void); int kvmdump_memory_used(void); int kvmdump_memory_dump(FILE *); void get_kvmdump_regs(struct bt_info *, ulong *, ulong *); ulong get_kvmdump_panic_task(void); int kvmdump_phys_base(unsigned long *); void kvmdump_display_regs(int, FILE *); void set_kvmhost_type(char *); void set_kvm_iohole(char *); struct kvm_register_set { union { uint32_t cs; uint32_t ss; uint32_t ds; uint32_t es; uint32_t fs; uint32_t gs; uint64_t ip; uint64_t flags; uint64_t regs[16]; } x86; }; int get_kvm_register_set(int, struct kvm_register_set *); /* * sadump.c */ int is_sadump(char *); uint sadump_page_size(void); int read_sadump(int, void *, int, ulong, physaddr_t); int write_sadump(int, void *, int, ulong, physaddr_t); int sadump_init(char *, FILE *); int sadump_is_diskset(void); ulong get_sadump_panic_task(void); ulong get_sadump_switch_stack(ulong); int sadump_memory_used(void); int sadump_free_memory(void); int sadump_memory_dump(FILE *); FILE *set_sadump_fp(FILE *); void get_sadump_regs(struct bt_info *bt, ulong *ipp, ulong *spp); void sadump_display_regs(int, FILE *); int sadump_phys_base(ulong *); void sadump_show_diskset(void); int sadump_is_zero_excluded(void); void sadump_set_zero_excluded(void); void sadump_unset_zero_excluded(void); struct sadump_data; struct sadump_data *get_sadump_data(void); /* * qemu.c */ int qemu_init(char *); /* * qemu-load.c */ int is_qemu_vm_file(char *); void dump_qemu_header(FILE *); /* * net.c */ void net_init(void); void dump_net_table(void); void dump_sockets_workhorse(ulong, ulong, struct reference *); /* * remote.c */ int is_remote_daemon(char *); physaddr_t get_remote_phys_base(physaddr_t, physaddr_t); physaddr_t remote_vtop(int, physaddr_t); int get_remote_regs(struct bt_info *, ulong *, ulong *); physaddr_t get_remote_cr3(int); void remote_fd_init(void); int get_remote_file(struct remote_file *); uint remote_page_size(void); int find_remote_module_objfile(struct load_module *lm, char *, char *); int remote_free_memory(void); int remote_memory_dump(int); int remote_memory_used(void); void remote_exit(void); int remote_execute(void); void remote_clear_pipeline(void); int remote_memory_read(int, char *, int, physaddr_t, int); /* * gnu_binutils.c */ /* NO LONGER IN USE */ /* * test.c */ void cmd_template(void); void foreach_test(ulong, ulong); /* * va_server.c */ int mclx_page_size(void); int vas_memory_used(void); int vas_memory_dump(FILE *); int vas_free_memory(char *); void set_vas_debug(ulong); size_t vas_write(void *, size_t); int va_server_init(char *, ulong *, ulong *, ulong *); size_t vas_read(void *, size_t); int vas_lseek(ulong, int); /* * lkcd_x86_trace.c */ int lkcd_x86_back_trace(struct bt_info *, int, FILE *); /* * lkcd_common.c */ int lkcd_dump_init(FILE *, int, char *); ulong get_lkcd_panic_task(void); void get_lkcd_panicmsg(char *); int is_lkcd_compressed_dump(char *); void dump_lkcd_environment(ulong); int lkcd_lseek(physaddr_t); long lkcd_read(void *, long); void set_lkcd_debug(ulong); FILE *set_lkcd_fp(FILE *); uint lkcd_page_size(void); int lkcd_memory_used(void); int lkcd_memory_dump(FILE *); int lkcd_free_memory(void); void lkcd_print(char *, ...); void set_remote_lkcd_panic_data(ulong, char *); void set_lkcd_nohash(void); int lkcd_load_dump_page_header(void *, ulong); void lkcd_dumpfile_complaint(uint32_t, uint32_t, int); int set_mb_benchmark(ulong); ulonglong fix_lkcd_address(ulonglong); int lkcd_get_kernel_start(ulong *addr); int get_lkcd_regs_for_cpu(struct bt_info *bt, ulong *eip, ulong *esp); /* * lkcd_v1.c */ int lkcd_dump_init_v1(FILE *, int); void dump_dump_page_v1(char *, void *); void dump_lkcd_environment_v1(ulong); uint32_t get_dp_size_v1(void); uint32_t get_dp_flags_v1(void); uint64_t get_dp_address_v1(void); /* * lkcd_v2_v3.c */ int lkcd_dump_init_v2_v3(FILE *, int); void dump_dump_page_v2_v3(char *, void *); void dump_lkcd_environment_v2_v3(ulong); uint32_t get_dp_size_v2_v3(void); uint32_t get_dp_flags_v2_v3(void); uint64_t get_dp_address_v2_v3(void); /* * lkcd_v5.c */ int lkcd_dump_init_v5(FILE *, int); void dump_dump_page_v5(char *, void *); void dump_lkcd_environment_v5(ulong); uint32_t get_dp_size_v5(void); uint32_t get_dp_flags_v5(void); uint64_t get_dp_address_v5(void); /* * lkcd_v7.c */ int lkcd_dump_init_v7(FILE *, int, char *); void dump_dump_page_v7(char *, void *); void dump_lkcd_environment_v7(ulong); uint32_t get_dp_size_v7(void); uint32_t get_dp_flags_v7(void); uint64_t get_dp_address_v7(void); /* * lkcd_v8.c */ int lkcd_dump_init_v8(FILE *, int, char *); void dump_dump_page_v8(char *, void *); void dump_lkcd_environment_v8(ulong); uint32_t get_dp_size_v8(void); uint32_t get_dp_flags_v8(void); uint64_t get_dp_address_v8(void); #ifdef LKCD_COMMON /* * Until they differ across versions, these remain usable in the common * routines in lkcd_common.c */ #define LKCD_DUMP_MAGIC_NUMBER (0xa8190173618f23edULL) #define LKCD_DUMP_MAGIC_LIVE (0xa8190173618f23cdULL) #define LKCD_DUMP_V1 (0x1) /* DUMP_VERSION_NUMBER */ #define LKCD_DUMP_V2 (0x2) /* DUMP_VERSION_NUMBER */ #define LKCD_DUMP_V3 (0x3) /* DUMP_VERSION_NUMBER */ #define LKCD_DUMP_V5 (0x5) /* DUMP_VERSION_NUMBER */ #define LKCD_DUMP_V6 (0x6) /* DUMP_VERSION_NUMBER */ #define LKCD_DUMP_V7 (0x7) /* DUMP_VERSION_NUMBER */ #define LKCD_DUMP_V8 (0x8) /* DUMP_VERSION_NUMBER */ #define LKCD_DUMP_V9 (0x9) /* DUMP_VERSION_NUMBER */ #define LKCD_DUMP_V10 (0xa) /* DUMP_VERSION_NUMBER */ #define LKCD_DUMP_VERSION_NUMBER_MASK (0xf) #define LKCD_DUMP_RAW (0x1) /* DUMP_[DH_]RAW */ #define LKCD_DUMP_COMPRESSED (0x2) /* DUMP_[DH_]COMPRESSED */ #define LKCD_DUMP_END (0x4) /* DUMP_[DH_]END */ #define LKCD_DUMP_COMPRESS_NONE (0x0) /* DUMP_COMPRESS_NONE */ #define LKCD_DUMP_COMPRESS_RLE (0x1) /* DUMP_COMPRESS_RLE */ #define LKCD_DUMP_COMPRESS_GZIP (0x2) /* DUMP_COMPRESS_GZIP */ #define LKCD_DUMP_MCLX_V0 (0x80000000) /* MCLX mod of LKCD */ #define LKCD_DUMP_MCLX_V1 (0x40000000) /* Extra page header data */ #define LKCD_OFFSET_TO_FIRST_PAGE (65536) #define MCLX_PAGE_HEADERS (4096) #define MCLX_V1_PAGE_HEADER_CACHE ((sizeof(uint64_t)) * MCLX_PAGE_HEADERS) /* * lkcd_load_dump_page_header() return values */ #define LKCD_DUMPFILE_OK (0) #define LKCD_DUMPFILE_EOF (1) #define LKCD_DUMPFILE_END (2) /* * Common handling of LKCD dump environment */ #define LKCD_CACHED_PAGES (16) #define LKCD_PAGE_HASH (32) #define LKCD_DUMP_HEADER_ONLY (1) /* arguments to lkcd_dump_environment */ #define LKCD_DUMP_PAGE_ONLY (2) #define LKCD_VALID (0x1) /* flags */ #define LKCD_REMOTE (0x2) #define LKCD_NOHASH (0x4) #define LKCD_MCLX (0x8) #define LKCD_BAD_DUMP (0x10) struct page_hash_entry { uint32_t pg_flags; uint64_t pg_addr; off_t pg_hdr_offset; struct page_hash_entry *next; }; struct page_desc { off_t offset; /* lseek offset in dump file */ }; struct physmem_zone { uint64_t start; struct page_desc *pages; }; struct fix_addrs { ulong task; ulong saddr; ulong sw; }; struct lkcd_environment { int fd; /* dumpfile file descriptor */ ulong flags; /* flags from above */ ulong debug; /* shadow of pc->debug */ FILE *fp; /* abstracted fp for fprintf */ void *dump_header; /* header stash, v1 or v2 */ void *dump_header_asm; /* architecture specific header for v2 */ void *dump_header_asm_smp; /* architecture specific header for v7 & v8 */ void *dump_page; /* current page header holder */ uint32_t version; /* version number of this dump */ uint32_t page_size; /* size of a Linux memory page */ int page_shift; /* byte address to page */ int bits; /* processor bitsize */ ulong panic_task; /* panic task address */ char *panic_string; /* pointer to stashed panic string */ uint32_t compression; /* compression type */ uint32_t (*get_dp_size)(void); /* returns current page's dp_size */ uint32_t (*get_dp_flags)(void); /* returns current page's dp_size */ uint64_t (*get_dp_address)(void); /* returns current page's dp_address*/ size_t page_header_size; /* size of version's page header */ unsigned long curpos; /* offset into current page */ uint64_t curpaddr; /* current page's physical address */ off_t curhdroffs; /* current page's header offset */ char *curbufptr; /* pointer to uncompressed page buffer */ uint64_t kvbase; /* physical-to-LKCD page address format*/ char *page_cache_buf; /* base of cached buffer pages */ char *compressed_page; /* copy of compressed page data */ int evict_index; /* next page to evict */ ulong evictions; /* total evictions done */ struct page_cache_hdr { /* header for each cached page */ uint32_t pg_flags; uint64_t pg_addr; char *pg_bufptr; ulong pg_hit_count; } page_cache_hdr[LKCD_CACHED_PAGES]; struct page_hash_entry *page_hash; ulong total_pages; ulong benchmark_pages; ulong benchmarks_done; off_t *mb_hdr_offsets; ulong total_reads; ulong cached_reads; ulong hashed_reads; ulong hashed; ulong compressed; ulong raw; /* lkcd_v7 additions */ char *dumpfile_index; /* array of offsets for each page */ int ifd; /* index file for dump (LKCD V7+) */ long memory_pages; /* Mamimum index of dump pages */ off_t page_offset_max; /* Offset of page with greatest offset seen so far */ long page_index_max; /* Index of page with greatest offset seen so far */ off_t *page_offsets; /* Pointer to huge array with seek offsets */ /* NB: There are no holes in the array */ struct physmem_zone *zones; /* Array of physical memory zones */ int num_zones; /* Number of zones initialized */ int max_zones; /* Size of the zones array */ long zoned_offsets; /* Number of stored page offsets */ uint64_t zone_mask; int zone_shift; int fix_addr_num; /* Number of active stacks to switch to saved values */ struct fix_addrs *fix_addr; /* Array of active stacks to switch to saved values */ }; #define ZONE_ALLOC 128 #define ZONE_SIZE (MEGABYTES(512)) #define MEGABYTE_ALIGNED(vaddr) (!((uint64_t)(vaddr) & MEGABYTE_MASK)) #define LKCD_PAGE_HASH_INDEX(paddr) \ (((paddr) >> lkcd->page_shift) % LKCD_PAGE_HASH) #define LKCD_PAGES_PER_MEGABYTE() (MEGABYTES(1) / lkcd->page_size) #define LKCD_PAGE_MEGABYTE(page) ((page) / LKCD_PAGES_PER_MEGABYTE()) #define LKCD_BENCHMARKS_DONE() (lkcd->benchmarks_done >= lkcd->benchmark_pages) #define LKCD_VALID_PAGE(flags) ((flags) & LKCD_VALID) extern struct lkcd_environment *lkcd; #define LKCD_DEBUG(x) (lkcd->debug >= (x)) #undef BITS #undef BITS32 #undef BITS64 #define BITS() (lkcd->bits) #define BITS32() (lkcd->bits == 32) #define BITS64() (lkcd->bits == 64) #endif /* LKCD_COMMON */ /* * gdb_interface.c */ void gdb_main_loop(int, char **); void display_gdb_banner(void); void get_gdb_version(void); void gdb_session_init(void); void gdb_interface(struct gnu_request *); int gdb_pass_through(char *, FILE *, ulong); int gdb_readmem_callback(ulong, void *, int, int); int gdb_line_number_callback(ulong, ulong, ulong); int gdb_print_callback(ulong); void gdb_error_hook(void); void restore_gdb_sanity(void); int is_gdb_command(int, ulong); char *gdb_command_string(int, char *, int); void dump_gnu_request(struct gnu_request *, int); int gdb_CRASHDEBUG(ulong); void dump_gdb_data(void); void update_gdb_hooks(void); void gdb_readnow_warning(void); int gdb_set_crash_scope(ulong, char *); extern int *gdb_output_format; extern unsigned int *gdb_print_max; extern int *gdb_prettyprint_structs; extern int *gdb_prettyprint_arrays; extern int *gdb_repeat_count_threshold; extern int *gdb_stop_print_at_null; extern unsigned int *gdb_output_radix; /* * gdb/top.c */ extern void execute_command (char *, int); #if defined(GDB_5_3) || defined(GDB_6_0) || defined(GDB_6_1) extern void (*command_loop_hook)(void); extern void (*error_hook)(void); #else extern void (*deprecated_command_loop_hook)(void); /* * gdb/exceptions.c */ extern void (*error_hook)(void); #endif /* * gdb/symtab.c */ extern void gdb_command_funnel(struct gnu_request *); /* * gdb/symfile.c */ #if defined(GDB_6_0) || defined(GDB_6_1) struct objfile; extern void (*target_new_objfile_hook)(struct objfile *); #endif /* * gdb/valprint.c */ extern unsigned output_radix; #if defined(GDB_5_3) || defined(GDB_6_0) || defined(GDB_6_1) extern int output_format; extern int prettyprint_structs; extern int prettyprint_arrays; extern int repeat_count_threshold; extern unsigned int print_max; extern int stop_print_at_null; #endif #ifdef GDB_7_6 /* * gdb/cleanups.c */ struct cleanup; extern struct cleanup *all_cleanups(void); extern void do_cleanups(struct cleanup *); #else /* * gdb/utils.c */ extern void do_cleanups(void *); #endif /* * gdb/version.c */ extern char *version; /* * gdb/disasm.c */ #ifdef GDB_5_3 extern int gdb_disassemble_from_exec; #endif /* * readline/readline.c */ #ifdef GDB_5_3 extern char *readline(char *); #else extern char *readline(const char *); #endif extern int rl_editing_mode; /* * readline/history.c */ extern int history_offset; /* * external gdb routines */ extern int gdb_main_entry(int, char **); #ifdef GDB_5_3 extern unsigned long calc_crc32(unsigned long, unsigned char *, size_t); #else extern unsigned long gnu_debuglink_crc32 (unsigned long, unsigned char *, size_t); #endif extern int have_partial_symbols(void); extern int have_full_symbols(void); #if defined(X86) || defined(X86_64) || defined(IA64) #define XEN_HYPERVISOR_ARCH #endif #endif /* !GDB_COMMON */
/* help.c - core analysis suite * * Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc. * Copyright (C) 2002-2014 David Anderson * Copyright (C) 2002-2014 Red Hat, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include "defs.h" static void reshuffle_cmdlist(void); static int sort_command_name(const void *, const void *); static void display_commands(void); static void display_copying_info(void); static void display_warranty_info(void); static void display_output_info(void); static void display_input_info(void); static void display_README(void); static char *gnu_public_license[]; static char *gnu_public_license_v3[]; static char *version_info[]; static char *output_info[]; static char *input_info[]; static char *README[]; static void dump_registers(void); #define GPLv2 2 #define GPLv3 3 #if defined(GDB_5_3) || defined(GDB_6_0) || defined(GDB_6_1) static int GPL_version = GPLv2; #else static int GPL_version = GPLv3; #endif static char *program_usage_info[] = { "", "USAGE:", "", " crash [OPTION]... NAMELIST MEMORY-IMAGE (dumpfile form)", " crash [OPTION]... [NAMELIST] (live system form)", "", "OPTIONS:", "", " NAMELIST", " This is a pathname to an uncompressed kernel image (a vmlinux", " file), or a Xen hypervisor image (a xen-syms file) which has", " been compiled with the \"-g\" option. If using the dumpfile form,", " a vmlinux file may be compressed in either gzip or bzip2 formats.", "", " MEMORY-IMAGE", " A kernel core dump file created by the netdump, diskdump, LKCD", " kdump, xendump or kvmdump facilities.", "", " If a MEMORY-IMAGE argument is not entered, the session will be", " invoked on the live system, which typically requires root privileges", " because of the device file used to access system RAM. By default, ", " /dev/crash will be used if it exists. If it does not exist, then ", " /dev/mem will be used; but if the kernel has been configured with ", " CONFIG_STRICT_DEVMEM, then /proc/kcore will be used. It is permissible", " to explicitly enter /dev/crash, /dev/mem or /proc/kcore.", "", " mapfile", " If the NAMELIST file is not the same kernel that is running", " (live system form), or the kernel that was running when the system", " crashed (dumpfile form), then the System.map file of the original ", " kernel should be entered on the command line.", "", " -h [option]", " --help [option]", " Without an option argument, display a crash usage help message.", " If the option argument is a crash command name, the help page", " for that command is displayed. If it is the string \"input\", a", " page describing the various crash command line input options is", " displayed. If it is the string \"output\", a page describing command", " line output options is displayed. If it is the string \"all\", then", " all of the possible help messages are displayed. After the help", " message is displayed, crash exits.", "", " -s ", " Silently proceed directly to the \"crash>\" prompt without displaying", " any version, GPL, or crash initialization data during startup, and by", " default, runtime command output is not passed to any scrolling command.", "", " -i file", " Execute the command(s) contained in \"file\" prior to displaying ", " the \"crash>\" prompt for interactive user input.", "", " -d num ", " Set the internal debug level. The higher the number, the more", " debugging data will be printed when crash initializes and runs.", "", " -S ", " Use /boot/System.map as the mapfile.", "", " -e vi | emacs", " Set the readline(3) command line editing mode to \"vi\" or \"emacs\". ", " The default editing mode is \"vi\".", "", " -f ", " Force the usage of a compressed vmlinux file if its original", " name does not start with \"vmlinux\".", "", " -k ", " Indicate that the NAMELIST file is an LKCD \"Kerntypes\" debuginfo file.", "", " -g [namelist]", " Determine if a vmlinux or xen-syms namelist file contains debugging data.", "", " -t ", " Display the system-crash timestamp and exit.", "", " -L ", " Attempt to lock all of its virtual address space into memory by", " calling mlockall(MCL_CURRENT|MCL_FUTURE) during initialization.", " If the system call fails, an error message will be displayed,", " but the session continues.", "", " -c tty-device", " Open the tty-device as the console used for debug messages.", "", " -p page-size", " If a processor's page size cannot be determined by the dumpfile, ", " and the processor default cannot be used, use page-size.", "", " -m option=value", " --machdep option=value", " Pass an option and value pair to machine-dependent code. These", " architecture-specific option/pairs should only be required in", " very rare circumstances:", "", " X86_64:", " physbase=<physical-address>", " irq_eframe_link=<value>", " max_physmem_bits=<value>", " vm=orig (pre-2.6.11 virtual memory address ranges)", " vm=2.6.11 (2.6.11 and later virtual memory address ranges)", " vm=xen (Xen kernel virtual memory address ranges)", " vm=xen-rhel4 (RHEL4 Xen kernel virtual address ranges)", " PPC64:", " vm=orig", " vm=2.6.14 (4-level page tables)", " IA64:", " phys_start=<physical-address>", " init_stack_size=<size>", " vm=4l (4-level page tables)", " ARM:", " physbase=<physical-address>", "", " -x ", " Automatically load extension modules from a particular directory.", " The directory is determined by the following order of precedence:", "", " (1) the directory specified in the CRASH_EXTENSIONS shell ", " environment variable", " (2) /usr/lib64/crash/extensions (64-bit architectures)", " (3) /usr/lib/crash/extensions (32-bit architectures)", " (4) the ./extensions subdirectory of the current directory", "", " --active", " Track only the active task on each cpu.", "", " --buildinfo", " Display the crash binary's build date, the user ID of the builder,", " the hostname of the machine where the build was done, the target", " architecture, the version number, and the compiler version.", "", " --memory_module modname", " Use the modname as an alternative kernel module to the crash.ko", " module that creates the /dev/crash device.", "", " --memory_device device", " Use device as an alternative device to the /dev/crash, /dev/mem", " or /proc/kcore devices.", "", " --log dumpfile", " Dump the contents of the kernel log buffer. A kernel namelist", " argument is not necessary, but the dumpfile must contain the", " VMCOREINFO data taken from the original /proc/vmcore ELF header.", "", " --no_kallsyms", " Do not use kallsyms-generated symbol information contained within", " kernel module object files.", "", " --no_modules", " Do not access or display any kernel module related information.", "", " --no_ikconfig", " Do not attempt to read configuration data that was built into", " kernels configured with CONFIG_IKCONFIG.", "", " --no_data_debug", " Do not verify the validity of all structure member offsets and", " structure sizes that it uses.", "", " --no_kmem_cache", " Do not initialize the kernel's slab cache infrastructure, and", " commands that use kmem_cache-related data will not work.", "", " --no_elf_notes", " Do not use the registers from the ELF NT_PRSTATUS notes saved", " in a compressed kdump header for backtraces.", "", " --kmem_cache_delay", " Delay the initialization of the kernel's slab cache infrastructure", " until it is required by a run-time command.", "", " --readnow", " Pass this flag to the embedded gdb module, which will override", " the two-stage strategy that it uses for reading symbol tables", " from the NAMELIST. If module symbol tables are loaded during", " runtime with the \"mod\" command, the same override will occur.", "", " --smp ", " Specify that the system being analyzed is an SMP kernel.", "", " -v", " --version", " Display the version of the crash utility, the version of the", " embedded gdb module, GPL information, and copyright notices.", "", " --cpus number", " Specify the number of cpus in the SMP system being analyzed.", "", " --osrelease dumpfile", " Display the OSRELEASE vmcoreinfo string from a kdump dumpfile", " header.", "", " --hyper", " Force the session to be that of a Xen hypervisor.", "", " --p2m_mfn pfn", " When a Xen Hypervisor or its dom0 kernel crashes, the dumpfile", " is typically analyzed with either the Xen hypervisor or the dom0", " kernel. It is also possible to analyze any of the guest domU", " kernels if the pfn_to_mfn_list_list pfn value of the guest kernel", " is passed on the command line along with its NAMELIST and the ", " dumpfile.", "", " --xen_phys_start physical-address", " Supply the base physical address of the Xen hypervisor's text", " and static data for older xendump dumpfiles that did not pass", " that information in the dumpfile header.", "", " --zero_excluded", " If a kdump dumpfile has been filtered to exclude various types of", " non-essential pages, any attempt to read them will fail. With", " this flag, reads from any of those pages will return zero-filled", " memory.", "", " --no_panic", " Do not attempt to find the task that was running when the kernel", " crashed. Set the initial context to that of the \"swapper\" task", " on cpu 0.", "", " --more ", " Use /bin/more as the command output scroller, overriding the", " default of /usr/bin/less and any settings in either ./.crashrc", " or $HOME/.crashrc.", "", " --less ", " Use /usr/bin/less as the command output scroller, overriding any", " settings in either ./.crashrc or $HOME/.crashrc.", "", " --CRASHPAGER", " Use the output paging command defined in the CRASHPAGER shell", " environment variable, overriding any settings in either ./.crashrc ", " or $HOME/.crashrc.", "", " --no_scroll", " Do not pass run-time command output to any scrolling command.", "", " --no_strip", " Do not strip cloned kernel text symbol names.", "", " --no_crashrc", " Do not execute the commands in either $HOME/.crashrc or ./.crashrc.", "", " --mod directory", " When loading the debuginfo data of kernel modules with the \"mod -S\"", " command, search for their object files in directory instead of in ", " the standard location.", "", " --reloc size", " When analyzing live x86 kernels configured with a CONFIG_PHYSICAL_START ", " value that is larger than its CONFIG_PHYSICAL_ALIGN value, then it will", " be necessary to enter a relocation size equal to the difference between", " the two values.", "", " --kaslr offset | auto", " If an x86_64 kernel was configured with CONFIG_RANDOMIZE_BASE, the", " offset value is equal to the difference between the symbol values ", " compiled into the vmlinux file and their relocated KASLR value. If", " set to auto, the KASLR offset value will be automatically calculated.", "", " --minimal", " Bring up a session that is restricted to the log, dis, rd, sym,", " eval, set and exit commands. This option may provide a way to", " extract some minimal/quick information from a corrupted or truncated", " dumpfile, or in situations where one of the several kernel subsystem ", " initialization routines would abort the crash session.", "", " --kvmhost [32|64]", " When examining an x86 KVM guest dumpfile, this option specifies", " that the KVM host that created the dumpfile was an x86 (32-bit)", " or an x86_64 (64-bit) machine, overriding the automatically", " determined value.", "", " --kvmio <size>", " override the automatically-calculated KVM guest I/O hole size.", "", " --ram_start <address>", " When using a raw RAM image as input, pass the start of each node image", " with this option. The number of node images passed much match with the", " number of times this option is passed", "", "FILES:", "", " .crashrc", " Initialization commands. The file can be located in the user's", " HOME directory and/or the current directory. Commands found in", " the .crashrc file in the HOME directory are executed before", " those in the current directory's .crashrc file.", "", "ENVIRONMENT VARIABLES:", "", " EDITOR ", " Command input is read using readline(3). If EDITOR is set to", " emacs or vi then suitable keybindings are used. If EDITOR is", " not set, then vi is used. This can be overridden by \"set vi\" or", " \"set emacs\" commands located in a .crashrc file, or by entering", " \"-e emacs\" on the crash command line.", "", " CRASHPAGER", " If CRASHPAGER is set, its value is used as the name of the program", " to which command output will be sent. If not, then command output", " output is sent to \"/usr/bin/less -E -X\" by default.", "", " CRASH_MODULE_PATH", " Specifies an alternative directory tree to search for kernel", " module object files.", "", " CRASH_EXTENSIONS", " Specifies a directory containing extension modules that will be", " loaded automatically if the -x command line option is used.", "", NULL }; void program_usage(int form) { if (form == SHORT_FORM) { fprintf(fp, "\nUsage:\n\n"); fprintf(fp, "%s\n%s\n", program_usage_info[3], program_usage_info[4]); fprintf(fp, "\nEnter \"%s -h\" for details.\n", pc->program_name); clean_exit(1); } else { FILE *scroll; char *scroll_command; char **p; if ((scroll_command = setup_scroll_command()) && (scroll = popen(scroll_command, "w"))) fp = scroll; else scroll = NULL; for (p = program_usage_info; *p; p++) { fprintf(fp, *p, pc->program_name); fprintf(fp, "\n"); } fflush(fp); if (scroll) pclose(scroll); clean_exit(0); } } /* * Get an updated count of commands for subsequent help menu display, * reshuffling the deck if this is the first time or if something's changed. */ void help_init(void) { struct command_table_entry *cp; struct extension_table *ext; for (pc->ncmds = 0, cp = pc->cmd_table; cp->name; cp++) { if (!(cp->flags & HIDDEN_COMMAND)) pc->ncmds++; } for (ext = extension_table; ext; ext = ext->next) { for (cp = ext->command_table; cp->name; cp++) { if (!(cp->flags & (CLEANUP|HIDDEN_COMMAND))) pc->ncmds++; } } if (!pc->cmdlist) { pc->cmdlistsz = pc->ncmds; if ((pc->cmdlist = (char **) malloc(sizeof(char *) * pc->cmdlistsz)) == NULL) error(FATAL, "cannot malloc command list space\n"); } else if (pc->ncmds > pc->cmdlistsz) { pc->cmdlistsz = pc->ncmds; if ((pc->cmdlist = (char **)realloc(pc->cmdlist, sizeof(char *) * pc->cmdlistsz)) == NULL) error(FATAL, "cannot realloc command list space\n"); } reshuffle_cmdlist(); } /* * If the command list is modified during runtime, re-shuffle the list * for proper help menu display. */ static void reshuffle_cmdlist(void) { int i, cnt; struct command_table_entry *cp; struct extension_table *ext; for (i = 0; i < pc->cmdlistsz; i++) pc->cmdlist[i] = NULL; for (cnt = 0, cp = pc->cmd_table; cp->name; cp++) { if (!(cp->flags & HIDDEN_COMMAND)) pc->cmdlist[cnt++] = cp->name; } for (ext = extension_table; ext; ext = ext->next) { for (cp = ext->command_table; cp->name; cp++) { if (!(cp->flags & (CLEANUP|HIDDEN_COMMAND))) pc->cmdlist[cnt++] = cp->name; } } if (cnt > pc->cmdlistsz) error(FATAL, "help table malfunction!\n"); qsort((void *)pc->cmdlist, (size_t)cnt, sizeof(char *), sort_command_name); } /* * The help list is in alphabetical order, with exception of the "q" command, * which has historically always been the last command in the list. */ static int sort_command_name(const void *name1, const void *name2) { char **s1, **s2; s1 = (char **)name1; s2 = (char **)name2; if (STREQ(*s1, "q")) return 1; return strcmp(*s1, *s2); } /* * Get help for a command, to dump an internal table, or the GNU public * license copying/warranty information. */ void cmd_help(void) { int c; int oflag; oflag = 0; while ((c = getopt(argcnt, args, "efNDdmM:ngcaBbHhkKsvVoptTzLxOr")) != EOF) { switch(c) { case 'e': dump_extension_table(VERBOSE); return; case 'f': dump_filesys_table(VERBOSE); return; case 'n': case 'D': dumpfile_memory(DUMPFILE_MEM_DUMP); return; case 'x': dump_text_value_cache(VERBOSE); return; case 'd': dump_dev_table(); return; case 'M': dump_machdep_table(stol(optarg, FAULT_ON_ERROR, NULL)); return; case 'm': dump_machdep_table(0); return; case 'g': dump_gdb_data(); return; case 'N': dump_net_table(); return; case 'a': dump_alias_data(); return; case 'b': dump_shared_bufs(); return; case 'B': dump_build_data(); return; case 'c': dump_numargs_cache(); return; case 'H': dump_hash_table(VERBOSE); return; case 'h': dump_hash_table(!VERBOSE); return; case 'k': dump_kernel_table(!VERBOSE); return; case 'K': dump_kernel_table(VERBOSE); return; case 's': dump_symbol_table(); return; case 'V': dump_vm_table(VERBOSE); return; case 'v': dump_vm_table(!VERBOSE); return; case 'O': dump_offset_table(NULL, TRUE); return; case 'o': oflag = TRUE; break; case 'T': dump_task_table(VERBOSE); return; case 't': dump_task_table(!VERBOSE); return; case 'p': dump_program_context(); return; case 'z': fprintf(fp, "help options:\n"); fprintf(fp, " -a - alias data\n"); fprintf(fp, " -b - shared buffer data\n"); fprintf(fp, " -B - build data\n"); fprintf(fp, " -c - numargs cache\n"); fprintf(fp, " -d - device table\n"); fprintf(fp, " -D - dumpfile contents/statistics\n"); fprintf(fp, " -e - extension table data\n"); fprintf(fp, " -f - filesys table\n"); fprintf(fp, " -h - hash_table data\n"); fprintf(fp, " -H - hash_table data (verbose)\n"); fprintf(fp, " -k - kernel_table\n"); fprintf(fp, " -K - kernel_table (verbose)\n"); fprintf(fp, " -L - LKCD page cache environment\n"); fprintf(fp, " -M <num> machine specific\n"); fprintf(fp, " -m - machdep_table\n"); fprintf(fp, " -n - dumpfile contents/statistics\n"); fprintf(fp, " -o - offset_table and size_table\n"); fprintf(fp, " -p - program_context\n"); fprintf(fp, " -r - dump registers from dumpfile header\n"); fprintf(fp, " -s - symbol table data\n"); fprintf(fp, " -t - task_table\n"); fprintf(fp, " -T - task_table plus context_array\n"); fprintf(fp, " -v - vm_table\n"); fprintf(fp, " -V - vm_table (verbose)\n"); fprintf(fp, " -x - text cache\n"); return; case 'L': dumpfile_memory(DUMPFILE_ENVIRONMENT); return; case 'r': dump_registers(); return; default: argerrs++; break; } } if (argerrs) cmd_usage(pc->curcmd, COMPLETE_HELP); if (!args[optind]) { if (oflag) dump_offset_table(NULL, FALSE); else display_help_screen(""); return; } do { if (oflag) dump_offset_table(args[optind], FALSE); else cmd_usage(args[optind], COMPLETE_HELP|MUST_HELP); optind++; } while (args[optind]); } static void dump_registers(void) { if (pc->flags2 & QEMU_MEM_DUMP) { dump_registers_for_qemu_mem_dump(); return; } else if (DISKDUMP_DUMPFILE()) { dump_registers_for_compressed_kdump(); return; } else if (NETDUMP_DUMPFILE() || KDUMP_DUMPFILE()) { dump_registers_for_elf_dumpfiles(); return; } error(FATAL, "-r option not supported on %s\n", ACTIVE() ? "a live system" : "this dumpfile type"); } /* * Format and display the help menu. */ void display_help_screen(char *indent) { int i, j, rows; char **namep; help_init(); fprintf(fp, "\n%s", indent); rows = (pc->ncmds + (HELP_COLUMNS-1)) / HELP_COLUMNS; for (i = 0; i < rows; i++) { namep = &pc->cmdlist[i]; for (j = 0; j < HELP_COLUMNS; j++) { fprintf(fp,"%-15s", *namep); namep += rows; if ((namep - pc->cmdlist) >= pc->ncmds) break; } fprintf(fp,"\n%s", indent); } fprintf(fp, "\n%s%s version: %-6s gdb version: %s\n", indent, pc->program_name, pc->program_version, pc->gdb_version); fprintf(fp, "%sFor help on any command above, enter \"help <command>\".\n", indent); fprintf(fp, "%sFor help on input options, enter \"help input\".\n", indent); fprintf(fp, "%sFor help on output options, enter \"help output\".\n", indent); #ifdef NO_LONGER_TRUE fprintf(fp, "%sFor the most recent version: " "http://www.missioncriticallinux.com/download\n\n", indent); #else fprintf(fp, "\n"); #endif } /* * Used for generating HTML pages, dump the commands in the order * they would be seen on the help menu, i.e., from left-to-right, row-by-row. * Line ends are signaled with a "BREAK" string. */ static void display_commands(void) { int i, j, rows; char **namep; help_init(); rows = (pc->ncmds + (HELP_COLUMNS-1)) / HELP_COLUMNS; for (i = 0; i < rows; i++) { namep = &pc->cmdlist[i]; for (j = 0; j < HELP_COLUMNS; j++) { fprintf(fp,"%s\n", *namep); namep += rows; if ((namep - pc->cmdlist) >= pc->ncmds) { fprintf(fp, "BREAK\n"); break; } } } } /* * Help data for a command must be formatted using the following template: "command-name", "command description line", "argument-usage line", "description...", "description...", "description...", NULL, * The first line is concatenated with the second line, and will follow the * help command's "NAME" header. * The first and third lines will also be concatenated, and will follow the * help command's "SYNOPSIS" header. If the command has no arguments, enter * a string consisting of a space, i.e., " ". * The fourth and subsequent lines will follow the help command's "DESCRIPTION" * header. * * The program name can be referenced by using the %%s format. The final * entry in each command's help data string list must be a NULL. */ char *help_foreach[] = { "foreach", "display command data for multiple tasks in the system", "[[pid | taskp | name | state | [kernel | user]] ...]\n" " command [flag] [argument]", " This command allows for a an examination of various kernel data associated", " with any, or all, tasks in the system, without having to set the context", " to each targeted task.\n", " pid perform the command(s) on this PID.", " taskp perform the command(s) on task referenced by this hexadecimal", " task_struct pointer.", " name perform the command(s) on all tasks with this name. If the", " task name can be confused with a foreach command name, then", " precede the name string with a \"\\\". If the name string is", " enclosed within \"'\" characters, then the encompassed string", " must be a POSIX extended regular expression that will be used", " to match task names.", " user perform the command(s) on all user (non-kernel) threads.", " kernel perform the command(s) on all kernel threads.", " active perform the command(s) on the active thread on each CPU.", " state perform the command(s) on all tasks in the specified state, which", " may be one of: RU, IN, UN, ST, ZO, TR, SW or DE.\n", " If none of the task-identifying arguments above are entered, the command", " will be performed on all tasks.\n", " command select one or more of the following commands to be run on the tasks", " selected, or on all tasks:\n", " bt run the \"bt\" command (optional flags: -r -t -l -e -R -f -F", " -o -s -x -d)", " vm run the \"vm\" command (optional flags: -p -v -m -R -d -x)", " task run the \"task\" command (optional flags: -R -d -x)", " files run the \"files\" command (optional flag: -R)", " net run the \"net\" command (optional flags: -s -S -R -d -x)", " set run the \"set\" command", " ps run the \"ps\" command (optional flags: -G -s -p -c -t -l -a", " -g -r)", " sig run the \"sig\" command (optional flag: -g)", " vtop run the \"vtop\" command (optional flags: -c -u -k)\n", " flag Pass this optional flag to the command selected.", " argument Pass this argument to the command selected.", " ", " A header containing the PID, task address, cpu and command name will be", " pre-pended before the command output for each selected task. Consult the", " help page of each of the command types above for details.", "\nEXAMPLES", " Display the stack traces for all tasks:\n", " %s> foreach bt", " PID: 4752 TASK: c7680000 CPU: 1 COMMAND: \"xterm\"", " #0 [c7681edc] schedule at c01135f6", " (void)", " #1 [c7681f34] schedule_timeout at c01131ff", " (24)", " #2 [c7681f64] do_select at c0132838", " (5, c7681fa4, c7681fa0)", " #3 [c7681fbc] sys_select at c0132dad", " (5, 8070300, 8070380, 0, 0)", " #4 [bffffb0c] system_call at c0109944", " EAX: 0000008e EBX: 00000005 ECX: 08070300 EDX: 08070380 ", " DS: 002b ESI: 00000000 ES: 002b EDI: 00000000 ", " SS: 002b ESP: bffffadc EBP: bffffb0c ", " CS: 0023 EIP: 402259ee ERR: 0000008e EFLAGS: 00000246 ", " ", " PID: 557 TASK: c5600000 CPU: 0 COMMAND: \"nfsd\"", " #0 [c5601f38] schedule at c01135f6", " (void)", " #1 [c5601f90] schedule_timeout at c01131ff", " (c5600000)", " #2 [c5601fb8] svc_recv at c805363a", " (c0096f40, c5602800, 7fffffff, 100, c65c9f1c)", " #3 [c5601fec] (nfsd module) at c806e303", " (c5602800, c5602800, c0096f40, 6c6e0002, 50)", " #4 [c65c9f24] kernel_thread at c010834f", " (0, 0, ext2_file_inode_operations)", " ", " PID: 824 TASK: c7c84000 CPU: 0 COMMAND: \"mingetty\"", " ...\n", " Display the task_struct structure for each \"bash\" command:\n", " %s> foreach bash task", " ...\n", " Display the open files for all tasks:\n", " %s> foreach files", " ...\n", " Display the state of tasks whose name contains a match to \"event.*\":\n", " %s> foreach 'event.*' task -R state", " PID: 99 TASK: ffff8804750d5500 CPU: 0 COMMAND: \"events/0\"", " state = 1,", " ", " PID: 100 TASK: ffff8804750d4ac0 CPU: 1 COMMAND: \"events/1\"", " state = 1,", " ", " PID: 101 TASK: ffff8804750d4080 CPU: 2 COMMAND: \"events/2\"", " state = 1,", " ...\n", " Display the stack traces for all blocked (TASK_UNINTERRUPTIBLE) tasks:\n", " %s> foreach UN bt", " PID: 428 TASK: ffff880036b6c560 CPU: 1 COMMAND: \"jbd2/dm-1-8\"", " #0 [ffff880035779a70] __schedule at ffffffff815df272", " #1 [ffff880035779b08] schedule at ffffffff815dfacf", " #2 [ffff880035779b18] io_schedule at ffffffff815dfb7f", " #3 [ffff880035779b38] sleep_on_page at ffffffff81119a4e", " #4 [ffff880035779b48] __wait_on_bit at ffffffff815e039f", " #5 [ffff880035779b98] wait_on_page_bit at ffffffff81119bb8", " #6 [ffff880035779be8] filemap_fdatawait_range at ffffffff81119ccc", " #7 [ffff880035779cd8] filemap_fdatawait at ffffffff81119d8b", " #8 [ffff880035779ce8] jbd2_journal_commit_transaction at ffffffff8123a99c", " #9 [ffff880035779e58] kjournald2 at ffffffff8123ee7b", " #10 [ffff880035779ee8] kthread at ffffffff8108fb9c", " #11 [ffff880035779f48] kernel_thread_helper at ffffffff815ebaf4", " ...\n", NULL }; char *help_ascii[] = { "ascii", "translate a hexadecimal string to ASCII", "value ...", " Translates 32-bit or 64-bit hexadecimal values to ASCII. If no argument", " is entered, an ASCII chart is displayed.", "\nEXAMPLES", " Translate the hexadecimal value of 0x62696c2f7273752f to ASCII:", "\n %s> ascii 62696c2f7273752f", " 62696c2f7273752f: /usr/lib", "\n Display an ASCII chart:", "\n %s> ascii", " ", " 0 1 2 3 4 5 6 7", " +-------------------------------", " 0 | NUL DLE SP 0 @ P ' p", " 1 | SOH DC1 ! 1 A Q a q", " 2 | STX DC2 \" 2 B R b r", " 3 | ETX DC3 # 3 C S c s", " 4 | EOT DC4 $ 4 D T d t", " 5 | ENQ NAK \% 5 E U e u", " 6 | ACK SYN & 6 F V f v", " 7 | BEL ETB ` 7 G W g w", " 8 | BS CAN ( 8 H X h x", " 9 | HT EM ) 9 I Y i y", " A | LF SUB * : J Z j z", " B | VT ESC + ; K [ k {", " C | FF FS , < L \\ l |", " D | CR GS _ = M ] m }", " E | SO RS . > N ^ n ~", " F | SI US / ? O - o DEL", NULL }; char *help_quit[] = { "quit", "exit this session", " ", " Bail out of the current %s session.", "\nNOTE", " This command is equivalent to the \"exit\" command.", NULL }; char *help_exit[] = { "exit", "exit this session", " ", " Bail out of the current %s session.", "\nNOTE", " This command is equivalent to the \"q\" command.", NULL }; char *help_help[] = { "help", "get help", "[command | all] [-<option>]", " When entered with no argument, a list of all currently available %s", " commands is listed. If a name of a %s command is entered, a man-like", " page for the command is displayed. If \"all\" is entered, help pages", " for all commands will be displayed. If neither of the above is entered,", " the argument string will be passed on to the gdb help command.", " ", " A number of internal debug, statistical, and other dumpfile related", " data is available with the following options:", " ", " -a - alias data", " -b - shared buffer data", " -B - build data", " -c - numargs cache", " -d - device table", " -D - dumpfile contents/statistics", " -e - extension table data", " -f - filesys table", " -h - hash_table data", " -H - hash_table data (verbose)", " -k - kernel_table", " -K - kernel_table (verbose)", " -L - LKCD page cache environment", " -M <num> machine specific", " -m - machdep_table", " -n - dumpfile contents/statistics", " -o - offset_table and size_table", " -p - program_context", " -r - dump registers from dumpfile header", " -s - symbol table data", " -t - task_table", " -T - task_table plus context_array", " -v - vm_table", " -V - vm_table (verbose)", " -x - text cache", NULL }; char *help_set[] = { "set", "set a process context or internal %s variable", "[[-a] [pid | taskp] | [-c cpu] | -p] | [%s_variable [setting]] | -v", " This command either sets a new context, or gets the current context for", " display. The context can be set by the use of:\n", " pid a process PID.", " taskp a hexadecimal task_struct pointer.", " -a sets the pid or task as the active task on its cpu (dumpfiles only).", " -c cpu sets the context to the active task on a cpu (dumpfiles only).", " -p sets the context to the panic task, or back to the %s task on", " a live system.", " -v display the current state of internal %s variables.", "", " If no argument is entered, the current context is displayed. The context", " consists of the PID, the task pointer, the CPU, and task state. The task", " state shows the bits found in both the task_struct state and exit_state", " fields.", " ", " This command may also be used to set internal %s variables. If no value", " argument is entered, the current value of the %s variable is shown. These", " are the %s variables, acceptable arguments, and purpose:\n", " scroll on | off controls output scrolling.", " scroll less /usr/bin/less as the output scrolling program.", " scroll more /bin/more as the output scrolling program.", " scroll CRASHPAGER use CRASHPAGER environment variable as the", " output scrolling program.", " radix 10 | 16 sets output radix to 10 or 16.", " refresh on | off controls internal task list refresh.", " print_max number set maximum number of array elements to print.", " console device-name sets debug console device.", " debug number sets %s debug level.", " core on | off if on, drops core when the next error message", " is displayed.", " hash on | off controls internal list verification.", " silent on | off turns off initialization messages; turns off", " %s prompt during input file execution. ", " (scrolling is turned off if silent is on)", " edit vi | emacs set line editing mode (from .%src file only).", " namelist filename name of kernel (from .%src file only).", " zero_excluded on | off controls whether excluded pages from a dumpfile", " should return zero-filled memory.", " null-stop on | off if on, gdb's printing of character arrays will", " stop at the first NULL encountered.", " gdb on | off if on, the %s session will be run in a mode", " where all commands will be passed directly to", " gdb, and the command prompt will change to ", " \"gdb>\"; when running in this mode, native %s", " commands may be executed by preceding them with", " the \"crash\" directive.", " scope text-addr sets the text scope for viewing the definition", " of data structures; the \"text-addr\" argument", " must be a kernel or module text address, which", " may be expressed symbolically or as a hexadecimal", " value.", " ", " Internal variables may be set in four manners:\n", " 1. entering the set command in $HOME/.%src.", " 2. entering the set command in .%src in the current directory.", " 3. executing an input file containing the set command.", " 4. during runtime with this command.\n", " During initialization, $HOME/.%src is read first, followed by the", " .%src file in the current directory. Set commands in the .%src file", " in the current directory override those in $HOME/.%src. Set commands ", " entered with this command or by runtime input file override those", " defined in either .%src file. Multiple set command arguments or argument", " pairs may be entered in one command line.", "\nEXAMPLES", " Set the current context to task c2fe8000:\n", " %s> set c2fe8000", " PID: 15917", " COMMAND: \"bash\"", " TASK: c2fe8000 ", " CPU: 0", " STATE: TASK_INTERRUPTIBLE\n", " Set the context back to the panicking task:\n", " %s> set -p", " PID: 698", " COMMAND: \"gen12\"", " TASK: f9d78000", " CPU: 2", " STATE: TASK_RUNNING (PANIC)\n", " Turn off output scrolling:\n", " %s> set scroll off", " scroll: off (/usr/bin/less)", " ", " Show the current state of %s internal variables:\n", " %s> set -v", " scroll: on (/usr/bin/less)", " radix: 10 (decimal)", " refresh: on", " print_max: 256", " console: /dev/pts/2", " debug: 0", " core: off", " hash: on", " silent: off", " edit: vi", " namelist: vmlinux", " zero_excluded: off", " null-stop: on", " gdb: off", " scope: (not set)", " ", " Show the current context:\n", " %s> set", " PID: 1525", " COMMAND: \"bash\"", " TASK: c1ede000", " CPU: 0", " STATE: TASK_INTERRUPTIBLE\n", NULL }; char *help_p[] = { "p", "print the value of an expression", "[-x|-d][-u] [expression | symbol[:cpuspec]]", " This command passes its arguments on to gdb \"print\" command for evaluation.", "", " expression an expression to be evaluated.", " symbol a kernel symbol.", " :cpuspec CPU specification for a per-cpu symbol:", " : CPU of the currently selected task.", " :a[ll] all CPUs.", " :#[-#][,...] CPU list(s), e.g. \"1,3,5\", \"1-3\",", " or \"1,3,5-7,10\".", " -x override default output format with hexadecimal format.", " -d override default output format with decimal format.", " -u the expression evaluates to a user address reference.", "", " The default output format is decimal, but that can be changed at any time", " with the two built-in aliases \"hex\" and \"dec\". Alternatively, there", " are two other built-in aliases, \"px\" and \"pd\", which force the command", " output to be displayed in hexadecimal or decimal, without changing the", " default mode. ", "\nEXAMPLES", " Print the contents of jiffies:\n", " %s> p jiffies", " jiffies = $6 = 166532620", " %s> px jiffies", " jiffies = $7 = 0x9ed174b", " %s> pd jiffies", " jiffies = $8 = 166533160", " ", " Print the contents of the vm_area_struct \"init_mm\":\n", " %s> p init_mm", " init_mm = $5 = {", " mmap = 0xc022d540, ", " mmap_avl = 0x0, ", " mmap_cache = 0x0, ", " pgd = 0xc0101000, ", " count = {", " counter = 0x6", " }, ", " map_count = 0x1, ", " mmap_sem = {", " count = {", " counter = 0x1", " }, ", " waking = 0x0, ", " wait = 0x0", " }, ", " context = 0x0, ", " start_code = 0xc0000000, ", " end_code = 0xc022b4c8, ", " start_data = 0x0, ", " end_data = 0xc0250388, ", " start_brk = 0x0, ", " brk = 0xc02928d8, ", " start_stack = 0x0, ", " arg_start = 0x0, ", " arg_end = 0x0, ", " env_start = 0x0, ", " env_end = 0x0, ", " rss = 0x0, ", " total_vm = 0x0, ", " locked_vm = 0x0, ", " def_flags = 0x0, ", " cpu_vm_mask = 0x0, ", " swap_cnt = 0x0, ", " swap_address = 0x0, ", " segments = 0x0", " }", "", " If a per-cpu symbol is entered as a argument, its data type", " and all of its per-cpu addresses are displayed:", " ", " %s> p irq_stat", " PER-CPU DATA TYPE:", " irq_cpustat_t irq_stat;", " PER-CPU ADDRESSES:", " [0]: ffff88021e211540", " [1]: ffff88021e251540", " [2]: ffff88021e291540", " [3]: ffff88021e2d1540", " ", " To display the contents a per-cpu symbol for CPU 1, append", " a cpu-specifier:", " ", " %s> p irq_stat:1", " per_cpu(irq_stat, 1) = $29 = {", " __softirq_pending = 0, ", " __nmi_count = 209034, ", " apic_timer_irqs = 597509876, ", " irq_spurious_count = 0, ", " icr_read_retry_count = 2, ", " x86_platform_ipis = 0, ", " apic_perf_irqs = 209034, ", " apic_irq_work_irqs = 0, ", " irq_resched_count = 264922233, ", " irq_call_count = 7036692, ", " irq_tlb_count = 4750442, ", " irq_thermal_count = 0, ", " irq_threshold_count = 0", " }", " ", NULL }; char *help_ps[] = { "ps", "display process status information", "[-k|-u|-G][-s][-p|-c|-t|-l|-a|-g|-r] [pid | taskp | command] ...", " This command displays process status for selected, or all, processes" , " in the system. If no arguments are entered, the process data is", " is displayed for all processes. Specific processes may be selected", " by using the following identifier formats:\n", " pid a process PID.", " taskp a hexadecimal task_struct pointer.", " command a command name. If a command name is made up of letters that", " are all numerical values, precede the name string with a \"\\\".", " If the command string is enclosed within \"'\" characters, then", " the encompassed string must be a POSIX extended regular expression", " that will be used to match task names.", " ", " The process list may be further restricted by the following options:\n", " -k restrict the output to only kernel threads.", " -u restrict the output to only user tasks.", " -G display only the thread group leader in a thread group.", " ", " The process identifier types may be mixed. For each task, the following", " items are displayed:", " ", " 1. the process PID.", " 2. the parent process PID.", " 3. the CPU number that the task ran on last.", " 4. the task_struct address or the kernel stack pointer of the process.", " (see -s option below)", " 5. the task state (RU, IN, UN, ZO, ST, TR, DE, SW).", " 6. the percentage of physical memory being used by this task.", " 7. the virtual address size of this task in kilobytes.", " 8. the resident set size of this task in kilobytes.", " 9. the command name.", " ", " The default output shows the task_struct address of each process under a", " column titled \"TASK\". This can be changed to show the kernel stack ", " pointer under a column titled \"KSTACKP\".", " ", " -s replace the TASK column with the KSTACKP column.", " ", " On SMP machines, the active task on each CPU will be highlighted by an", " angle bracket (\">\") preceding its information.", " ", " Alternatively, information regarding parent-child relationships,", " per-task time usage data, argument/environment data, thread groups,", " or resource limits may be displayed:", " ", " -p display the parental hierarchy of selected, or all, tasks.", " -c display the children of selected, or all, tasks.", " -t display the task run time, start time, and cumulative user", " and system times.", " -l display the task last_run or timestamp value, whichever applies,", " of selected, or all, tasks; the list is sorted with the most", " recently-run task (largest last_run/timestamp) shown first,", " followed by the task's current state.", " -a display the command line arguments and environment strings of", " selected, or all, user-mode tasks.", " -g display tasks by thread group, of selected, or all, tasks.", " -r display resource limits (rlimits) of selected, or all, tasks.", "\nEXAMPLES", " Show the process status of all current tasks:\n", " %s> ps", " PID PPID CPU TASK ST %MEM VSZ RSS COMM", " > 0 0 3 c024c000 RU 0.0 0 0 [swapper]", " > 0 0 0 c0dce000 RU 0.0 0 0 [swapper]", " 0 0 1 c0fa8000 RU 0.0 0 0 [swapper]", " > 0 0 2 c009a000 RU 0.0 0 0 [swapper]", " 1 0 1 c0098000 IN 0.0 1096 476 init", " 2 1 1 c0090000 IN 0.0 0 0 [kflushd]", " 3 1 1 c000e000 IN 0.0 0 0 [kpiod]", " 4 1 3 c000c000 IN 0.0 0 0 [kswapd]", " 5 1 1 c0008000 IN 0.0 0 0 [mdrecoveryd]", " 253 1 2 fbc4c000 IN 0.0 1088 376 portmap", " 268 1 2 fbc82000 IN 0.1 1232 504 ypbind", " 274 268 2 fa984000 IN 0.1 1260 556 ypbind", " 321 1 1 fabf6000 IN 0.1 1264 608 syslogd", " 332 1 1 fa9be000 RU 0.1 1364 736 klogd", " 346 1 2 fae88000 IN 0.0 1112 472 atd", " 360 1 2 faeb2000 IN 0.1 1284 592 crond", " 378 1 2 fafd6000 IN 0.1 1236 560 inetd", " 392 1 0 fb710000 IN 0.1 2264 1468 named", " 406 1 3 fb768000 IN 0.1 1284 560 lpd", " 423 1 1 fb8ac000 IN 0.1 1128 528 rpc.statd", " 434 1 2 fb75a000 IN 0.0 1072 376 rpc.rquotad", " 445 1 2 fb4a4000 IN 0.0 1132 456 rpc.mountd", " 460 1 1 fa938000 IN 0.0 0 0 [nfsd]", " 461 1 1 faa86000 IN 0.0 0 0 [nfsd]", " 462 1 0 fac48000 IN 0.0 0 0 [nfsd]", " 463 1 0 fb4ca000 IN 0.0 0 0 [nfsd]", " 464 1 0 fb4c8000 IN 0.0 0 0 [nfsd]", " 465 1 2 fba6e000 IN 0.0 0 0 [nfsd]", " 466 1 1 fba6c000 IN 0.0 0 0 [nfsd]", " 467 1 2 fac04000 IN 0.0 0 0 [nfsd]", " 468 461 2 fa93a000 IN 0.0 0 0 [lockd]", " 469 468 2 fa93e000 IN 0.0 0 0 [rpciod]", " 486 1 0 fab54000 IN 0.1 1596 880 amd", " 523 1 2 fa84e000 IN 0.1 1884 1128 sendmail", " 538 1 0 fa82c000 IN 0.0 1112 416 gpm", " 552 1 3 fa70a000 IN 0.1 2384 1220 httpd", " 556 552 3 fa776000 IN 0.1 2572 1352 httpd", " 557 552 2 faba4000 IN 0.1 2572 1352 httpd", " 558 552 1 fa802000 IN 0.1 2572 1352 httpd", " 559 552 3 fa6ee000 IN 0.1 2572 1352 httpd", " 560 552 3 fa700000 IN 0.1 2572 1352 httpd", " 561 552 0 fa6f0000 IN 0.1 2572 1352 httpd", " 562 552 3 fa6ea000 IN 0.1 2572 1352 httpd", " 563 552 0 fa67c000 IN 0.1 2572 1352 httpd", " 564 552 3 fa674000 IN 0.1 2572 1352 httpd", " 565 552 3 fa66a000 IN 0.1 2572 1352 httpd", " 582 1 2 fa402000 IN 0.2 2968 1916 xfs", " 633 1 2 fa1ec000 IN 0.2 5512 2248 innd", " 636 1 3 fa088000 IN 0.1 2536 804 actived", " 676 1 0 fa840000 IN 0.0 1060 384 mingetty", " 677 1 1 fa590000 IN 0.0 1060 384 mingetty", " 678 1 2 fa3b8000 IN 0.0 1060 384 mingetty", " 679 1 0 fa5b8000 IN 0.0 1060 384 mingetty", " 680 1 1 fa3a4000 IN 0.0 1060 384 mingetty", " 681 1 2 fa30a000 IN 0.0 1060 384 mingetty", " 683 1 3 fa5d8000 IN 0.0 1052 280 update", " 686 378 1 fa3aa000 IN 0.1 2320 1136 in.rlogind", " 687 686 2 f9e52000 IN 0.1 2136 1000 login", " 688 687 0 f9dec000 IN 0.1 1732 976 bash", " > 700 688 1 f9d62000 RU 0.0 1048 256 gen12", " ", " Display the parental hierarchy of the \"%s\" process on a live system:\n", " %s> ps -p 4249", " PID: 0 TASK: c0252000 CPU: 0 COMMAND: \"swapper\"", " PID: 1 TASK: c009a000 CPU: 1 COMMAND: \"init\"", " PID: 632 TASK: c73b6000 CPU: 1 COMMAND: \"prefdm\"", " PID: 637 TASK: c5a4a000 CPU: 1 COMMAND: \"prefdm\"", " PID: 649 TASK: c179a000 CPU: 0 COMMAND: \"kwm\"", " PID: 683 TASK: c1164000 CPU: 0 COMMAND: \"kfm\"", " PID: 1186 TASK: c165a000 CPU: 0 COMMAND: \"xterm\"", " PID: 1188 TASK: c705e000 CPU: 1 COMMAND: \"bash\"", " PID: 4249 TASK: c6b9a000 CPU: 0 COMMAND: \"crash\"", " ", " Display all children of the \"kwm\" window manager:\n", " %s> ps -c kwm", " PID: 649 TASK: c179a000 CPU: 0 COMMAND: \"kwm\"", " PID: 682 TASK: c2d58000 CPU: 1 COMMAND: \"kwmsound\"", " PID: 683 TASK: c1164000 CPU: 1 COMMAND: \"kfm\"", " PID: 685 TASK: c053c000 CPU: 0 COMMAND: \"krootwm\"", " PID: 686 TASK: c13fa000 CPU: 0 COMMAND: \"kpanel\"", " PID: 687 TASK: c13f0000 CPU: 1 COMMAND: \"kbgndwm\"", " ", " Display all threads in a firefox session:\n", " %s> ps firefox", " PID PPID CPU TASK ST %MEM VSZ RSS COMM", " 21273 21256 6 ffff81003ec15080 IN 46.3 1138276 484364 firefox", " 21276 21256 6 ffff81003f49e7e0 IN 46.3 1138276 484364 firefox", " 21280 21256 0 ffff81003ec1d7e0 IN 46.3 1138276 484364 firefox", " 21286 21256 6 ffff81000b0d1820 IN 46.3 1138276 484364 firefox", " 21287 21256 2 ffff81000b0d10c0 IN 46.3 1138276 484364 firefox", " 26975 21256 5 ffff81003b5c1820 IN 46.3 1138276 484364 firefox", " 26976 21256 5 ffff810023232820 IN 46.3 1138276 484364 firefox", " 26977 21256 4 ffff810021a11820 IN 46.3 1138276 484364 firefox", " 26978 21256 5 ffff810003159040 IN 46.3 1138276 484364 firefox", " 26979 21256 5 ffff81003a058820 IN 46.3 1138276 484364 firefox", " ", " Display only the thread group leader in the firefox session:\n", " %s> ps -G firefox", " PID PPID CPU TASK ST %MEM VSZ RSS COMM", " 21273 21256 0 ffff81003ec15080 IN 46.3 1138276 484364 firefox", " ", " Show the time usage data for pid 10318:\n", " %s> ps -t 10318", " PID: 10318 TASK: f7b85550 CPU: 5 COMMAND: \"bash\"", " RUN TIME: 1 days, 01:35:32", " START TIME: 5209", " UTIME: 95", " STIME: 57", " ", " Show the process status of PID 1, task f9dec000, and all nfsd tasks:\n", " %s> ps 1 f9dec000 nfsd", " PID PPID CPU TASK ST %MEM VSZ RSS COMM", " 1 0 1 c0098000 IN 0.0 1096 476 init", " 688 687 0 f9dec000 IN 0.1 1732 976 bash", " 460 1 1 fa938000 IN 0.0 0 0 [nfsd]", " 461 1 1 faa86000 IN 0.0 0 0 [nfsd]", " 462 1 0 fac48000 IN 0.0 0 0 [nfsd]", " 463 1 0 fb4ca000 IN 0.0 0 0 [nfsd]", " 464 1 0 fb4c8000 IN 0.0 0 0 [nfsd]", " 465 1 2 fba6e000 IN 0.0 0 0 [nfsd]", " 466 1 1 fba6c000 IN 0.0 0 0 [nfsd]", " 467 1 2 fac04000 IN 0.0 0 0 [nfsd]", " ", " Show all kernel threads:\n", " %s> ps -k", " PID PPID CPU TASK ST %MEM VSZ RSS COMM", " 0 0 1 c0fac000 RU 0.0 0 0 [swapper]", " 0 0 0 c0252000 RU 0.0 0 0 [swapper]", " 2 1 1 c0fa0000 IN 0.0 0 0 [kflushd]", " 3 1 1 c03de000 IN 0.0 0 0 [kpiod]", " 4 1 1 c03dc000 IN 0.0 0 0 [kswapd]", " 5 1 0 c0092000 IN 0.0 0 0 [mdrecoveryd]", " 336 1 0 c4a9a000 IN 0.0 0 0 [rpciod]", " 337 1 0 c4830000 IN 0.0 0 0 [lockd]", " 487 1 1 c4ba6000 IN 0.0 0 0 [nfsd]", " 488 1 0 c18c6000 IN 0.0 0 0 [nfsd]", " 489 1 0 c0cac000 IN 0.0 0 0 [nfsd]", " 490 1 0 c056a000 IN 0.0 0 0 [nfsd]", " 491 1 0 c0860000 IN 0.0 0 0 [nfsd]", " 492 1 1 c0254000 IN 0.0 0 0 [nfsd]", " 493 1 0 c0a86000 IN 0.0 0 0 [nfsd]", " 494 1 0 c0968000 IN 0.0 0 0 [nfsd]", " ", " Show all tasks sorted by their task_struct's last_run or timestamp value,", " whichever applies:\n", " %s> ps -l", " [280195] [RU] PID: 2 TASK: c1468000 CPU: 0 COMMAND: \"keventd\"", " [280195] [IN] PID: 1986 TASK: c5af4000 CPU: 0 COMMAND: \"sshd\"", " [280195] [IN] PID: 2039 TASK: c58e6000 CPU: 0 COMMAND: \"sshd\"", " [280195] [RU] PID: 2044 TASK: c5554000 CPU: 0 COMMAND: \"bash\"", " [280195] [RU] PID: 2289 TASK: c70c0000 CPU: 0 COMMAND: \"s\"", " [280190] [IN] PID: 1621 TASK: c54f8000 CPU: 0 COMMAND: \"cupsd\"", " [280184] [IN] PID: 5 TASK: c154c000 CPU: 0 COMMAND: \"kswapd\"", " [280184] [IN] PID: 6 TASK: c7ff6000 CPU: 0 COMMAND: \"kscand\"", " [280170] [IN] PID: 0 TASK: c038e000 CPU: 0 COMMAND: \"swapper\"", " [280166] [IN] PID: 2106 TASK: c0c0c000 CPU: 0 COMMAND: \"sshd\"", " [280166] [IN] PID: 2162 TASK: c03a4000 CPU: 0 COMMAND: \"vmstat\"", " [280160] [IN] PID: 1 TASK: c154a000 CPU: 0 COMMAND: \"init\"", " [280131] [IN] PID: 3 TASK: c11ce000 CPU: 0 COMMAND: \"kapmd\"", " [280117] [IN] PID: 1568 TASK: c5a8c000 CPU: 0 COMMAND: \"smartd\"", " [280103] [IN] PID: 1694 TASK: c4c66000 CPU: 0 COMMAND: \"ntpd\"", " [280060] [IN] PID: 8 TASK: c7ff2000 CPU: 0 COMMAND: \"kupdated\"", " [279767] [IN] PID: 1720 TASK: c4608000 CPU: 0 COMMAND: \"sendmail\"", " [279060] [IN] PID: 13 TASK: c69f4000 CPU: 0 COMMAND: \"kjournald\"", " [278657] [IN] PID: 1523 TASK: c5ad4000 CPU: 0 COMMAND: \"ypbind\"", " [277712] [IN] PID: 2163 TASK: c06e0000 CPU: 0 COMMAND: \"sshd\"", " [277711] [IN] PID: 2244 TASK: c4cdc000 CPU: 0 COMMAND: \"ssh\"", " [277261] [IN] PID: 1391 TASK: c5d8e000 CPU: 0 COMMAND: \"syslogd\"", " [276837] [IN] PID: 1990 TASK: c58d8000 CPU: 0 COMMAND: \"bash\"", " [276802] [IN] PID: 1853 TASK: c3828000 CPU: 0 COMMAND: \"atd\"", " [276496] [IN] PID: 1749 TASK: c4480000 CPU: 0 COMMAND: \"cannaserver\"", " [274931] [IN] PID: 1760 TASK: c43ac000 CPU: 0 COMMAND: \"crond\"", " [246773] [IN] PID: 1844 TASK: c38d8000 CPU: 0 COMMAND: \"xfs\"", " [125620] [IN] PID: 2170 TASK: c48dc000 CPU: 0 COMMAND: \"bash\"", " [119059] [IN] PID: 1033 TASK: c64be000 CPU: 0 COMMAND: \"kjournald\"", " [110916] [IN] PID: 1663 TASK: c528a000 CPU: 0 COMMAND: \"sshd\"", " [ 86122] [IN] PID: 2112 TASK: c0da6000 CPU: 0 COMMAND: \"bash\"", " [ 13637] [IN] PID: 1891 TASK: c67ae000 CPU: 0 COMMAND: \"sshd\"", " [ 13636] [IN] PID: 1894 TASK: c38ec000 CPU: 0 COMMAND: \"bash\"", " [ 7662] [IN] PID: 1885 TASK: c6478000 CPU: 0 COMMAND: \"mingetty\"", " [ 7662] [IN] PID: 1886 TASK: c62da000 CPU: 0 COMMAND: \"mingetty\"", " [ 7662] [IN] PID: 1887 TASK: c5f8c000 CPU: 0 COMMAND: \"mingetty\"", " [ 7662] [IN] PID: 1888 TASK: c5f88000 CPU: 0 COMMAND: \"mingetty\"", " [ 7662] [IN] PID: 1889 TASK: c5f86000 CPU: 0 COMMAND: \"mingetty\"", " [ 7662] [IN] PID: 1890 TASK: c6424000 CPU: 0 COMMAND: \"mingetty\"", " [ 7661] [IN] PID: 4 TASK: c154e000 CPU: 0 COMMAND: \"ksoftirqd/0\"", " [ 7595] [IN] PID: 1872 TASK: c2e7e000 CPU: 0 COMMAND: \"inventory.pl\"", " [ 6617] [IN] PID: 1771 TASK: c435a000 CPU: 0 COMMAND: \"jserver\"", " [ 6307] [IN] PID: 1739 TASK: c48f8000 CPU: 0 COMMAND: \"gpm\"", " [ 6285] [IN] PID: 1729 TASK: c4552000 CPU: 0 COMMAND: \"sendmail\"", " [ 6009] [IN] PID: 1395 TASK: c6344000 CPU: 0 COMMAND: \"klogd\"", " [ 5820] [IN] PID: 1677 TASK: c4d74000 CPU: 0 COMMAND: \"xinetd\"", " [ 5719] [IN] PID: 1422 TASK: c5d04000 CPU: 0 COMMAND: \"portmap\"", " [ 4633] [IN] PID: 1509 TASK: c5ed4000 CPU: 0 COMMAND: \"apmd\"", " [ 4529] [IN] PID: 1520 TASK: c5d98000 CPU: 0 COMMAND: \"ypbind\"", " [ 4515] [IN] PID: 1522 TASK: c5d32000 CPU: 0 COMMAND: \"ypbind\"", " [ 4373] [IN] PID: 1441 TASK: c5d48000 CPU: 0 COMMAND: \"rpc.statd\"", " [ 4210] [IN] PID: 1352 TASK: c5b30000 CPU: 0 COMMAND: \"dhclient\"", " [ 1184] [IN] PID: 71 TASK: c65b6000 CPU: 0 COMMAND: \"khubd\"", " [ 434] [IN] PID: 9 TASK: c11de000 CPU: 0 COMMAND: \"mdrecoveryd\"", " [ 48] [IN] PID: 7 TASK: c7ff4000 CPU: 0 COMMAND: \"bdflush\"", " ", " Show the kernel stack pointer of each user task:\n", " %s> ps -us", " PID PPID CPU KSTACKP ST %MEM VSZ RSS COMM", " 1 0 0 c009bedc IN 0.0 1096 52 init", " 239 1 0 c15e7ed8 IN 0.2 1332 224 pump", " 280 1 1 c7cbdedc IN 0.2 1092 208 portmap", " 295 1 0 c7481edc IN 0.0 1232 0 ypbind", " 301 295 0 c7c7bf28 IN 0.1 1260 124 ypbind", " 376 1 1 c5053f28 IN 0.0 1316 40 automount", " 381 1 0 c34ddf28 IN 0.2 1316 224 automount", " 391 1 1 c2777f28 IN 0.2 1316 224 automount", " ...", " ", " Display the argument and environment data for the automount task:\n", " %s> ps -a automount", " PID: 3948 TASK: f722ee30 CPU: 0 COMMAND: \"automount\"", " ARG: /usr/sbin/automount --timeout=60 /net program /etc/auto.net", " ENV: SELINUX_INIT=YES", " CONSOLE=/dev/console", " TERM=linux", " INIT_VERSION=sysvinit-2.85", " PATH=/sbin:/usr/sbin:/bin:/usr/bin", " LC_MESSAGES=en_US", " RUNLEVEL=3", " runlevel=3", " PWD=/", " LANG=ja_JP.UTF-8", " PREVLEVEL=N", " previous=N", " HOME=/", " SHLVL=2", " _=/usr/sbin/automount", " ", " Display the tasks in the thread group containing task c20ab0b0:\n", " %s> ps -g c20ab0b0", " PID: 6425 TASK: f72f50b0 CPU: 0 COMMAND: \"firefox-bin\"", " PID: 6516 TASK: f71bf1b0 CPU: 0 COMMAND: \"firefox-bin\"", " PID: 6518 TASK: d394b930 CPU: 0 COMMAND: \"firefox-bin\"", " PID: 6520 TASK: c20aa030 CPU: 0 COMMAND: \"firefox-bin\"", " PID: 6523 TASK: c20ab0b0 CPU: 0 COMMAND: \"firefox-bin\"", " PID: 6614 TASK: f1f181b0 CPU: 0 COMMAND: \"firefox-bin\"", " ", " Display the tasks in the thread group for each instance of the", " program named \"multi-thread\":\n", " %s> ps -g multi-thread", " PID: 2522 TASK: 1003f0dc7f0 CPU: 1 COMMAND: \"multi-thread\"", " PID: 2523 TASK: 10037b13030 CPU: 1 COMMAND: \"multi-thread\"", " PID: 2524 TASK: 1003e064030 CPU: 1 COMMAND: \"multi-thread\"", " PID: 2525 TASK: 1003e13a7f0 CPU: 1 COMMAND: \"multi-thread\"", " ", " PID: 2526 TASK: 1002f82b7f0 CPU: 1 COMMAND: \"multi-thread\"", " PID: 2527 TASK: 1003e1737f0 CPU: 1 COMMAND: \"multi-thread\"", " PID: 2528 TASK: 10035b4b7f0 CPU: 1 COMMAND: \"multi-thread\"", " PID: 2529 TASK: 1003f0c37f0 CPU: 1 COMMAND: \"multi-thread\"", " PID: 2530 TASK: 10035597030 CPU: 1 COMMAND: \"multi-thread\"", " PID: 2531 TASK: 100184be7f0 CPU: 1 COMMAND: \"multi-thread\"", " ", " Display the resource limits of \"bash\" task 13896:\n", " %s> ps -r 13896", " PID: 13896 TASK: cf402000 CPU: 0 COMMAND: \"bash\"", " RLIMIT CURRENT MAXIMUM", " CPU (unlimited) (unlimited)", " FSIZE (unlimited) (unlimited)", " DATA (unlimited) (unlimited)", " STACK 10485760 (unlimited)", " CORE (unlimited) (unlimited)", " RSS (unlimited) (unlimited)", " NPROC 4091 4091", " NOFILE 1024 1024", " MEMLOCK 4096 4096", " AS (unlimited) (unlimited)", " LOCKS (unlimited) (unlimited)", " ", " Search for task names matching a POSIX regular expression:\n", " %s> ps 'migration*'", " PID PPID CPU TASK ST %MEM VSZ RSS COMM", " 8 2 0 ffff8802128a2e20 IN 0.0 0 0 [migration/0]", " 10 2 1 ffff880212969710 IN 0.0 0 0 [migration/1]", " 15 2 2 ffff880212989710 IN 0.0 0 0 [migration/2]", " 20 2 3 ffff8802129a9710 IN 0.0 0 0 [migration/3]", NULL }; char *help_rd[] = { "rd", "read memory", "[-adDsSupxmfN][-8|-16|-32|-64][-o offs][-e addr][-r file][address|symbol]\n" " [count]", " This command displays the contents of memory, with the output formatted", " in several different manners. The starting address may be entered either", " symbolically or by address. The default output size is the size of a long", " data type, and the default output format is hexadecimal. When hexadecimal", " output is used, the output will be accompanied by an ASCII translation.\n", " -p address argument is a physical address.", " -u address argument is a user virtual address; only required on", " processors with common user and kernel virtual address spaces.", " -m address argument is a xen host machine address.", " -f address argument is a dumpfile offset.", " -d display output in signed decimal format (default is hexadecimal).", " -D display output in unsigned decimal format (default is hexadecimal).", " -s displays output symbolically when appropriate.", " -S[S] displays output symbolically when appropriate; if the memory", " contents reference a slab cache object, the name of the slab cache", " will be displayed in brackets. If -S is entered twice, and the", " memory contents reference a slab cache object, both the memory", " contents and the name of the slab cache will be displayed in", " brackets.", " -x do not display ASCII translation at end of each line.", #ifdef NOTDEF " -o Shows offset value from the starting address.", #endif " -8 display output in 8-bit values.", " -16 display output in 16-bit values.", " -32 display output in 32-bit values (default on 32-bit machines).", " -64 display output in 64-bit values (default on 64-bit machines).", " -a display output in ASCII characters if the memory contains printable", " ASCII characters; if no count argument is entered, stop at the first", " non-printable character.", " -N display output in network byte order (only valid for 16- and 32-bit", " values)", " -o offs offset the starting address by offs.", " -e addr display memory until reaching specified ending hexadecimal address.", " -r file dumps raw data to the specified output file; the number of bytes that", " are copied to the file must be specified either by a count argument", " or by the -e option.", " address starting hexadecimal address:", " 1 the default presumes a kernel virtual address.", " 2. -p specifies a physical address.", " 3. -u specifies a user virtual address, but is only necessary on", " processors with common user and kernel virtual address spaces.", " symbol symbol of starting address to read.", " count number of memory locations to display; if entered, it must be the", " last argument on the command line; if not entered, the count defaults", " to 1, or unlimited for -a; when used with the -r option, it is the", " number of bytes to be written to the file.", "\nEXAMPLES", " Display the kernel's version string:\n", " %s> rd -a linux_banner", " c082a020: Linux version 2.6.32-119.el6.i686 (mockbuild@xxxxxxxxxxxxxxx", " c082a05c: d.redhat.com) (gcc version 4.4.4 20100726 (Red Hat 4.4.4-13)", " c082a098: (GCC) ) #1 SMP Tue Mar 1 18:16:57 EST 2011", "", " Display the same block of memory, first without symbols, again", " with symbols, and then with symbols and slab cache references:\n", " %s> rd f6e31f70 28", " f6e31f70: f6e31f6c f779c180 c04a4032 00a9dd40 l.....y.2@J.@...", " f6e31f80: 00000fff c0472da0 f6e31fa4 f779c180 .....-G.......y.", " f6e31f90: fffffff7 00a9b70f f6e31000 c04731ee .............1G.", " f6e31fa0: f6e31fa4 00000000 00000000 00000000 ................", " f6e31fb0: 00000000 00a9dd40 c0404f17 00000000 ....@....O@.....", " f6e31fc0: 00a9dd40 00000fff 00a9dd40 00a9b70f @.......@.......", " f6e31fd0: bf9e2718 ffffffda c040007b 0000007b .'......{.@.{...", " %s> rd -s f6e31f70 28", " f6e31f70: f6e31f6c f779c180 kmsg_read 00a9dd40 ", " f6e31f80: 00000fff vfs_read+159 f6e31fa4 f779c180 ", " f6e31f90: fffffff7 00a9b70f f6e31000 sys_read+60 ", " f6e31fa0: f6e31fa4 00000000 00000000 00000000 ", " f6e31fb0: 00000000 00a9dd40 syscall_call+7 00000000 ", " f6e31fc0: 00a9dd40 00000fff 00a9dd40 00a9b70f ", " f6e31fd0: bf9e2718 ffffffda startup_32+123 0000007b ", " %s> rd -S f6e31f70 28", " f6e31f70: [size-4096] [filp] kmsg_read 00a9dd40 ", " f6e31f80: 00000fff vfs_read+159 [size-4096] [filp] ", " f6e31f90: fffffff7 00a9b70f [size-4096] sys_read+60 ", " f6e31fa0: [size-4096] 00000000 00000000 00000000 ", " f6e31fb0: 00000000 00a9dd40 syscall_call+7 00000000 ", " f6e31fc0: 00a9dd40 00000fff 00a9dd40 00a9b70f ", " f6e31fd0: bf9e2718 ffffffda startup_32+123 0000007b ", " %s> rd -SS f6e31f70 28", " f6e31f70: [f6e31f6c:size-4096] [f779c180:filp] kmsg_read 00a9dd40 ", " f6e31f80: 00000fff vfs_read+159 [f6e31fa4:size-4096] [f779c180:filp] ", " f6e31f90: fffffff7 00a9b70f [f6e31000:size-4096] sys_read+60 ", " f6e31fa0: [f6e31fa4:size-4096] 00000000 00000000 00000000 ", " f6e31fb0: 00000000 00a9dd40 syscall_call+7 00000000 ", " f6e31fc0: 00a9dd40 00000fff 00a9dd40 00a9b70f ", " f6e31fd0: bf9e2718 ffffffda startup_32+123 0000007b ", "", " Read jiffies in hexadecimal and decimal format:\n", " %s> rd jiffies", " c0213ae0: 0008cc3a :...\n", " %s> rd -d jiffies", " c0213ae0: 577376\n", " Access the same memory in different sizes:\n", " %s> rd -64 kernel_version", " c0226a6c: 35312d352e322e32 2.2.5-15\n", " %s> rd -32 kernel_version 2", " c0226a6c: 2e322e32 35312d35 2.2.5-15\n", " %s> rd -16 kernel_version 4", " c0226a6c: 2e32 2e32 2d35 3531 2.2.5-15\n", " %s> rd -8 kernel_version 8 ", " c0226a6c: 32 2e 32 2e 35 2d 31 35 2.2.5-15", "\n Read the range of memory from c009bf2c to c009bf60:\n", " %s> rd c009bf2c -e c009bf60", " c009bf2c: c009bf64 c01328c3 c009bf64 c0132838 d....(..d...8(..", " c009bf3c: 0000002a 00000004 c57d77e8 00000104 *........w}.....", " c009bf4c: 0000000b c009a000 7fffffff 00000000 ................", " c009bf5c: 00000000 ....", NULL }; char *help_wr[] = { "wr", "write memory", "[-u|-k|-p] [-8|-16|-32|-64] [address|symbol] value", " This command modifies the contents of memory. The starting address may be", " entered either symbolically or by address. The default modification size ", " is the size of a long data type. Write permission must exist on the", " /dev/mem. When writing to memory on a live system, this command should ", " obviously be used with great care.\n", " -u address argument is a user virtual address.", " -k address argument is a kernel virtual address.", " -p address argument is a physical address.", " -8 write data in an 8-bit value.", " -16 write data in a 16-bit value.", " -32 write data in a 32-bit values (default on 32-bit machines).", " -64 write data in a 64-bit values (default on 64-bit machines).", " address address to write. The address is considered virtual unless the", " -p option is used. If a virtual address is specified, the", " -u or -k options are necessary only if the address space cannot", " be determined from the address value itself. If a user virtual", " address is specified, the address space of the current context", " implied. The address must be expressed in hexadecimal format.", " symbol symbol of starting address to write.", " value the value of the data to write.", "\nEXAMPLES", " Turn on a debug flag:\n", " %s> wr my_debug_flag 1", NULL }; char *help_bt[] = { "bt", "backtrace", "[-a|-g|-r|-t|-T|-l|-e|-E|-f|-F|-o|-O] [-R ref] [-s [-x|d]] [-I ip] [-S sp]" "\n [pid | task]", " Display a kernel stack backtrace. If no arguments are given, the stack", " trace of the current context will be displayed.\n", " -a displays the stack traces of the active task on each CPU.", " (only applicable to crash dumps)", #ifdef GDB_5_3 " -g use gdb stack trace code. (alpha only)", #else " -g displays the stack traces of all threads in the thread group of", #endif " the target task; the thread group leader will be displayed first.", " -r display raw stack data, consisting of a memory dump of the two", " pages of memory containing the task_union structure.", " -t display all text symbols found from the last known stack location", " to the top of the stack. (helpful if the back trace fails)", " -T display all text symbols found from just above the task_struct or", " thread_info to the top of the stack. (helpful if the back trace", " fails or the -t option starts too high in the process stack).", " -l show file and line number of each stack trace text location.", " -e search the stack for possible kernel and user mode exception frames.", " -E search the IRQ stacks (x86, x86_64 and ppc64), and the exception", " stacks (x86_64) for possible exception frames; all other arguments", " will be ignored since this is not a context-sensitive operation.", " -f display all stack data contained in a frame; this option can be", " used to determine the arguments passed to each function; on ia64,", " the argument register contents are dumped.", " -F[F] similar to -f, except that the stack data is displayed symbolically", " when appropriate; if the stack data references a slab cache object,", " the name of the slab cache will be displayed in brackets; on ia64,", " the substitution is done to the argument register contents. If -F", " is entered twice, and the stack data references a slab cache object,", " both the address and the name of the slab cache will be displayed", " in brackets.", " -o x86: use old backtrace method, permissible only on kernels that were", " compiled without the -fomit-frame_pointer.", " x86_64: use old backtrace method, which dumps potentially stale", " kernel text return addresses found on the stack.", " -O x86: use old backtrace method by default, permissible only on kernels", " that were compiled without the -fomit-frame_pointer; subsequent usage", " of this option toggles the backtrace method.", " x86_64: use old backtrace method by default; subsequent usage of this", " option toggles the backtrace method.", " -R ref display stack trace only if there is a reference to this symbol", " or text address.", " -s display the symbol name plus its offset.", " -x when displaying a symbol offset with the -s option, override the", " default output format with hexadecimal format.", " -d when displaying a symbol offset with the -s option, override the", " default output format with decimal format.", " -I ip use ip as the starting text location.", " -S sp use sp as the starting stack frame address.", " pid displays the stack trace(s) of this pid.", " taskp displays the stack trace the the task referenced by this hexadecimal", " task_struct pointer.\n", " Multiple pid and taskp arguments may be specified.\n", " Note that all examples below are for x86 only. The output format will differ", " for other architectures. x86 backtraces from kernels that were compiled", " with the --fomit-frame-pointer CFLAG occasionally will drop stack frames,", " or display a stale frame reference. When in doubt as to the accuracy of a", " backtrace, the -t or -T options may help fill in the blanks.\n", "EXAMPLES", " Display the stack trace of the active task(s) when the kernel panicked:\n", " %s> bt -a", " PID: 286 TASK: c0b3a000 CPU: 0 COMMAND: \"in.rlogind\"", " #0 [c0b3be90] crash_save_current_state at c011aed0", " #1 [c0b3bea4] panic at c011367c", " #2 [c0b3bee8] tulip_interrupt at c01bc820", " #3 [c0b3bf08] handle_IRQ_event at c010a551", " #4 [c0b3bf2c] do_8259A_IRQ at c010a319", " #5 [c0b3bf3c] do_IRQ at c010a653", " #6 [c0b3bfbc] ret_from_intr at c0109634", " EAX: 00000000 EBX: c0e68280 ECX: 00000000 EDX: 00000004 EBP: c0b3bfbc", " DS: 0018 ESI: 00000004 ES: 0018 EDI: c0e68284 ", " CS: 0010 EIP: c012f803 ERR: ffffff09 EFLAGS: 00000246 ", " #7 [c0b3bfbc] sys_select at c012f803", " #8 [c0b3bfc0] system_call at c0109598", " EAX: 0000008e EBX: 00000004 ECX: bfffc9a0 EDX: 00000000 ", " DS: 002b ESI: bfffc8a0 ES: 002b EDI: 00000000 ", " SS: 002b ESP: bfffc82c EBP: bfffd224 ", " CS: 0023 EIP: 400d032e ERR: 0000008e EFLAGS: 00000246 ", "\n Display the stack traces of task f2814000 and PID 1592:\n", " %s> bt f2814000 1592", " PID: 1018 TASK: f2814000 CPU: 1 COMMAND: \"java\"", " #0 [f2815db4] schedule at c011af85", " #1 [f2815de4] __down at c010600f", " #2 [f2815e14] __down_failed at c01061b3", " #3 [f2815e24] stext_lock (via drain_cpu_caches) at c025fa55", " #4 [f2815ec8] kmem_cache_shrink_nr at c013a53e", " #5 [f2815ed8] do_try_to_free_pages at c013f402", " #6 [f2815f04] try_to_free_pages at c013f8d2", " #7 [f2815f1c] _wrapped_alloc_pages at c01406bd", " #8 [f2815f40] __alloc_pages at c014079d", " #9 [f2815f60] __get_free_pages at c014083e", " #10 [f2815f68] do_fork at c011cebb", " #11 [f2815fa4] sys_clone at c0105ceb", " #12 [f2815fc0] system_call at c010740c", " EAX: 00000078 EBX: 00000f21 ECX: bc1ffbd8 EDX: bc1ffbe0", " DS: 002b ESI: 00000000 ES: 002b EDI: bc1ffd04", " SS: 002b ESP: 0807316c EBP: 080731bc", " CS: 0023 EIP: 4012881e ERR: 00000078 EFLAGS: 00000296", " ", " PID: 1592 TASK: c0cec000 CPU: 3 COMMAND: \"httpd\"", " #0 [c0ceded4] schedule at c011af85", " #1 [c0cedf04] pipe_wait at c0153083", " #2 [c0cedf58] pipe_read at c015317f", " #3 [c0cedf7c] sys_read at c0148be6", " #4 [c0cedfc0] system_call at c010740c", " EAX: 00000003 EBX: 00000004 ECX: bffed4a3 EDX: 00000001 ", " DS: 002b ESI: 00000001 ES: 002b EDI: bffed4a3 ", " SS: 002b ESP: bffed458 EBP: bffed488 ", " CS: 0023 EIP: 4024f1d4 ERR: 00000003 EFLAGS: 00000286 ", " ", " In order to examine each stack frame's contents use the bt -f option.", " From the extra frame data that is displayed, the arguments passed to each", " function can be determined. Re-examining the PID 1592 trace above:", " ", " %s> bt -f 1592", " PID: 1592 TASK: c0cec000 CPU: 3 COMMAND: \"httpd\"", " #0 [c0ceded4] schedule at c011af85", " [RA: c0153088 SP: c0ceded4 FP: c0cedf04 SIZE: 52]", " c0ceded4: c0cedf00 c0cec000 ce1a6000 00000003 ", " c0cedee4: c0cec000 f26152c0 cfafc8c0 c0cec000 ", " c0cedef4: ef70a0a0 c0cec000 c0cedf28 c0cedf54 ", " c0cedf04: c0153088 ", " #1 [c0cedf04] pipe_wait at c0153083", " [RA: c0153184 SP: c0cedf08 FP: c0cedf58 SIZE: 84]", " c0cedf08: 00000000 c0cec000 00000000 00000000 ", " c0cedf18: 00000000 c0a41fa0 c011d38b c0394120 ", " c0cedf28: 00000000 c0cec000 ceeebf30 ce4adf30 ", " c0cedf38: 00000000 d4b60ce0 00000000 c0cedf58 ", " c0cedf48: e204f820 ef70a040 00000001 c0cedf78 ", " c0cedf58: c0153184 ", " #2 [c0cedf58] pipe_read at c015317f", " [RA: c0148be8 SP: c0cedf5c FP: c0cedf7c SIZE: 36]", " c0cedf5c: ef70a040 c0cec000 00000000 00000000 ", " c0cedf6c: 00000001 f27ae680 ffffffea c0cedfbc ", " c0cedf7c: c0148be8 ", " #3 [c0cedf7c] sys_read at c0148be6", " [RA: c0107413 SP: c0cedf80 FP: c0cedfc0 SIZE: 68]", " c0cedf80: f27ae680 bffed4a3 00000001 f27ae6a0 ", " c0cedf90: 40160370 24000000 4019ba28 00000000 ", " c0cedfa0: 00000000 fffffffe bffba207 fffffffe ", " c0cedfb0: c0cec000 00000001 bffed4a3 bffed488 ", " c0cedfc0: c0107413 ", " #4 [c0cedfc0] system_call at c010740c", " EAX: 00000003 EBX: 00000004 ECX: bffed4a3 EDX: 00000001 ", " DS: 002b ESI: 00000001 ES: 002b EDI: bffed4a3 ", " SS: 002b ESP: bffed458 EBP: bffed488 ", " CS: 0023 EIP: 4024f1d4 ERR: 00000003 EFLAGS: 00000286 ", " [RA: 4024f1d4 SP: c0cedfc4 FP: c0cedffc SIZE: 60]", " c0cedfc4: 00000004 bffed4a3 00000001 00000001 ", " c0cedfd4: bffed4a3 bffed488 00000003 0000002b ", " c0cedfe4: 0000002b 00000003 4024f1d4 00000023 ", " c0cedff4: 00000286 bffed458 0000002b ", " ", " Typically the arguments passed to a function will be the last values", " that were pushed onto the stack by the next higher-numbered function, i.e.,", " the lowest stack addresses in the frame above the called function's", " stack frame. That can be verified by disassembling the calling function.", " For example, the arguments passed from sys_read() to pipe_read() above", " are the file pointer, the user buffer address, the count, and a pointer", " to the file structure's f_pos field. Looking at the frame #3 data for", " sys_read(), the last four items pushed onto the stack (lowest addresses)", " are f27ae680, bffed4a3, 00000001, and f27ae6a0 -- which are the 4 arguments", " above, in that order. Note that the first (highest address) stack content", " in frame #2 data for pipe_read() is c0148be8, which is the return address", " back to sys_read(). ", " ", " Dump the text symbols found in the current context's stack:\n", " %s> bt -t", " PID: 1357 TASK: c1aa0000 CPU: 0 COMMAND: \"lockd\"", " START: schedule at c01190e0", " [c1aa1f28] dput at c0157dbc", " [c1aa1f4c] schedule_timeout at c0124cd4", " [c1aa1f78] svc_recv at cb22c4d8 [sunrpc]", " [c1aa1f98] put_files_struct at c011eb21", " [c1aa1fcc] nlmclnt_proc at cb237bef [lockd]", " [c1aa1ff0] kernel_thread at c0105826", " [c1aa1ff8] nlmclnt_proc at cb237a60 [lockd]", " ", " Search the current stack for possible exception frames:\n", " %s> bt -e", " PID: 286 TASK: c0b3a000 CPU: 0 COMMAND: \"in.rlogind\"", " ", " KERNEL-MODE EXCEPTION FRAME AT c0b3bf44:", " EAX: 00000000 EBX: c0e68280 ECX: 00000000 EDX: 00000004 EBP: c0b3bfbc", " DS: 0018 ESI: 00000004 ES: 0018 EDI: c0e68284 ", " CS: 0010 EIP: c012f803 ERR: ffffff09 EFLAGS: 00000246 ", " ", " USER-MODE EXCEPTION FRAME AT c0b3bfc4:", " EAX: 0000008e EBX: 00000004 ECX: bfffc9a0 EDX: 00000000 ", " DS: 002b ESI: bfffc8a0 ES: 002b EDI: 00000000 ", " SS: 002b ESP: bfffc82c EBP: bfffd224 ", " CS: 0023 EIP: 400d032e ERR: 0000008e EFLAGS: 00000246 ", " ", " Display the back trace from a dumpfile that resulted from the execution", " of the %s utility's \"sys -panic\" command:\n", " %s> bt", " PID: 12523 TASK: c610c000 CPU: 0 COMMAND: \"crash\"", " #0 [c610de64] die at c01076ec", " #1 [c610de74] do_invalid_op at c01079bc", " #2 [c610df2c] error_code (via invalid_op) at c0107256", " EAX: 0000001d EBX: c024a4c0 ECX: c02f13c4 EDX: 000026f6 EBP: c610c000", " DS: 0018 ESI: 401de2e0 ES: 0018 EDI: c610c000", " CS: 0010 EIP: c011bbb4 ERR: ffffffff EFLAGS: 00010296", " #3 [c610df68] panic at c011bbb4", " #4 [c610df78] do_exit at c011f1fe", " #5 [c610dfc0] system_call at c0107154", " EAX: 00000001 EBX: 00000000 ECX: 00001000 EDX: 401df154", " DS: 002b ESI: 401de2e0 ES: 002b EDI: 00000000", " SS: 002b ESP: bffebf0c EBP: bffebf38", " CS: 0023 EIP: 40163afd ERR: 00000001 EFLAGS: 00000246", " ", " Display the back trace from a dumpfile that resulted from an attempt to", " insmod the sample \"crash.c\" kernel module that comes as part of the", " Red Hat netdump package:\n", " %s> bt", " PID: 1696 TASK: c74de000 CPU: 0 COMMAND: \"insmod\"", " #0 [c74dfdcc] die at c01076ec", " #1 [c74dfddc] do_page_fault at c0117bbc", " #2 [c74dfee0] error_code (via page_fault) at c0107256", " EAX: 00000013 EBX: cb297000 ECX: 00000000 EDX: c5962000 EBP: c74dff28", " DS: 0018 ESI: 00000000 ES: 0018 EDI: 00000000", " CS: 0010 EIP: cb297076 ERR: ffffffff EFLAGS: 00010282", " #3 [c74dff1c] crash_init at cb297076 [crash]", " #4 [c74dff2c] sys_init_module at c011d233", " #5 [c74dffc0] system_call at c0107154", " EAX: 00000080 EBX: 08060528 ECX: 08076450 EDX: 0000000a", " DS: 002b ESI: 0804b305 ES: 002b EDI: 08074ed0", " SS: 002b ESP: bffe9a90 EBP: bffe9ac8", " CS: 0023 EIP: 4012066e ERR: 00000080 EFLAGS: 00000246", " ", " Display the symbol name plus its offset in each frame, overriding", " the current output format with hexadecimal:\n", " %s> bt -sx", " PID: 1499 TASK: ffff88006af43cc0 CPU: 2 COMMAND: \"su\"", " #0 [ffff8800664a1c90] machine_kexec+0x167 at ffffffff810327b7", " #1 [ffff8800664a1ce0] crash_kexec+0x60 at ffffffff810a9ec0", " #2 [ffff8800664a1db0] oops_end+0xb0 at ffffffff81504160", " #3 [ffff8800664a1dd0] general_protection+0x25 at ffffffff81503435", " [exception RIP: kmem_cache_alloc+120]", " RIP: ffffffff8113cf88 RSP: ffff8800664a1e88 RFLAGS: 00010086", " RAX: 0000000000000000 RBX: ff88006ef56840ff RCX: ffffffff8114e9e4", " RDX: 0000000000000000 RSI: 00000000000080d0 RDI: ffffffff81796020", " RBP: ffffffff81796020 R8: ffff88000a3137a0 R9: 0000000000000000", " R10: ffff88007ac97300 R11: 0000000000000400 R12: 00000000000080d0", " R13: 0000000000000292 R14: 00000000000080d0 R15: 00000000000000c0", " ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018", " #4 [ffff8800664a1ed0] get_empty_filp+0x74 at ffffffff8114e9e4", " #5 [ffff8800664a1ef0] sock_alloc_fd+0x23 at ffffffff8142f553", " #6 [ffff8800664a1f10] sock_map_fd+0x23 at ffffffff8142f693", " #7 [ffff8800664a1f50] sys_socket+0x43 at ffffffff814302a3", " #8 [ffff8800664a1f80] system_call_fastpath+0x16 at ffffffff81013042", " RIP: 00007f5720b368e7 RSP: 00007fff52b629a8 RFLAGS: 00010206", " RAX: 0000000000000029 RBX: ffffffff81013042 RCX: 0000000000000000", " RDX: 0000000000000009 RSI: 0000000000000003 RDI: 0000000000000010", " RBP: 000000000066f320 R8: 0000000000000001 R9: 0000000000000000", " R10: 0000000000000000 R11: 0000000000000202 R12: ffff88007ac97300", " R13: 0000000000000000 R14: 00007f571e104a80 R15: 00007f571e305048", " ORIG_RAX: 0000000000000029 CS: 0033 SS: 002b", "", " The following three examples show the difference in the display of", " the same stack frame's contents using -f, -F, and -FF:", " ", " %s> bf -f", " ...", " #4 [ffff810072b47f10] vfs_write at ffffffff800789d8", " ffff810072b47f18: ffff81007e020380 ffff81007e2c2880 ", " ffff810072b47f28: 0000000000000002 fffffffffffffff7 ", " ffff810072b47f38: 00002b141825d000 ffffffff80078f75 ", " #5 [ffff810072b47f40] sys_write at ffffffff80078f75", " ...", " %s> bt -F", " ...", " #4 [ffff810072b47f10] vfs_write at ffffffff800789d8", " ffff810072b47f18: [files_cache] [filp] ", " ffff810072b47f28: 0000000000000002 fffffffffffffff7 ", " ffff810072b47f38: 00002b141825d000 sys_write+69 ", " #5 [ffff810072b47f40] sys_write at ffffffff80078f75", " ...", " %s> bf -FF", " ...", " #4 [ffff810072b47f10] vfs_write at ffffffff800789d8", " ffff810072b47f18: [ffff81007e020380:files_cache] [ffff81007e2c2880:filp]", " ffff810072b47f28: 0000000000000002 fffffffffffffff7 ", " ffff810072b47f38: 00002b141825d000 sys_write+69 ", " #5 [ffff810072b47f40] sys_write at ffffffff80078f75", " ...", NULL }; char *help_btop[] = { "btop", "bytes to page", "address ...", " This command translates a hexadecimal address to its page number.", "\nEXAMPLES", " %s> btop 512a000", " 512a000: 512a", NULL }; char *help_extend[] = { "extend", "extend the %s command set", "[shared-object ...] | [-u [shared-object ...]]", " This command dynamically loads or unloads %s extension shared object", " libraries:\n", " shared-object load the specified shared object file; more than one", " one object file may be entered.", " -u shared-object unload the specified shared object file; if no file", " arguments are specified, unload all objects.", "\n If the shared-object filename is not expressed with a fully-qualified", " pathname, the following directories will be searched in the order shown,", " and the first instance of the file that is found will be selected:\n", " 1. the current working directory", " 2. the directory specified in the CRASH_EXTENSIONS environment variable", " 3. /usr/lib64/crash/extensions (64-bit architectures)", " 4. /usr/lib/crash/extensions", "\n If no arguments are entered, the current set of shared object files and ", " a list of their commands will be displayed. The registered commands", " contained in each shared object file will appear automatically in the ", " \"help\" command screen.", "\n An example of a shared object prototype file, and how to compile it", " into a shared object, is appended below.", "\nEXAMPLES", " Load two shared object files:\n", " %s> extend extlib1.so extlib2.so", " ./extlib1.so: shared object loaded", " ./extlib2.so: shared object loaded", "\n Display the current set of shared object files and their commands:\n", " %s> extend", " SHARED OBJECT COMMANDS", " ./extlib1.so echo util bin", " ./extlib2.so smp show", "\n Unload one of the shared object files:\n", " %s> extend -u extlib1.so", " ./extlib1.so: shared object unloaded", "\n Unload all currently-loaded object files:\n", " %s> extend -u", " ./extlib2.so: shared object unloaded", "\nCREATING A SHARED OBJECT", " The extend command loads shared object files using dlopen(3), which in", " turn calls the shared object's constructor function. The shared object's", " constructor function should register its command set by calling ", " register_extension(), passing it a pointer to an array of one or more", " structures of the following type:", " ", " struct command_table_entry {", " char *name;", " cmd_func_t func;", " char **help_data,", " ulong flags;", " };", " ", " Each command_table_entry structure contains the ASCII name of a command,", " the command's function address, a pointer to an array of help data strings,", " and a flags field. The help_data field is optional; if it is non-NULL, it", " should point to an array of character strings used by the \"help\"", " command, and during command failures. The flags field currently has two", " available bit settings, REFRESH_TASK_TABLE, which should be set if it is ", " preferable to reload the current set of running processes just prior to ", " executing the command (on a live system) and MINIMAL, which should be ", " set if the command should be available in minimal mode. Terminate the array", " of command_table_entry structures with an entry with a NULL command name. ", " ", " Below is an example shared object file consisting of just one command, ", " called \"echo\", which simply echoes back all arguments passed to it.", " Note the comments contained within it for further details. Cut and paste", " the following output into a file, and call it, for example, \"echo.c\".", " Then compiled in either of two manners. Either manually like so:", " ", " gcc -shared -rdynamic -o echo.so echo.c -fPIC -D<machine-type> $(TARGET_CFLAGS)", " ", " where <machine-type> must be one of the MACHINE_TYPE #define's in defs.h,", " and where $(TARGET_CFLAGS) is the same as it is declared in the top-level", " Makefile after a build is completed. Or alternatively, the \"echo.c\" file", " can be copied into the \"extensions\" subdirectory, and compiled automatically", " like so:", " ", " make extensions", " ", " The echo.so file may be dynamically linked into %s during runtime, or", " during initialization by putting \"extend echo.so\" into a .%src file", " located in the current directory, or in the user's $HOME directory.", " ", "---------------------------------- cut here ----------------------------------", " ", "#include \"defs.h\" /* From the crash source top-level directory */", "", "void echo_init(void); /* constructor function */", "void echo_fini(void); /* destructor function (optional) */", "", "void cmd_echo(void); /* Declare the commands and their help data. */", "char *help_echo[];", "", "static struct command_table_entry command_table[] = {", " { \"echo\", cmd_echo, help_echo, 0}, /* One or more commands, */", " { NULL }, /* terminated by NULL, */", "};", "", "", "void __attribute__((constructor))", "echo_init(void) /* Register the command set. */", "{ ", " register_extension(command_table);", "}", " ", "/* ", " * This function is called if the shared object is unloaded. ", " * If desired, perform any cleanups here. ", " */", "void __attribute__((destructor))", "echo_fini(void) { }", "", "", "/* ", " * Arguments are passed to the command functions in the global args[argcnt]", " * array. See getopt(3) for info on dash arguments. Check out defs.h and", " * other %s commands for usage of the myriad of utility routines available", " * to accomplish what your task.", " */", "void", "cmd_echo(void)", "{", " int c;", "", " while ((c = getopt(argcnt, args, \"\")) != EOF) {", " switch(c)", " {", " default:", " argerrs++;", " break;", " }", " }", "", " if (argerrs)", " cmd_usage(pc->curcmd, SYNOPSIS);", "", " while (args[optind]) ", " fprintf(fp, \"%%s \", args[optind++]);", "", " fprintf(fp, \"\\n\");", "}", "", "/* ", " * The optional help data is simply an array of strings in a defined format.", " * For example, the \"help echo\" command will use the help_echo[] string", " * array below to create a help page that looks like this:", " * ", " * NAME", " * echo - echoes back its arguments", " *", " * SYNOPSIS", " * echo arg ...", " *", " * DESCRIPTION", " * This command simply echoes back its arguments.", " *", " * EXAMPLE", " * Echo back all command arguments:", " *", " * crash> echo hello, world", " * hello, world", " *", " */", " ", "char *help_echo[] = {", " \"echo\", /* command name */", " \"echoes back its arguments\", /* short description */", " \"arg ...\", /* argument synopsis, or \" \" if none */", " ", " \" This command simply echoes back its arguments.\",", " \"\\nEXAMPLE\",", " \" Echo back all command arguments:\\n\",", " \" %s> echo hello, world\",", " \" hello, world\",", " NULL", "};", "", NULL }; char *help_mach[] = { "mach", "machine specific data", "[-m | -c -[xd]]", " This command displays data specific to a machine type.\n", " -m Display the physical memory map (x86, x86_64 and ia64 only).", " -c Display each cpu's cpuinfo structure (x86, x86_64 and ia64 only).", " Display each cpu's x8664_pda structure (x86_64 only),", " Display the hwrpb_struct, and each cpu's percpu_struct (alpha only).", " -x override default output format with hexadecimal format.", " -d override default output format with decimal format.", "\nEXAMPLES", " %s> mach", " MACHINE TYPE: i686", " MEMORY SIZE: 512 MB", " CPUS: 2", " HYPERVISOR: KVM", " PROCESSOR SPEED: 1993 Mhz", " HZ: 100", " PAGE SIZE: 4096", // " L1 CACHE SIZE: 32", " KERNEL VIRTUAL BASE: c0000000", " KERNEL VMALLOC BASE: e0800000", " KERNEL STACK SIZE: 8192", " ", " Display the system physical memory map:\n", " %s> mach -m", " PHYSICAL ADDRESS RANGE TYPE", " 0000000000000000 - 00000000000a0000 E820_RAM", " 00000000000f0000 - 0000000000100000 E820_RESERVED", " 0000000000100000 - 000000001ff75000 E820_RAM", " 000000001ff75000 - 000000001ff77000 E820_NVS", " 000000001ff77000 - 000000001ff98000 E820_ACPI", " 000000001ff98000 - 0000000020000000 E820_RESERVED", " 00000000fec00000 - 00000000fec90000 E820_RESERVED", " 00000000fee00000 - 00000000fee10000 E820_RESERVED", " 00000000ffb00000 - 0000000100000000 E820_RESERVED", NULL }; char *help_map[] = { "map", "store KVM dumpfile memory map data", "[-a][-f [filename]]", " The layout of KVM guest dumpfiles created with \"virsh dump\" does not allow", " the crash utility to access the system's memory in a random access manner.", " Therefore, during crash session initialization, a potentially time-consuming", " dumpfile scan procedure is required to create a physical-memory-to-file-offset", " map for use during the session.", " ", " This command may be used to append the memory map data to the dumpfile or", " to store it in a permanent file. After this has been done, subsequent crash", " sessions using the dumpfile will no longer require the scan procedure:", " ", " -a Append the memory map to the end of the KVM dumpfile.", " -f Create a memory map file. If no filename argument is entered, the", " filename will consist of the dumpfile name with \".map\" appended,", " and will be located in the same directory as the dumpfile; it will", " be recognized and used automatically during subsequent %s sessions.", " However, if a \"filename\" argument is entered, and the default location", " and naming convention are not used, then the new memory map file will", " have to be added to the %s command line during invocation.", "\nEXAMPLES", " %s> map", " MAP FILE IN USE: vmcore.map", " %s> map -a", " MAP FILE APPENDED TO: vmcore", " %s> map -f", " MAP FILE CREATED: vmcore.map", " %s> map -f /tmp/vmcore.map", " MAP FILE CREATED: /tmp/vmcore.map", NULL }; char *help_timer[] = { "timer", "timer queue data", "[-r]", " This command displays the timer queue entries, both old- and new-style,", " in chronological order. In the case of the old-style timers, the", " timer_table array index is shown; in the case of the new-style timers, ", " the timer_list address is shown. On later kernels, the timer data is", " per-cpu.\n", " -r Display hrtimer timer queue entries, both old- and new-style, in", " chronological order. In the case of the old-style hrtimers, the", " expiration time is a single value; in the new-style hrtimers, the", " expiration time is a range.", "\nEXAMPLES", " %s> timer", " JIFFIES", " 68102", " EXPIRES TIMER_LIST/TABLE FUNCTION", " 68346 c0241934 c01775d4 <tcp_sltimer_handler>", " 68379 c0241204 c01696d8 <dev_do_watchdog>", " 68523 c7fcdfc0 c0112d6c <process_timeout>", " 68718 c7fd8edc c018719c <irlmp_discovery_timer_expired>", " 68723 timer_table[2] c01c707c <rs_timer>", " 68742 c20c1f7c c0112d6c <process_timeout>", " 68742 c20c1f7c c0112d6c <process_timeout>", " 68742 c20c1f7c c0112d6c <process_timeout>", " 68752 c7fd1fc4 c0112d6c <process_timeout>", " 68752 c7fd1fc4 c0112d6c <process_timeout>", " 68989 c0241d40 c0168060 <neigh_periodic_timer>", " 69028 c2533f7c c0112d6c <process_timeout>", " 69134 c22dd868 c0181948 <unix_destroy_timer>", " 71574 c0241430 c0169ea4 <rt_check_expire>", " 72179 c7fb1c48 c01cb9a0 <vortex_timer>", " 73144 c1b17f10 c0112d6c <process_timeout>", " 73259 c17a5f10 c0112d6c <process_timeout>", " 112929 c203ff10 c0112d6c <process_timeout>", " 372010 c2323f7c c0112d6c <process_timeout>", " 372138 c2191f10 c0112d6c <process_timeout>", " 8653052 c1f13f10 c0112d6c <process_timeout>", " ", " Display the timer queue on a 2-cpu system:\n", " %s> timer", " TVEC_BASES[0]: c1299be0", " JIFFIES", " 18256298", " EXPIRES TIMER_LIST FUNCTION", " 18256406 cd5ddec0 c01232bb <process_timeout>", " 18256677 ceea93e0 c011e3cc <it_real_fn>", " 18256850 ceea7f64 c01232bb <process_timeout>", " 18258751 cd1d4f64 c01232bb <process_timeout>", " 18258792 cf5782f0 c011e3cc <it_real_fn>", " 18261266 c03c9f80 c022fad5 <rt_check_expire>", " 18262196 c02dc2e0 c0233329 <peer_check_expire>", " 18270518 ceb8bf1c c01232bb <process_timeout>", " 18271327 c03c9120 c0222074 <flow_cache_new_hashrnd>", " 18271327 c03ca580 c0233ace <ipfrag_secret_rebuild>", " 18272532 c02d1e18 c0129946 <delayed_work_timer_fn>", " 18276518 c03c9fc0 c022fd40 <rt_secret_rebuild>", " 18332334 ceea9970 c011e3cc <it_real_fn>", " 18332334 cfb6a840 c011e3cc <it_real_fn>", " 18665378 cec25ec0 c01232bb <process_timeout>", " TVEC_BASES[1]: c12a1be0", " JIFFIES", " 18256298", " EXPIRES TIMER_LIST FUNCTION", " 18256493 c02c7d00 c013dad5 <wb_timer_fn>", " 18256499 c12a2db8 c0129946 <delayed_work_timer_fn>", " 18277900 ceebaec0 c01232bb <process_timeout>", " 18283769 cf739f64 c01232bb <process_timeout>", " 18331902 cee8af64 c01232bb <process_timeout>", " ", " Display a new-style hrtimer queue:\n", " %s> timer -r", " CPU: 0 HRTIMER_CPU_BASE: c1e03fc0", " CLOCK: 0 HRTIMER_CLOCK_BASE: c1e03fc4 [ktime_get_real]", " (empty)", " ", " CLOCK: 1 HRTIMER_CLOCK_BASE: c1e03ff0 [ktime_get]", " CURRENT", " 322894000000", " SOFTEXPIRES EXPIRES HRTIMER FUNCTION", " 322895000000 322895000000 c1e04080 c04833e0 <tick_sched_timer>", " 324022213609 324022213609 c1e041c0 c04b17d0 <watchdog_timer_fn>", " 326766922781 326766972781 f3a45f44 c0477ed0 <hrtimer_wakeup>", " 364516801997 364516851997 f43bbf44 c0477ed0 <hrtimer_wakeup>", " ", " CLOCK: 2 HRTIMER_CLOCK_BASE: c1e0401c [ktime_get_boottime]", " (empty)", " ", " CPU: 1 HRTIMER_CPU_BASE: c1e43fc0", " CLOCK: 0 HRTIMER_CLOCK_BASE: c1e43fc4 [ktime_get_real]", " (empty)", " ", " CLOCK: 1 HRTIMER_CLOCK_BASE: c1e43ff0 [ktime_get]", " CURRENT", " 322894000000", " SOFTEXPIRES EXPIRES HRTIMER FUNCTION", " 322895062500 322895062500 c1e44080 c04833e0 <tick_sched_timer>", " 324087213609 324087213609 c1e441c0 c04b17d0 <watchdog_timer_fn>", " 381034500892 381034550892 f3a1bea0 c0477ed0 <hrtimer_wakeup>", " ", " CLOCK: 2 HRTIMER_CLOCK_BASE: c1e4401c [ktime_get_boottime]", " (empty)", " ...", " ", " Display an old-style hrtimer queue:\n", " %s> timer -r", " CPU: 0", " CLOCK: 0 HRTIMER_BASE: ca00dae0 [ktime_get_real]", " (empty)", " ", " CLOCK: 1 HRTIMER_BASE: ca00db0c [ktime_get]", " CURRENT", " 1480537567000000", " EXPIRES HRTIMER FUNCTION", " 1480997557052703 f79c4944 c0427d18 <it_real_fn>", " 1481009329944302 cdcbaf6c c0436a1e <hrtimer_wakeup>", " 1481026181758643 ea01cf6c c0436a1e <hrtimer_wakeup>", " 1481497068511094 f79a6244 c0427d18 <it_real_fn>", " 1481589831928489 f7af6944 c0427d18 <it_real_fn>", " 1481592731187337 f64ed784 c0427d18 <it_real_fn>", " ", " CPU: 1", " CLOCK: 0 HRTIMER_BASE: ca0148c4 [ktime_get_real]", " (empty)", " ", " CLOCK: 1 HRTIMER_BASE: ca0148f0 [ktime_get]", " CURRENT", " 1480537567000000", " EXPIRES HRTIMER FUNCTION", " 1481017523822478 ca3b15c4 c0427d18 <it_real_fn>", " 1481238077723188 f5f35f6c c0436a1e <hrtimer_wakeup>", " 1481492107740948 f5dadf6c c0436a1e <hrtimer_wakeup>", " 1482936527251241 ca1becc4 c0427d18 <it_real_fn>", " 1482936545249010 f7d42e84 c0427d18 <it_real_fn>", " 1492850155229325 ea01ef6c c0436a1e <hrtimer_wakeup>", " ...", " ", NULL }; char *help_runq[] = { "runq", "run queue", "[-t] [-g]", " With no argument, this command displays the tasks on the run queues", " of each cpu.", " ", " -t Display the timestamp information of each cpu's runqueue, which is the", " rq.clock, rq.most_recent_timestamp or rq.timestamp_last_tick value,", " whichever applies; following each cpu timestamp is the last_run or ", " timestamp value of the active task on that cpu, whichever applies, ", " along with the task identification.", " -g Display tasks hierarchically by task_group. The task_group line shows", " the task_group address, the cfs_rq or rt_rq address, the task_group name", " (if any), and whether the task_group is throttled.", "\nEXAMPLES", " Display the tasks on an O(1) scheduler run queue:\n", " %s> runq", " CPU 0 RUNQUEUE: ffff880001cdb460", " CURRENT: PID: 2739 TASK: ffff8800320fa7e0 COMMAND: \"bash\"", " ACTIVE PRIO_ARRAY: ffff880001cdb4d8", " [115] PID: 2739 TASK: ffff8800320fa7e0 COMMAND: \"bash\"", " PID: 1776 TASK: ffff88003217d820 COMMAND: \"syslogd\"", " EXPIRED PRIO_ARRAY: ffff880001cdbdb8", " [no tasks queued]", " ", " CPU 1 RUNQUEUE: ffff880001ce3460", " CURRENT: PID: 1779 TASK: ffff88003207a860 COMMAND: \"klogd\"", " ACTIVE PRIO_ARRAY: ffff880001ce34d8", " [115] PID: 1779 TASK: ffff88003207a860 COMMAND: \"klogd\"", " EXPIRED PRIO_ARRAY: ffff880001ce3db8", " [no tasks queued]", " ", " Display the tasks on a CFS run queue:\n", " %s> runq", " CPU 0 RUNQUEUE: ffff8800090436c0", " CURRENT: PID: 588 TASK: ffff88007e4877a0 COMMAND: \"udevd\"", " RT PRIO_ARRAY: ffff8800090437c8", " [no tasks queued]", " CFS RB_ROOT: ffff880009043740", " [118] PID: 2110 TASK: ffff88007d470860 COMMAND: \"check-cdrom.sh\"", " [118] PID: 2109 TASK: ffff88007f1247a0 COMMAND: \"check-cdrom.sh\"", " [118] PID: 2114 TASK: ffff88007f20e080 COMMAND: \"udevd\"", " ", " CPU 1 RUNQUEUE: ffff88000905b6c0", " CURRENT: PID: 2113 TASK: ffff88007e8ac140 COMMAND: \"udevd\"", " RT PRIO_ARRAY: ffff88000905b7c8", " [no tasks queued]", " CFS RB_ROOT: ffff88000905b740", " [118] PID: 2092 TASK: ffff88007d7a4760 COMMAND: \"MAKEDEV\"", " [118] PID: 1983 TASK: ffff88007e59f140 COMMAND: \"udevd\"", " [118] PID: 2064 TASK: ffff88007e40f7a0 COMMAND: \"udevd\"", " [115] PID: 2111 TASK: ffff88007e4278a0 COMMAND: \"kthreadd\"", " ", " Display run queue timestamp data:\n", " %s> runq -t ", " CPU 0: 2680990637359", " 2680986653330 PID: 28228 TASK: ffff880037ca2ac0 COMMAND: \"loop\"", " CPU 1: 2680940618478", " 2680940618478 PID: 28167 TASK: ffff880078130040 COMMAND: \"bash\"", " CPU 2: 2680990763425", " 2680986785772 PID: 28227 TASK: ffff8800787780c0 COMMAND: \"loop\"", " CPU 3: 2680990954469", " 2680986059540 PID: 28226 TASK: ffff880078778b00 COMMAND: \"loop\"", " ", " Display tasks hierarchically by task_group:\n", " %s> runq -g ", " CPU 0", " CURRENT: PID: 14734 TASK: ffff88010626f500 COMMAND: \"sh\"", " ROOT_TASK_GROUP: ffffffff81ed93e0 RT_RQ: ffff880028216808", " [ 0] TASK_GROUP: ffff88022c6bbc00 RT_RQ: ffff880139fc9800 (THROTTLED)", " [ 0] PID: 14750 TASK: ffff88013a4dd540 COMMAND: \"rtloop99\"", " [ 1] PID: 14748 TASK: ffff88013bbca040 COMMAND: \"rtloop98\"", " [ 1] TASK_GROUP: ffff88012b0fb400 RT_RQ: ffff880089029000 ", " [ 1] PID: 14752 TASK: ffff880088abf500 COMMAND: \"rtloop98\"", " [ 54] PID: 14749 TASK: ffff880037a4e080 COMMAND: \"rtloop45\"", " [ 98] PID: 14746 TASK: ffff88012678c080 COMMAND: \"rtloop1\"", " ROOT_TASK_GROUP: ffffffff81ed93e0 CFS_RQ: ffff8800282166e8", " [120] PID: 14740 TASK: ffff88013b1e6080 COMMAND: \"sh\"", " [120] PID: 14738 TASK: ffff88012678d540 COMMAND: \"sh\"", " [120] PID: 14734 TASK: ffff88010626f500 COMMAND: \"sh\" [CURRENT]", " TASK_GROUP: ffff884052bc9800 CFS_RQ: ffff8831e4a1b000 (THROTTLED)", " [120] PID: 14732 TASK: ffff88013bbcb500 COMMAND: \"sh\"", " [120] PID: 14728 TASK: ffff8800b3496080 COMMAND: \"sh\"", " [120] PID: 14730 TASK: ffff880037833540 COMMAND: \"sh\"", " TASK_GROUP: ffff884058f1d000 CFS_RQ: ffff88120a101600 (THROTTLED)", " [120] PID: 14726 TASK: ffff880138d42aa0 COMMAND: \"sh\"", " ...", " ", " %s> runq -g", " CPU 0", " CURRENT: PID: 2948 TASK: ffff88022af2a100 COMMAND: \"bash\"", " INIT_TASK_GROUP: ffffffff81e1a780 RT_RQ: ffff880028216148", " [no tasks queued]", " INIT_TASK_GROUP: ffffffff81e1a780 CFS_RQ: ffff880028216028", " [120] PID: 2948 TASK: ffff88022af2a100 COMMAND: \"bash\" [CURRENT]", " TASK_GROUP: ffff88012b880800 CFS_RQ: ffff88012c5d1000 <libvirt>", " TASK_GROUP: ffff88012c078000 CFS_RQ: ffff88012c663e00 <qemu>", " TASK_GROUP: ffff88022c7f4c00 CFS_RQ: ffff88012bb56000 <guest2>", " TASK_GROUP: ffff88022b621400 CFS_RQ: ffff88012b012000 <vcpu0>", " [120] PID: 3248 TASK: ffff88012a9d4100 COMMAND: \"qemu-kvm\"", " ...", NULL }; char *help_repeat[] = { "repeat", "repeat a command", "[-seconds] command", " This command repeats a command indefinitely, optionally delaying a given", " number of seconds between each command execution.\n", " -seconds The number of seconds to delay between command executions.", " This option must precede the command name to be executed.", " ", " Command execution may be stopped with CTRL-C, or if scrolling is in effect,", " by entering \"q\". This command is meant for use on a live system; it is", " hard to conceive of a reason to use it when debugging a crash dump.", "\nEXAMPLES", " Display the value of jiffies once per second:\n", " %s> repeat -1 p jiffies", " jiffies = $1 = 155551079", " jiffies = $2 = 155551180", " jiffies = $3 = 155551281", " jiffies = $4 = 155551382", " jiffies = $5 = 155551483", " jiffies = $6 = 155551584", " jiffies = $7 = 155551685", " jiffies = $8 = 155551786", " jiffies = $9 = 155551887", " jiffies = $10 = 155551988", " jiffies = $11 = 155552089", " jiffies = $12 = 155552190", " jiffies = $13 = 155552291", " jiffies = $14 = 155552392", " jiffies = $15 = 155552493", " jiffies = $16 = 155552594", " jiffies = $17 = 155552695", " jiffies = $18 = 155552796", " ...", NULL }; char *help_pte[] = { "pte", "translate a page table entry", "contents ...", " This command translates the hexadecimal contents of a PTE into its physical", " page address and page bit settings. If the PTE references a swap location,", " the swap device and offset are displayed.", "\nEXAMPLES\n", " %s> pte d8e067", " PTE PHYSICAL FLAGS", " d8e067 d8e000 (PRESENT|RW|USER|ACCESSED|DIRTY)", " ", " %s> pte 13f600", " PTE SWAP OFFSET", " 13f600 /dev/hda2 5104", NULL }; char *help_swap[] = { "swap", "swap device information", " ", " This command displays information for each configured swap device.", "\nEXAMPLE", " %s> swap", " SWAP_INFO_STRUCT TYPE SIZE USED PCT PRI FILENAME", " ffff880153d45f40 PARTITION 7192568k 1200580k 16% -1 /dev/dm-1", NULL }; char *help_dev[] = { "dev", "device data", "[-i | -p | -d]", " If no argument is entered, this command dumps character and block", " device data.\n", " -i display I/O port usage; on 2.4 kernels, also display I/O memory usage.", " -p display PCI device data.", " -d display disk I/O statistics:", " TOTAL: total number of allocated in-progress I/O requests", " SYNC: I/O requests that are synchronous", " ASYNC: I/O requests that are asynchronous", " READ: I/O requests that are reads (older kernels)", " WRITE: I/O requests that are writes (older kernels)", " DRV: I/O requests that are in-flight in the device driver", "\nEXAMPLES", " Display character and block device data:\n", " %s> dev", " CHRDEV NAME CDEV OPERATIONS", " 1 mem f79b83c0 memory_fops", " 4 /dev/vc/0 c07bc560 console_fops", " 4 tty f7af5004 tty_fops", " 4 ttyS f7b02204 tty_fops", " 5 /dev/tty c07bc440 tty_fops", " 5 /dev/console c07bc4a0 console_fops", " 5 /dev/ptmx c07bc500 ptmx_fops", " 6 lp c5797e40 lp_fops", " 7 vcs f7b03d40 vcs_fops", " 10 misc f7f68640 misc_fops", " 13 input f79b8840 input_fops", " 21 sg f7f12840 sg_fops", " 29 fb f7f8c640 fb_fops", " 128 ptm f7b02604 tty_fops", " 136 pts f7b02404 tty_fops", " 162 raw c0693e40 raw_fops", " 180 usb f79b8bc0 usb_fops", " 189 usb_device c06a0300 usbfs_device_file_operations", " 216 rfcomm f5961a04 tty_fops", " 254 pcmcia f79b82c0 ds_fops", " ", " BLKDEV NAME GENDISK OPERATIONS", " 1 ramdisk f7b23480 rd_bd_op", " 8 sd f7cab280 sd_fops", " 9 md f7829b80 md_fops", " 11 sr f75c24c0 sr_bdops", " 65 sd (none) ", " 66 sd (none) ", " 67 sd (none) ", " 68 sd (none) ", " 69 sd (none) ", " 70 sd (none) ", " 71 sd (none) ", " 128 sd (none) ", " 129 sd (none) ", " 130 sd (none) ", " 131 sd (none) ", " 132 sd (none) ", " 133 sd (none) ", " 134 sd (none) ", " 135 sd (none) ", " 253 device-mapper c57a0ac0 dm_blk_dops", " 254 mdp (none) ", "\n Display PCI data:\n", " %s> dev -p", " PCI_DEV BU:SL.FN CLASS: VENDOR-DEVICE", " c00051c0 00:00.0 Host bridge: Intel 440BX - 82443BX Host", " c0005250 00:01.0 PCI bridge: Intel 440BX - 82443BX AGP", " c00052e0 00:07.0 ISA bridge: Intel 82371AB PIIX4 ISA", " c0005370 00:07.1 IDE interface: Intel 82371AB PIIX4 IDE", " c0005400 00:07.2 USB Controller: Intel 82371AB PIIX4 USB", " c0005490 00:07.3 Bridge: Intel 82371AB PIIX4 ACPI", " c0005520 00:11.0 Ethernet controller: 3Com 3C905B 100bTX", " c00055b0 00:13.0 PCI bridge: DEC DC21152", " c0005640 01:00.0 VGA compatible controller: NVidia [PCI_DEVICE 28]", " c00056d0 02:0a.0 SCSI storage controller: Adaptec AIC-7890/1", " c0005760 02:0e.0 SCSI storage controller: Adaptec AIC-7880U", "\n Display I/O port and I/O memory usage:\n", " %s> dev -i", " RESOURCE RANGE NAME", " c03036d4 0000-ffff PCI IO", " c0302594 0000-001f dma1", " c03025b0 0020-003f pic1", " c03025cc 0040-005f timer", " c03025e8 0060-006f keyboard", " c0302604 0080-008f dma page reg", " c0302620 00a0-00bf pic2", " c030263c 00c0-00df dma2", " c0302658 00f0-00ff fpu", " c122ff20 0170-0177 ide1", " c122f240 0213-0213 isapnp read", " c122ff40 02f8-02ff serial(auto)", " c122ff00 0376-0376 ide1", " c03186e8 03c0-03df vga+", " c122ff60 03f8-03ff serial(auto)", " c123851c 0800-083f Intel Corporation 82371AB PIIX4 ACPI", " c1238538 0840-085f Intel Corporation 82371AB PIIX4 ACPI", " c122f220 0a79-0a79 isapnp write", " c122f200 0cf8-0cff PCI conf1", " c1238858 dc00-dc7f 3Com Corporation 3c905B 100BaseTX [Cyclone]", " c122fc00 dc00-dc7f 00:11.0", " c12380c8 dce0-dcff Intel Corporation 82371AB PIIX4 USB", " c1238d1c e000-efff PCI Bus #02", " c1237858 e800-e8ff Adaptec AIC-7880U", " c1237458 ec00-ecff Adaptec AHA-2940U2/W / 7890", " c1239cc8 ffa0-ffaf Intel Corporation 82371AB PIIX4 IDE", " ", " RESOURCE RANGE NAME", " c03036f0 00000000-ffffffff PCI mem", " c0004000 00000000-0009ffff System RAM", " c03026ac 000a0000-000bffff Video RAM area", " c03026fc 000c0000-000c7fff Video ROM", " c0302718 000c9800-000cdfff Extension ROM", " c0302734 000ce000-000ce7ff Extension ROM", " c0302750 000ce800-000cffff Extension ROM", " c03026e0 000f0000-000fffff System ROM", " c0004040 00100000-07ffdfff System RAM", " c0302674 00100000-0028682b Kernel code", " c0302690 0028682c-0031c63f Kernel data", " c0004060 07ffe000-07ffffff reserved", " c1239058 ec000000-efffffff Intel Corporation 440BX/ZX - 82443BX/ZX Host", " bridge", " c1238d54 f1000000-f1ffffff PCI Bus #02", " c1239554 f2000000-f5ffffff PCI Bus #01", " c1237074 f4000000-f5ffffff nVidia Corporation Riva TnT2 [NV5]", " c1238d38 fa000000-fbffffff PCI Bus #02", " c1237874 faffe000-faffefff Adaptec AIC-7880U", " c127ec40 faffe000-faffefff aic7xxx", " c1237474 fafff000-faffffff Adaptec AHA-2940U2/W / 7890", " c127eec0 fafff000-faffffff aic7xxx", " c1239538 fc000000-fdffffff PCI Bus #01", " c1237058 fc000000-fcffffff nVidia Corporation Riva TnT2 [NV5]", " c1238874 fe000000-fe00007f 3Com Corporation 3c905B 100BaseTX [Cyclone]", " c0004080 fec00000-fec0ffff reserved", " c00040a0 fee00000-fee0ffff reserved", " c00040c0 ffe00000-ffffffff reserved", "\n Display disk I/O statistics:\n", " %s> dev -d", " MAJOR GENDISK NAME REQUEST_QUEUE TOTAL READ WRITE DRV", " 2 ffff81012d8a5000 fd0 ffff81012dc053c0 12 0 12 0", " 22 ffff81012dc6b000 hdc ffff81012d8ae340 2 2 0 0", " 8 ffff81012dd71000 sda ffff81012d8af040 6 0 6 6", " 8 ffff81012dc77000 sdb ffff81012d8b5740 0 0 0 0", " 8 ffff81012d8d0c00 sdc ffff81012d8ae9c0 0 0 0 0", NULL }; char *help_search[] = { "search", "search memory", "[-s start] [ -[kKV] | -u | -p | -t ] [-e end | -l length] [-m mask]\n" " [-x count] -[cwh] [value | (expression) | symbol | string] ...", " This command searches for a given value within a range of user virtual, kernel", " virtual, or physical memory space. If no end nor length value is entered, ", " then the search stops at the end of user virtual, kernel virtual, or physical", " address space, whichever is appropriate.", " ", " An optional mask value may be entered to mask off \"don't care\" bits.\n", " -s start Start the search at this hexadecimal user or kernel virtual ", " address, physical address, or kernel symbol. The start address", " must be appropriate for the memory type specified; if no memory", " type is specified, the default is kernel virtual address space.", " -k If no start address is specified, start the search at the base", " of kernel virtual address space. This option is the default.", " -K Same as -k, except that mapped kernel virtual memory that was", " allocated by vmalloc(), module memory, or virtual mem_map regions", " will not be searched.", " -V Same as -k, except that unity-mapped kernel virtual memory and", " mapped kernel-text/static-data (x86_64 and ia64) will not be", " searched.", " -u If no start address is specified, start the search at the base", " of the current context's user virtual address space. If a start", " address is specified, then this option specifies that the start", " address is a user virtual address.", " -p If no start address is specified, start the search at the base", " of physical address space. If a start address is specified,", " then this option specifies that the start address is a physical ", " address.", " -t Search only the kernel stack pages of every task. If one or more", " matches are found in a task's kernel stack, precede the output", " with a task-identifying header.", " -e end Stop the search at this hexadecimal user or kernel virtual", " address, kernel symbol, or physical address. The end address", " must be appropriate for the memory type specified.", " -l length Length in bytes of address range to search.", " -m mask Ignore the bits that are set in the hexadecimal mask value.", " -c Search for character string values instead of unsigned longs. If", " the string contains any space(s), it must be encompassed by double", " quotes.", " -w Search for unsigned hexadecimal ints instead of unsigned longs.", " This is only meaningful on 64-bit systems in order to search both", " the upper and lower 32-bits of each 64-bit long for the value.", " -h Search for unsigned hexadecimal shorts instead of unsigned longs.", " -x count Display the memory contents before and after any found value. The", " before and after memory context will consist of \"count\" memory", " items of the same size as the \"value\" argument. This option is", " not applicable with the -c option.", " value Search for this hexadecimal long, unless modified by the -c, -w, ", " or -h options.", "(expression) Search for the value of this expression; the expression value must", " not overflow the designated size when -h or -w are used; not", " applicable when used with the -c option.", " symbol Search for this symbol value; the symbol value must not overflow", " the designated size when -h or -w are used; not applicable when ", " used with the -c option.", " string Search for character string values; if the string contains any ", " space(s), it must be encompassed by double quotes; only applicable", " with the -c option.", " ", " If -k, -K, -V, -u, -p or -t are not used, then the search defaults to kernel", " virtual address space. The starting address must be long-word aligned. ", " Address ranges that start in user space and end in kernel space are not", " accepted.", "\nEXAMPLES", " Search the current context's address space for all instances of 0xdeadbeef:", "\n %s> search -u deadbeef", " 81aba5c: deadbeef", " 81abaa8: deadbeef", " bfffc698: deadbeef", " bffff390: deadbeef", "\n Search all kernel memory above the kernel text space for all instances", " of 0xabcd occurring in the lower 16-bits of each 32-bit word: \n", " %s> search -s _etext -m ffff0000 abcd", " c071481c: abcd", " c0c2b0fc: 804abcd", " c0cf5e74: 7489abcd", " c17c0b44: c012abcd", " c1dac730: 3dbeabcd", " c226d0e8: ffffabcd", " c23ed5dc: abcd", " c3022544: 3dbeabcd", " c3069b58: 3dbeabcd", " c3e86e84: aabcd", " c3e88ed0: aabcd", " c3e8ee5c: aabcd", " c3e9df50: aabcd", " c3e9e930: aabcd", " c440a778: 804abcd", " c486eb44: 3dbeabcd", " c578f0fc: 804abcd", " c6394f90: 8ababcd", " c65219f0: 3abcd", " c661399c: abcd", " c68514ac: 8abcd", " c7e036bc: 3dbeabcd", " c7e12568: 5abcd", " c7e1256c: 5abcd", "\n Search the 4K page at c532c000 for all instances of 0xffffffff:\n", " %s> search -s c532c000 -l 4096 ffffffff", " c532c33c: ffffffff", " c532c3fc: ffffffff", "\n Search the static kernel data area for all instances of c2d400eb:\n", " %s> search -s _etext -e _edata c2d400eb", " c022b550: c2d400eb", " c022b590: c2d400eb", " c022b670: c2d400eb", " c022b6e0: c2d400eb", " c022b7b0: c2d400eb", " c022b7e0: c2d400eb", " c022b8b0: c2d400eb", "\n Search physical memory for all instances of 0xbabe occurring in the", " upper 16 bits of each 32-bit word:\n", " %s> search -p babe0000 -m ffff", " 2a1dc4: babe671e", " 2b6928: babe3de1", " 2f99ac: babe0d54", " 31843c: babe70b9", " 3ba920: babeb5d7", " 413ce4: babe7540", " 482747c: babe2600", " 48579a4: babe2600", " 4864a68: babe2600", " ...", "\n Search physical memory for all instances of 0xbabe occurring in the", " upper 16 bits of each 32-bit word on a 64-bit system:\n", " %s> search -p babe0000 -m ffff -w", " 102e248: babe1174", " 11d2f90: babe813d", " 122d3ad70: babe6b27", " 124d8cd30: babe3dc8", " 124d8eefc: babef981", " 124d8f060: babe3dc8", " 124d8f17c: babefc81", " ...", "\n Search kernel memory for all instances of 32-bit value 0xbabe1174", " on a 64-bit system:\n", " %s> search -k -w babe1174", " ffff88000102e248: babe1174", " ffffffff8102e248: babe1174", "\n Search kernel memory for two strings:\n", " %s> search -k -c \"can\'t allocate memory\" \"Failure to\"", " ffff8800013ddec1: can\'t allocate memory for key lists..<3>%%s %%s: error con", " ffff8801258be748: Failure to install fence: %%d..<3>[drm:%%s] *ERROR* Failed", " ffff880125f07ec9: can\'t allocate memory..<3>ACPI: Invalid data..Too many d", " ffffffff813ddec1: can\'t allocate memory for key lists..<3>%%s %%s: error con", "\n Search the kernel stacks of all tasks for those that contain the inode", " address ffff81002c0a3050:\n", " %s> search -t ffff81002c0a3050", " PID: 4876 TASK: ffff81003e9f5860 CPU: 7 COMMAND: \"automount\"", " ffff8100288fbe98: ffff81002c0a3050", " ", " PID: 4880 TASK: ffff81003ce967a0 CPU: 0 COMMAND: \"automount\"", " ffff81002c0fbdd8: ffff81002c0a3050", " ffff81002c0fbe78: ffff81002c0a3050", "\n When a kernel symbol or an (expression) is used an argument, both the", " resultant value and the input string are displayed:\n", " %s> search anon_inode_inode (__down_interruptible+191)", " ffff81000222a728: ffffffff80493d60 (anon_inode_inode)", " ffff810005a1e918: ffffffff800649d6 (__down_interruptible+191)", " ffff810005a1e9d0: ffffffff800649d6 (__down_interruptible+191)", " ffff810005a1eb48: ffffffff800649d6 (__down_interruptible+191)", " ffff81000b409c60: ffffffff80493d60 (anon_inode_inode)", " ffff81000c155b98: ffffffff80493d60 (anon_inode_inode)", " ffff8100194fac70: ffffffff80493d60 (anon_inode_inode)", " ffff81001daa1008: ffffffff80493d60 (anon_inode_inode)", " ffff810028b95830: ffffffff800649d6 (__down_interruptible+191)", " ffff81002cea0c70: ffffffff80493d60 (anon_inode_inode)", " ffff810031327268: ffffffff80493d60 (anon_inode_inode)", " ffff810031327270: ffffffff800649d6 (__down_interruptible+191)", " ffff810034b1ccd0: ffffffff800649d6 (__down_interruptible+191)", " ffff8100399565a8: ffffffff80493d60 (anon_inode_inode)", " ffff81003a278cd0: ffffffff800649d6 (__down_interruptible+191)", " ffff81003cc23e08: ffffffff800649d6 (__down_interruptible+191)", NULL }; char *help_irq[] = { "irq", "IRQ data", "[[[index ...] | -u ] | -d | -b | -a | -s [-c cpu]]", " This command collaborates the data in an irq_desc_t, along with its", " associated hw_interrupt_type and irqaction structure data, into a", " consolidated per-IRQ display. For kernel versions 2.6.37 and later", " the display consists of the irq_desc/irq_data address, its irqaction", " address(es), and the irqaction name strings. Alternatively, the", " intel interrupt descriptor table, bottom half data, cpu affinity for", " in-use irqs, or kernel irq stats may be displayed. If no index value", " argument(s) nor any options are entered, the IRQ data for all IRQs will", " be displayed.\n", " index a valid IRQ index.", " -u dump data for in-use IRQs only.", " -d dump the intel interrupt descriptor table.", " -b dump bottom half data.", " -a dump cpu affinity for in-use IRQs.", " -s dump the kernel irq stats; if no cpu specified with -c, the", " irq stats of all cpus will be displayed.", " -c cpu only usable with the -s option, dump the irq stats of the ", " specified cpu[s]; cpu can be specified as \"1,3,5\", \"1-3\",", " \"1,3,5-7,10\", \"all\", or \"a\" (shortcut for \"all\").", "\nEXAMPLES", " Display the relevant data for IRQ 18 from a pre-2.6.37 kernel:\n", " %s> irq 18", " IRQ: 18", " STATUS: 0 ", " HANDLER: c02301e0 <ioapic_level_irq_type>", " typename: c01f9e0c \"IO-APIC-level\"", " startup: c0110234 <unmask_IO_APIC_irq>", " shutdown: c01101cc <mask_IO_APIC_irq>", " handle: c0110518 <do_level_ioapic_IRQ>", " enable: c0110234 <unmask_IO_APIC_irq>", " disable: c01101cc <mask_IO_APIC_irq>", " ACTION: c009c6b0", " handler: c01ce818 <do_aic7xxx_isr>", " flags: 4000000 (SA_SHIRQ)", " mask: 0", " name: c0217780 \"aic7xxx\"", " dev_id: c0090078", " next: c009c770", " ACTION: c009c770", " handler: c01ce818 <do_aic7xxx_isr>", " flags: 4000000 (SA_SHIRQ)", " mask: 0", " name: c0217780 \"aic7xxx\"", " dev_id: c0091078", " next: 0", " DEPTH: 0\n", " Display the relevant data for IRQ 21 from a 2.6.37 kernel:\n", " %s> irq 21", " IRQ IRQ_DESC/_DATA IRQACTION NAME", " 21 ffff88003787f780 ffff8800379a8b40 \"ehci_hcd:usb2\"", " ffff8800379cbac0 \"uhci_hcd:usb5\"", " ffff8800379cb140 \"uhci_hcd:usb7\"", " ", " Display the intel interrupt descriptor table entries:\n", " %s> irq -d", " [0] divide_error", " [1] debug", " [2] nmi", " [3] int3", " [4] overflow", " [5] bounds", " [6] invalid_op", " [7] device_not_available", " [8] double_fault", " [9] coprocessor_segment_overrun", " [10] invalid_TSS", " [11] segment_not_present", " [12] stack_segment", " [13] general_protection", " [14] page_fault", " [15] spurious_interrupt_bug", " [16] coprocessor_error", " [17] alignment_check", " [18] ignore_int", " [19] ignore_int", " [20] ignore_int", " [21] ignore_int", " ...\n", " [250] IRQ0xda_interrupt", " [251] IRQ0xdb_interrupt", " [252] IRQ0xdc_interrupt", " [253] IRQ0xdd_interrupt", " [254] IRQ0xde_interrupt", " [255] spurious_interrupt\n", " Display the bottom half data:\n", " %s> irq -b", " SOFTIRQ_VEC ACTION ", " [0] ffffffff81068f60 <tasklet_hi_action> ", " [1] ffffffff81071b80 <run_timer_softirq> ", " [2] ffffffff813e6f30 <net_tx_action> ", " [3] ffffffff813ee370 <net_rx_action> ", " [4] ffffffff81211a60 <blk_done_softirq> ", " [5] ffffffff812122f0 <blk_iopoll_softirq> ", " [6] ffffffff81069090 <tasklet_action> ", " [7] ffffffff81058830 <run_rebalance_domains> ", " [8] ffffffff81087f00 <run_hrtimer_softirq> ", " [9] ffffffff810ca7a0 <rcu_process_callbacks> \n", " Display the cpu affinity for in-use IRQs:\n", " %s> irq -a", " IRQ NAME AFFINITY", " 0 timer 0-23", " 1 i8042 0-23", " 8 rtc0 0-23", " 9 acpi 0-23", " 16 ehci_hcd:usb2,uhci_hcd:usb3,uhci_hcd:usb6 0,6,18", " 17 uhci_hcd:usb4,uhci_hcd:usb7 0-23", " 18 ehci_hcd:usb1,uhci_hcd:usb5,uhci_hcd:usb8,ioc0 0,11,23", " 24 dmar0 0", " 35 pciehp 0-23", " 36 pciehp 0-23", " 37 pciehp 0-23", " 38 pciehp 0-23", " 39 megasas 0-5,12-17", " 40 lpfc:sp 0-5,12-17", " 41 lpfc:fp 0,6-11,18-23", " 42 lpfc:sp 0,6-11,18-23", " 43 lpfc:fp 0,6-11,18-23", " ...\n", " 80 ioat-msix 0-23", " 81 ioat-msix 0-23", " 82 ioat-msix 0-23", " 83 ioat-msix 0-23", " 84 ioat-msix 0-23", " 85 ioat-msix 0-23", " 86 ioat-msix 0-23", " 87 ioat-msix 0-23", " 88 eth4 0,17\n", " Display the kernel irq stats:\n", " %s>irq -c 0,2 -s", " CPU0 CPU2 ", " 0: 2068161471 0 IR-IO-APIC-edge timer", " 1: 9 0 IR-IO-APIC-edge i8042", " 8: 1 0 IR-IO-APIC-edge rtc0", " 9: 0 0 IR-IO-APIC-fasteoi acpi", " 16: 36 0 IR-IO-APIC-fasteoi ehci_hcd:usb2", " ...\n", " 85: 3 0 IR-PCI-MSI-edge ioat-msix", " 86: 3 0 IR-PCI-MSI-edge ioat-msix", " 87: 3 0 IR-PCI-MSI-edge ioat-msix", " 88: 24 295 IR-PCI-MSI-edge eth4", NULL }; char *help_ipcs[] = { "ipcs", "System V IPC facilities", "[-smMq] [-n pid|task] [id | addr]", " This command provides information on the System V IPC facilities. With no", " arguments, the command will display kernel usage of all three factilities.", " ", " -s show semaphore arrays.", " -m show shared memory segments.", " -M show shared memory segments with additional details.", " -q show message queues.", " id show the data associated with this resource ID.", " addr show the data associated with this virtual address of a", " shmid_kernel, sem_array or msq_queue.", "", " For kernels supporting namespaces, the -n option may be used to", " display the IPC facilities with respect to the namespace of a", " specified task:\n", " -n pid a process PID.", " -n task a hexadecimal task_struct pointer.", "\nEXAMPLES", " Display all IPC facilities:\n", " %s> ipcs", " SHMID_KERNEL KEY SHMID UID PERMS BYTES NATTCH STATUS", " ffff880473a28310 00000000 0 0 666 90000 1 ", " ffff880473a28490 00000001 32769 0 666 90000 1 ", " ffff880473a28250 00000002 65538 0 666 90000 1 ", " ", " SEM_ARRAY KEY SEMID UID PERMS NSEMS ", " ffff88047200f9d0 00000000 0 0 600 1 ", " ffff88046f826910 00000000 32769 0 600 1 ", " ", " MSG_QUEUE KEY MSQID UID PERMS USED-BYTES MESSAGES", " ffff8100036bb8d0 000079d7 0 3369 666 16640 104", " ffff8100036bb3d0 000079d8 32769 3369 666 12960 81", " ffff810026d751d0 000079d9 65538 3369 666 10880 68", " ", " Display shared memory usage with detailed information:\n", " %s> ipcs -M", " SHMID_KERNEL KEY SHMID UID PERMS BYTES NATTCH STATUS", " ffff880473a28310 00000000 0 0 666 90000 1 ", " PAGES ALLOCATED/RESIDENT/SWAPPED: 22/1/0", " INODE: ffff88047239cd98", " ", " SHMID_KERNEL KEY SHMID UID PERMS BYTES NATTCH STATUS", " ffff880473a28490 00000001 32769 0 666 90000 1 ", " PAGES ALLOCATED/RESIDENT/SWAPPED: 22/1/0", " INODE: ffff88047239c118", " ", " SHMID_KERNEL KEY SHMID UID PERMS BYTES NATTCH STATUS", " ffff880473a28250 00000002 65538 0 666 90000 1 ", " PAGES ALLOCATED/RESIDENT/SWAPPED: 22/1/0", " INODE: ffff880470503758", " ", " Display the shared memory data associated with shmid_kernel ffff880473a28250:\n", " %s> ipcs -M ffff880473a28250", " SHMID_KERNEL KEY SHMID UID PERMS BYTES NATTCH STATUS", " ffff880473a28250 00000002 65538 0 666 90000 1 ", " PAGES ALLOCATED/RESIDENT/SWAPPED: 22/1/0", " INODE: ffff880470503758", NULL }; char *help_cpu[] = { "cpu", "set context to the active task on a cpu", "[cpu]", " This command sets the current context to the active task on a cpu. If no", " argument is given, the current context is displayed.\n", " cpu a valid cpu number\n", " This command is not allowable on live systems.", "\nEXAMPLES", " %s> cpu 1", " PID: 286", " COMMAND: \"in.rlogind\"", " TASK: c0b3a000 ", " CPU: 1 ", " STATE: TASK_RUNNING (ACTIVE)", NULL }; char *help_sys[] = { "sys", "system data", "[-c [name|number]] config", " This command displays system-specific data. If no arguments are entered,\n" " the same system data shown during %s invocation is shown.\n", " -c [name|number] If no name or number argument is entered, dump all", " sys_call_table entries. If a name string is entered,", " search the table for all entries containing the string.", " If a number is entered, the table entry associated with", " that number is displayed. If the current output radix", " has been set to 16, the system call numbers will be ", " displayed in hexadecimal.", " config If the kernel was configured with CONFIG_IKCONFIG, then", " dump the in-kernel configuration data.", " -panic Panic a live system. Requires write permission to", " /dev/mem. Results in the %s context causing an", " \"Attempted to kill the idle task!\" panic. (The dump", " will indicate that the %s context has a PID of 0).", "\nEXAMPLES", " Display essential system information:\n", " %s> sys", " KERNEL: vmlinux.4", " DUMPFILE: lcore.cr.4", " CPUS: 4", " DATE: Mon Oct 11 18:48:55 1999", " UPTIME: 10 days, 14:14:39", " LOAD AVERAGE: 0.74, 0.23, 0.08", " TASKS: 77", " NODENAME: test.mclinux.com", " RELEASE: 2.2.5-15smp", " VERSION: #24 SMP Mon Oct 11 17:41:40 CDT 1999", " MACHINE: i686 (500 MHz)", " MEMORY: 1 GB", "\n Dump the system configuration data (if CONFIG_IKCONFIG):\n", " %s> sys config", " #", " # Automatically generated make config: don't edit", " # Linux kernel version: 2.6.16", " # Mon Apr 10 07:58:06 2006", " #", " CONFIG_X86_64=y", " CONFIG_64BIT=y", " CONFIG_X86=y", " CONFIG_SEMAPHORE_SLEEPERS=y", " CONFIG_MMU=y", " CONFIG_RWSEM_GENERIC_SPINLOCK=y", " CONFIG_GENERIC_CALIBRATE_DELAY=y", " CONFIG_X86_CMPXCHG=y", " CONFIG_EARLY_PRINTK=y", " CONFIG_GENERIC_ISA_DMA=y", " CONFIG_GENERIC_IOMAP=y", " CONFIG_ARCH_MAY_HAVE_PC_FDC=y", " CONFIG_DMI=y", " ...", "\n Dump the system call table:\n", " %s> sys -c", " NUM SYSTEM CALL FILE AND LINE NUMBER", " 0 sys_ni_syscall ../kernel/sys.c: 48", " 1 sys_exit ../kernel/exit.c: 404", " 2 sys_fork ../arch/i386/kernel/process.c: 771", " 3 sys_read ../fs/read_write.c: 117", " 4 sys_write ../fs/read_write.c: 146", " 5 sys_open ../fs/open.c: 754", " 6 sys_close ../fs/open.c: 839", " 7 sys_waitpid ../kernel/exit.c: 503", " 8 sys_creat ../fs/open.c: 789", " 9 sys_link ../fs/namei.c: 1213", " 10 sys_unlink ../fs/namei.c: 1074", " 11 sys_execve ../arch/i386/kernel/process.c: 806", " ...", "\n Find the system call number of the select system call:\n", " %s> sys -c select", " NUM SYSTEM CALL FILE AND LINE NUMBER", " 65 sys_select ../fs/select.c: 259", " ", " If the current output radix has been set to 16, the system call numbers", " will be displayed in hexadecimal.", NULL }; char *help_log[] = { "log", "dump system message buffer", "[-tdm]", " This command dumps the kernel log_buf contents in chronological order. The", " command supports the older log_buf formats, which may or may not contain a", " timestamp inserted prior to each message, as well as the newer variable-length", " record format, where the timestamp is contained in each log entry's header.", " ", " -t Display the message text without the timestamp; only applicable to the", " variable-length record format.", " -d Display the dictionary of key/value pair properties that are optionally", " appended to a message by the kernel's dev_printk() function; only", " applicable to the variable-length record format.", " -m Display the message log level in brackets preceding each message. For", " the variable-length record format, the level will be displayed in ", " hexadecimal, and depending upon the kernel version, also contains the", " facility or flags bits.", " ", "\nEXAMPLES", " Dump the kernel message buffer:\n", " %s> log", " Linux version 2.2.5-15smp (root@mclinux1) (gcc version egcs-2.91.66 19990", " 314/Linux (egcs-1.1.2 release)) #1 SMP Thu Aug 26 11:04:37 EDT 1999", " Intel MultiProcessor Specification v1.4", " Virtual Wire compatibility mode.", " OEM ID: DELL Product ID: WS 410 APIC at: 0xFEE00000", " Processor #0 Pentium(tm) Pro APIC version 17", " Processor #1 Pentium(tm) Pro APIC version 17", " I/O APIC #2 Version 17 at 0xFEC00000.", " Processors: 2", " mapped APIC to ffffe000 (fee00000)", " mapped IOAPIC to ffffd000 (fec00000)", " Detected 447696347 Hz processor.", " Console: colour VGA+ 80x25", " Calibrating delay loop... 445.64 BogoMIPS", " ...", " 8K byte-wide RAM 5:3 Rx:Tx split, autoselect/Autonegotiate interface.", " MII transceiver found at address 24, status 782d.", " Enabling bus-master transmits and whole-frame receives.", " Installing knfsd (copyright (C) 1996 okir@xxxxxxxxxxxx).", " nfsd_init: initialized fhcache, entries=256", " ...", " ", " Do the same thing, but also show the log level preceding each message:\n", " %s> log -m", " <4>Linux version 2.2.5-15smp (root@mclinux1) (gcc version egcs-2.91.66 19990", " 314/Linux (egcs-1.1.2 release)) #1 SMP Thu Aug 26 11:04:37 EDT 1999", " <4>Intel MultiProcessor Specification v1.4", " <4> Virtual Wire compatibility mode.", " <4>OEM ID: DELL Product ID: WS 410 APIC at: 0xFEE00000", " <4>Processor #0 Pentium(tm) Pro APIC version 17", " <4>Processor #1 Pentium(tm) Pro APIC version 17", " <4>I/O APIC #2 Version 17 at 0xFEC00000.", " <4>Processors: 2", " <4>mapped APIC to ffffe000 (fee00000)", " <4>mapped IOAPIC to ffffd000 (fec00000)", " <4>Detected 447696347 Hz processor.", " <4>Console: colour VGA+ 80x25", " <4>Calibrating delay loop... 445.64 BogoMIPS", " ...", " <6> 8K byte-wide RAM 5:3 Rx:Tx split, autoselect/Autonegotiate interface.", " <6> MII transceiver found at address 24, status 782d.", " <6> Enabling bus-master transmits and whole-frame receives.", " <6>Installing knfsd (copyright (C) 1996 okir@xxxxxxxxxxxx).", " <7>nfsd_init: initialized fhcache, entries=256", " ... ", " ", " On a system with the variable-length record format, and whose log_buf has been", " filled and wrapped around, display the log with timestamp data:\n", " %s> log", " [ 0.467730] pci 0000:ff:02.0: [8086:2c10] type 00 class 0x060000", " [ 0.467749] pci 0000:ff:02.1: [8086:2c11] type 00 class 0x060000", " [ 0.467769] pci 0000:ff:02.4: [8086:2c14] type 00 class 0x060000", " [ 0.467788] pci 0000:ff:02.5: [8086:2c15] type 00 class 0x060000", " [ 0.467809] pci 0000:ff:03.0: [8086:2c18] type 00 class 0x060000", " [ 0.467828] pci 0000:ff:03.1: [8086:2c19] type 00 class 0x060000", " ...", " ", " Display the same message text as above, without the timestamp data:\n", " %s> log -t", " pci 0000:ff:02.0: [8086:2c10] type 00 class 0x060000", " pci 0000:ff:02.1: [8086:2c11] type 00 class 0x060000", " pci 0000:ff:02.4: [8086:2c14] type 00 class 0x060000", " pci 0000:ff:02.5: [8086:2c15] type 00 class 0x060000", " pci 0000:ff:03.0: [8086:2c18] type 00 class 0x060000", " pci 0000:ff:03.1: [8086:2c19] type 00 class 0x060000", " ...", " ", " Display the same message text as above, with appended dictionary data:\n", " %s> log -td", " pci 0000:ff:02.0: [8086:2c10] type 00 class 0x060000", " SUBSYSTEM=pci", " DEVICE=+pci:0000:ff:02.0", " pci 0000:ff:02.1: [8086:2c11] type 00 class 0x060000", " SUBSYSTEM=pci", " DEVICE=+pci:0000:ff:02.1", " pci 0000:ff:02.4: [8086:2c14] type 00 class 0x060000", " SUBSYSTEM=pci", " DEVICE=+pci:0000:ff:02.4", " pci 0000:ff:02.5: [8086:2c15] type 00 class 0x060000", " SUBSYSTEM=pci", " DEVICE=+pci:0000:ff:02.5", " pci 0000:ff:03.0: [8086:2c18] type 00 class 0x060000", " SUBSYSTEM=pci", " DEVICE=+pci:0000:ff:03.0", " pci 0000:ff:03.1: [8086:2c19] type 00 class 0x060000", " SUBSYSTEM=pci", " DEVICE=+pci:0000:ff:03.1", " ...", NULL }; char *help_whatis[] = { "whatis", "search symbol table for data or type information", "[struct | union | typedef | symbol] ", " This command displays the definition of structures, unions, typedefs or", " text/data symbols.\n", " struct a structure name. The output is the same as if the \"struct\"", " command was used.", " union a union name. The output is the same as if the \"union\" command", " was used.", " typedef a typedef name. If the typedef translates to a structure or union", " the output is the same as if the \"struct\" or \"union\" command", " was used. If the typedef is a primitive datatype, the one-line", " declaration is displayed.", " symbol a kernel symbol. ", "\nEXAMPLES", " Display the definition of a linux_binfmt structure:\n", " %s> whatis linux_binfmt", " struct linux_binfmt {", " struct linux_binfmt *next;", " struct module *module;", " int (*load_binary) ();", " int (*load_shlib) ();", " int (*core_dump) ();", " };", " ", " Since a kmem_bufctl_t is typedef'd to be a kmem_bufctl_s structure, the", " output of the following two commands is identical:\n", " %s> whatis kmem_bufctl_s", " struct kmem_bufctl_s {", " union {", " struct kmem_bufctl_s *buf_nextp;", " kmem_slab_t *buf_slabp;", " void *buf_objp;", " } u;", " };", " ", " %s> whatis kmem_bufctl_t", " struct kmem_bufctl_s {", " union {", " struct kmem_bufctl_s *buf_nextp;", " kmem_slab_t *buf_slabp;", " void *buf_objp;", " } u;", " };", " SIZE: 4 (0x4)", " ", " Display the type data of sys_read() and jiffies text and data symbols:\n", " %s> whatis sys_read", " ssize_t sys_read(unsigned int, char *, size_t);", " ", " %s> whatis jiffies", " long unsigned int jiffies;\n", " Display definition of a kdev_t typedef:\n", " %s> whatis kdev_t", " typedef short unsigned int kdev_t;", " SIZE: 2 (0x2)", NULL }; char *help_mount[] = { "mount", "mounted filesystem data", "[-f][-i] [-n pid|task] [mount|vfsmount|superblock|dev|dir|dentry|inode]", " This command displays basic information about the currently-mounted", " filesystems. The per-filesystem dirty inode list or list of open", " files for the filesystem may also be displayed.\n", " -f dump dentries and inodes for open files in each filesystem.", " -i dump all dirty inodes associated with each filesystem; only", " supported on kernels prior to Linux 2.6.32.\n", " For kernels supporting namespaces, the -n option may be used to", " display the mounted filesystems with respect to the namespace of a", " specified task:\n", " -n pid a process PID.", " -n task a hexadecimal task_struct pointer.\n", " Specific filesystems may be selected using the following forms:\n", " vfsmount hexadecimal address of a filesystem vfsmount structure.", " mount hexadecimal address of a filesystem mount structure (Linux 3.3", " and later).", " superblock hexadecimal address of a filesystem super_block structure.", " dev device name of a filesystem.", " dir directory where a filesystem is mounted.", " dentry hexadecimal address of an open dentry of a filesystem.", " inode hexadecimal address of an open inode of a filesystem.", " ", " The first column of the command output displays the filesystem's vfsmount", " structure address for kernels prior to Linux 3.3. For Linux 3.3 and later", " kernels, the first column displays the filesystem's mount structure address,", " which contains an embedded vfsmount structure.", "\nEXAMPLES", " Display mounted filesystem data:\n", " %s> mount", " VFSMOUNT SUPERBLK TYPE DEVNAME DIRNAME", " c0089ea0 c0088a00 ext2 /dev/root / ", " c0089cf0 c0088c00 proc /proc /proc", " c0089e10 c0088800 ext2 /dev/sda5 /boot", " c0089d80 c0088600 ext2 /dev/sda6 /usr", " c0089f30 c0088400 devpts none /dev/pts", " c3f4b010 c0088200 ext2 /dev/sda1 /home", " ", " On Linux 3.3 and later kernels, the filesystem's mount structure address", " is shown:\n", " %s> mount", " MOUNT SUPERBLK TYPE DEVNAME DIRNAME", " ffff880212fb8200 ffff880212fc0800 rootfs rootfs / ", " ffff88020ffbea00 ffff880212fc2000 proc proc proc", " ffff880211db7f00 ffff88020e01a800 sysfs sysfs /sys", " ffff88020ffe1300 ffff880212a40000 devtmpfs devtmpfs /dev", " ffff88020ff15000 ffff880212bbc800 devpts devpts /dev/pts", " ffff88020e542800 ffff88020e62b800 tmpfs tmpfs /dev/shm", " ...", " ", " Display the open files associated with each mounted filesystem:\n", " %s> mount -f", " VFSMOUNT SUPERBLK TYPE DEVNAME DIRNAME", " c7fb2b80 c7fb3200 ext2 /dev/root /", " OPEN FILES:", " DENTRY INODE TYPE PATH", " c6d02200 c6d0f7a0 REG usr/X11R6/lib/libX11.so.6.1", " c6d02100 c6d0f9e0 REG usr/X11R6/lib/libXext.so.6.3", " c6d02000 c6d0fc20 REG usr/X11R6/lib/libICE.so.6.3", " c6d02680 c6d0f320 REG usr/X11R6/bin/xfs", " c7106580 c70c5440 CHR dev/psaux", " ...", " ", " Display the dirty inodes associated with each mounted filesystem:\n", " %s> mount -i", " VFSMOUNT SUPERBLK TYPE DEVNAME DIRNAME", " c0089ea0 c0088a00 ext2 /dev/root /", " DIRTY INODES", " c7ad4008", " c2233438", " c72c4008", " c7d6b548", " c3af1a98", " c7d6b768", " c3c4e228", " ...", " ", " Display the mounted filesystem containing inode c5000aa8:\n", " %s> mount c5000aa8", " VFSMOUNT SUPERBLK TYPE DEVNAME DIRNAME", " c0089f30 c0088600 ext2 /dev/sda6 /usr ", " ", " Display the mounted filesystem containing inode ffff8801f4245e40:\n", " %s> mount ffff8801f4245e40", " MOUNT SUPERBLK TYPE DEVNAME DIRNAME", " ffff88020ffbea00 ffff880212fc2000 proc proc /proc", " ", NULL }; char *help_alias[] = { "alias", "command aliases", "[alias] [command string]", " This command creates an alias for a given command string. If no arguments", " are entered, the current list of aliases are displayed. If one argument is", " entered, the command string for that alias, if any, is displayed.\n", " alias the single word to be used as an alias", " command string the word(s) that will be substituted for the alias\n", " Aliases may be created in four manners:\n", " 1. entering the alias in $HOME/.%src.", " 2. entering the alias in .%src in the current directory.", " 3. executing an input file containing the alias command.", " 4. during runtime with this command.\n", " During initialization, $HOME/.%src is read first, followed by the", " .%src file in the current directory. Aliases in the .%src file", " in the current directory override those in $HOME/.%src. Aliases ", " entered with this command or by runtime input file override those", " defined in either .%src file. Aliases may be deleted by entering an", " empty string for the second argument. If redirection characters are to", " be part of the command string, the command string must be enclosed by", " quotation marks.\n", " Note that there are a number of helpful built-in aliases -- see the ", " first example below.", "\nEXAMPLES", " Display the currently-defined aliases, which in this example, only", " consist of the built-in aliases:\n", " %s> alias", " ORIGIN ALIAS COMMAND", " builtin man help ", " builtin ? help ", " builtin quit q", " builtin sf set scroll off", " builtin sn set scroll on", " builtin hex set radix 16", " builtin dec set radix 10", " builtin g gdb", " builtin px p -x", " builtin pd p -d", " builtin for foreach", " builtin size *", " builtin dmesg log", " builtin lsmod mod", " builtin last ps -l", " ", " Create a new alias to be added to the list:\n", " %s> alias kp kmem -p", " ORIGIN ALIAS COMMAND", " runtime kp kmem -p\n", " Create an alias with redirection characters:\n", " %s> alias ksd \"kmem -p | grep slab | grep DMA\"", " ORIGIN ALIAS COMMAND", " runtime ksd kmem -p | grep slab | grep DMA\n", " Remove an alias:\n", " %s> alias kp \"\"", " alias deleted: kp", NULL }; char *help_pointer[] = { "*", "pointer-to short-cut", "(struct or union command arguments)", " This command is a short-cut command that replaces the requirement to enter", " \"struct\" or \"union\" command names. For details on the arguments to", " those commands, enter \"help struct\" or \"help union\".", "\nEXAMPLES", " Dump the page structure at address c02943c0:", " ", " %s> *page c02943c0", " struct page {", " next = 0xc0fae740, ", " prev = 0xc0018fb0, ", " inode = 0x0, ", " offset = 0x3f000, ", " next_hash = 0xc02d6310, ", " count = {", " counter = 0x1", " }, ", " flags = 0x310, ", " wait = 0xc02943d8, ", " pprev_hash = 0x0, ", " buffers = 0x0", " }", NULL }; char *help_vtop[] = { "vtop", "virtual to physical", "[-c [pid | taskp]] [-u|-k] address ...", " This command translates a user or kernel virtual address to its physical", " address. Also displayed is the PTE translation, the vm_area_struct data", " for user virtual addresses, the mem_map page data associated with the", " physical page, and the swap location or file location if the page is", " not mapped. The -u and -k options specify that the address is a user", " or kernel virtual address; -u and -k are not necessary on processors whose", " virtual addresses self-define themselves as user or kernel. User addresses", " are translated with respect to the current context unless the -c option", " is used. Kernel virtual addresses are translated using the swapper_pg_dir", " as the base page directory unless the -c option is used.", " ", " -u The address is a user virtual address; only required", " on processors with overlapping user and kernel virtual", " address spaces.", " -k The address is a kernel virtual address; only required", " on processors with overlapping user and kernel virtual", " address spaces.", " -c [pid | taskp] Translate the virtual address from the page directory", " of the specified PID or hexadecimal task_struct pointer.", " However, if this command is invoked from \"foreach vtop\",", " the pid or taskp argument should NOT be entered; the", " address will be translated using the page directory of", " each task specified by \"foreach\".", " address A hexadecimal user or kernel virtual address.", "\nEXAMPLES", " Translate user virtual address 80b4000:\n", " %s> vtop 80b4000", " VIRTUAL PHYSICAL", " 80b4000 660f000", " ", " PAGE DIRECTORY: c37f0000", " PGD: c37f0080 => e0d067", " PMD: c37f0080 => e0d067", " PTE: c0e0d2d0 => 660f067", " PAGE: 660f000", " ", " PTE PHYSICAL FLAGS", " 660f067 660f000 (PRESENT|RW|USER|ACCESSED|DIRTY)", " ", " VMA START END FLAGS FILE", " c773daa0 80b4000 810c000 77", " ", " PAGE PHYSICAL INODE OFFSET CNT FLAGS", " c0393258 660f000 0 17000 1 uptodate", " ", " Translate kernel virtual address c806e000, first using swapper_pg_dir", " as the page directory base, and secondly, using the page table base", " of PID 1359:\n", " %s> vtop c806e000", " VIRTUAL PHYSICAL", " c806e000 2216000", " ", " PAGE DIRECTORY: c0101000", " PGD: c0101c80 => 94063", " PMD: c0101c80 => 94063", " PTE: c00941b8 => 2216063", " PAGE: 2216000", " ", " PTE PHYSICAL FLAGS", " 2216063 2216000 (PRESENT|RW|ACCESSED|DIRTY)", " ", " PAGE PHYSICAL INODE OFFSET CNT FLAGS", " c02e9370 2216000 0 0 1 ", " ", " %s> vtop -c 1359 c806e000", " VIRTUAL PHYSICAL", " c806e000 2216000", " ", " PAGE DIRECTORY: c5caf000", " PGD: c5cafc80 => 94063", " PMD: c5cafc80 => 94063", " PTE: c00941b8 => 2216063", " PAGE: 2216000", " ", " PTE PHYSICAL FLAGS", " 2216063 2216000 (PRESENT|RW|ACCESSED|DIRTY)", " ", " PAGE PHYSICAL INODE OFFSET CNT FLAGS", " c02e9370 2216000 0 0 1 ", " ", " Determine swap location of user virtual address 40104000:\n", " %s> vtop 40104000", " VIRTUAL PHYSICAL", " 40104000 (not mapped)", " ", " PAGE DIRECTORY: c40d8000", " PGD: c40d8400 => 6bbe067", " PMD: c40d8400 => 6bbe067", " PTE: c6bbe410 => 58bc00 ", " ", " PTE SWAP OFFSET", " 58bc00 /dev/sda8 22716", " ", " VMA START END FLAGS FILE", " c7200ae0 40104000 40b08000 73 ", " ", " SWAP: /dev/sda8 OFFSET: 22716", NULL }; char *help_vm[] = { "vm", "virtual memory", "[-p | -P vmaddr | -v | -m | -x | -d | [-R reference] | [-f vm_flags]]" "\n [pid | taskp] ... ", " This command displays basic virtual memory information of a context,", " consisting of a pointer to its mm_struct and page dirctory, its RSS and ", " total virtual memory size; and a list of pointers to each vm_area_struct,", " its starting and ending address, vm_flags value, and file pathname. If no", " arguments are entered, the current context is used. Additionally, the -p ", " option translates each virtual page of each VM area to its physical address.", " The -R option, typically invoked from \"foreach vm\", searches for references", " to a supplied number, address, or filename argument, and prints only the", " essential information leading up to and including the reference. ", " Alternatively, the -m or -v options may be used to dump the task's mm_struct", " or all of its vm_area_structs respectively. The -p, -v, -m, -R and -f", " options are all mutually exclusive.\n", " -p translate each virtual page to its physical address, or if", " the page is not mapped, its swap device and offset, or", " filename and offset.", " -P vmaddr similar to -p, but only translate the pages belonging to the", " specified VM area of a context.", " -R reference search for references to this number or filename.", " -m dump the mm_struct assocated with the task.", " -v dump all of the vm_area_structs associated with the task.", " -x override the default output format for the -m or -v options", " with hexadecimal format.", " -d override the default output format for the -m or -v options", " with decimal format.", " -f vm_flags translate the bits of a FLAGS (vm_flags) value.", " pid a process PID.", " taskp a hexadecimal task_struct pointer.", "\nEXAMPLES", " Display the virtual memory data of the current context:\n", " %s> vm", " PID: 30986 TASK: c0440000 CPU: 0 COMMAND: \"bash\"", " MM PGD RSS TOTAL_VM", " c303fe20 c4789000 88k 1728k", " VMA START END FLAGS FILE", " c0d1f540 8048000 80ad000 1875 /bin/bash", " c0d1f400 80ad000 80b3000 1873 /bin/bash", " c0d1f880 80b3000 80ec000 77", " c0d1f0c0 40000000 40012000 875 /lib/ld-2.1.1.so", " c0d1f700 40012000 40013000 873 /lib/ld-2.1.1.so", " c0d1fe00 40013000 40014000 77", " c0d1f580 40014000 40016000 73", " c0d1f280 4001a000 4004b000 75 /usr/lib/libncurses.so.4.2", " c0d1f100 4004b000 40054000 73 /usr/lib/libncurses.so.4.2", " c0d1f600 40054000 40057000 73", " c0d1f9c0 40057000 40059000 75 /lib/libdl-2.1.1.so", " c0d1f800 40059000 4005a000 73 /lib/libdl-2.1.1.so", " c0d1fd00 4005a000 40140000 75 /lib/libc-2.1.1.so", " c0d1fe40 40140000 40145000 73 /lib/libc-2.1.1.so", " c0d1f780 40145000 40148000 73", " c0d1f140 40148000 40150000 75 /lib/libnss_files-2.1.1.so", " c0d1fa80 40150000 40151000 73 /lib/libnss_files-2.1.1.so", " c0d1fb00 40151000 4015a000 75 /lib/libnss_nisplus-2.1.1.so", " c5f754e0 4015a000 4015b000 73 /lib/libnss_nisplus-2.1.1.so", " c0d1fec0 4015b000 4016d000 75 /lib/libnsl-2.1.1.so", " c5f75460 4016d000 4016e000 73 /lib/libnsl-2.1.1.so", " c5f75420 4016e000 40170000 73", " c5f753e0 40170000 40178000 75 /lib/libnss_nis-2.1.1.so", " c5f753a0 40178000 40179000 73 /lib/libnss_nis-2.1.1.so", " c0d1f240 bfffc000 c0000000 177\n", " Display the virtual memory data along with page translations for PID 386:", "\n %s> vm -p 386", " PID: 386 TASK: c11cc000 CPU: 0 COMMAND: \"atd\"", " MM PGD RSS TOTAL_VM", " c7e30560 c10e5000 104k 1112k", " VMA START END FLAGS FILE", " c0fbe6a0 8048000 804b000 1875 /usr/sbin/atd", " VIRTUAL PHYSICAL", " 8048000 20e1000", " 8049000 17c6000", " 804a000 1f6f000", " VMA START END FLAGS FILE", " c61e0ba0 804b000 804d000 1873 /usr/sbin/atd", " VIRTUAL PHYSICAL", " 804b000 254d000", " 804c000 6a9c000", " VMA START END FLAGS FILE", " c61e04e0 804d000 8050000 77 ", " VIRTUAL PHYSICAL", " 804d000 219d000", " 804e000 2617000", " 804f000 SWAP: /dev/sda8 OFFSET: 24225", " VMA START END FLAGS FILE", " c61e0720 40000000 40012000 875 /lib/ld-2.1.1.so", " VIRTUAL PHYSICAL", " 40000000 FILE: /lib/ld-2.1.1.so OFFSET: 0", " 40001000 FILE: /lib/ld-2.1.1.so OFFSET: 1000", " 40002000 FILE: /lib/ld-2.1.1.so OFFSET: 2000", " 40003000 FILE: /lib/ld-2.1.1.so OFFSET: 3000", " 40004000 FILE: /lib/ld-2.1.1.so OFFSET: 4000", " 40005000 FILE: /lib/ld-2.1.1.so OFFSET: 5000", " ...", " ", " Although the -R option is typically invoked from \"foreach vm\", it can be", " executed directly. This example displays all VM areas with vm_flags of 75:\n", " %s> vm -R 75", " PID: 694 TASK: c0c76000 CPU: 1 COMMAND: \"crash\"", " MM PGD RSS TOTAL_VM", " c6c43110 c0fe9000 8932k 10720k ", " VMA START END FLAGS FILE", " c322c0d0 40019000 4004a000 75 /usr/lib/libncurses.so.4.2", " c67537c0 40056000 40071000 75 /lib/libm-2.1.1.so", " c6753d00 40072000 40074000 75 /lib/libdl-2.1.1.so", " c6753540 40075000 40081000 75 /usr/lib/libz.so.1.1.3", " c6753740 40085000 4016b000 75 /lib/libc-2.1.1.so", " ", " One reason to use -R directly is to pare down the output associated with", " the -p option on a task with a huge address space. This example displays", " the page data associated with virtual address 40121000:\n", " %s> vm -R 40121000", " PID: 694 TASK: c0c76000 CPU: 0 COMMAND: \"crash\"", " MM PGD RSS TOTAL_VM", " c6c43110 c0fe9000 8928k 10720k ", " VMA START END FLAGS FILE", " c6753740 40085000 4016b000 75 /lib/libc-2.1.1.so", " VIRTUAL PHYSICAL", " 40121000 FILE: /lib/libc-2.1.1.so OFFSET: 9c000", " ", " Display the mm_struct for PID 4777:", "\n %s> vm -m 4777", " PID: 4777 TASK: c0896000 CPU: 0 COMMAND: \"bash\"", " struct mm_struct {", " mmap = 0xc6caa1c0, ", " mmap_avl = 0x0, ", " mmap_cache = 0xc6caabc0, ", " pgd = 0xc100a000, ", " count = {", " counter = 0x1", " }, ", " map_count = 0x14, ", " mmap_sem = {", " count = {", " counter = 0x1", " }, ", " waking = 0x0, ", " wait = 0x0", " }, ", " context = 0x0, ", " start_code = 0x8048000, ", " end_code = 0x809c6f7, ", " start_data = 0x0, ", " end_data = 0x80a2090, ", " start_brk = 0x80a5420, ", " brk = 0x80b9000, ", " start_stack = 0xbffff9d0, ", " arg_start = 0xbffffad1, ", " arg_end = 0xbffffad7, ", " env_start = 0xbffffad7, ", " env_end = 0xbffffff2, ", " rss = 0xf6, ", " total_vm = 0x1a3, ", " locked_vm = 0x0, ", " def_flags = 0x0, ", " cpu_vm_mask = 0x0, ", " swap_cnt = 0x23d,", " swap_address = 0x0, ", " segments = 0x0", " }", " ", " Display all of the vm_area_structs for task c47d4000:", "\n %s> vm -v c47d4000", " PID: 4971 TASK: c47d4000 CPU: 1 COMMAND: \"login\"", " struct vm_area_struct {", " vm_mm = 0xc4b0d200, ", " vm_start = 0x8048000, ", " vm_end = 0x804d000, ", " vm_next = 0xc3e3abd0, ", " vm_page_prot = {", " pgprot = 0x25", " }, ", " vm_flags = 0x1875, ", " vm_avl_height = 0x1, ", " vm_avl_left = 0x0, ", " vm_avl_right = 0x0, ", " vm_next_share = 0x0, ", " vm_pprev_share = 0xc3e3abf0, ", " vm_ops = 0xc02392a0, ", " vm_offset = 0x0, ", " vm_file = 0xc1e23660, ", " vm_pte = 0x0", " }", " struct vm_area_struct {", " vm_mm = 0xc4b0d200, ", " vm_start = 0x804d000, ", " vm_end = 0x804e000, ", " vm_next = 0xc3e3a010, ", " vm_page_prot = {", " pgprot = 0x25", " }, ", " vm_flags = 0x1873, ", " vm_avl_height = 0x2, ", " vm_avl_left = 0xc3e3a810, ", " vm_avl_right = 0xc3e3a010, ", " vm_next_share = 0xc3e3a810, ", " vm_pprev_share = 0xc3699c14", " ...", " ", " Translate a FLAGS value:\n", " %s> vm -f 3875", " 3875: (READ|EXEC|MAYREAD|MAYWRITE|MAYEXEC|DENYWRITE|EXECUTABLE|LOCKED)", " ", " Display the page translations of the VM area at address f5604f2c:\n", " %s> vm -P f5604f2c", " PID: 5508 TASK: f56a9570 CPU: 0 COMMAND: \"crond\"", " VMA START END FLAGS FILE", " f5604f2c f5b000 f67000 8000075 /lib/libnss_files-2.12.so", " VIRTUAL PHYSICAL", " f5b000 3fec1000", " f5c000 3d3a4000", " f5d000 FILE: /lib/libnss_files-2.12.so OFFSET: 2000", " f5e000 FILE: /lib/libnss_files-2.12.so OFFSET: 3000", " f5f000 FILE: /lib/libnss_files-2.12.so OFFSET: 4000", " f60000 3fd31000", " f61000 3fd32000", " f62000 FILE: /lib/libnss_files-2.12.so OFFSET: 7000", " f63000 FILE: /lib/libnss_files-2.12.so OFFSET: 8000", " f64000 3ff35000", " f65000 FILE: /lib/libnss_files-2.12.so OFFSET: a000", " f66000 FILE: /lib/libnss_files-2.12.so OFFSET: b000", NULL }; char *help_task[] = { "task", "task_struct and thread_info contents", "[-R member[,member]] [-dx] [pid | taskp] ...", " This command dumps a formatted display of the contents of a task's", " task_struct and thread_info structures. Multiple task or PID numbers", " may be entered; if no arguments are entered, the task_struct and", " thread_info structures of the current context are displayed. The -R option,", " which may also be invoked indirectly via \"foreach task\", pares the output", " down to one or more structure members.", " ", " pid a process PID.", " taskp a hexadecimal task_struct pointer.", " -R member a comma-separated list of one or more task_struct and/or", " thread_info structure members.", " -x override default output format with hexadecimal format.", " -d override default output format with decimal format.", "\nEXAMPLES", " Dump the task_struct and thread_info structures of the current context", " in hexadecimal format:\n", " %s> task -x", " PID: 3176 TASK: f2451550 CPU: 1 COMMAND: \"memtest\"", " struct task_struct {", " state = 0x0, ", " stack = 0xf05b6000, ", " usage = {", " counter = 0x2", " }, ", " flags = 0x402040, ", " ptrace = 0x0, ", " lock_depth = 0xffffffff, ", " prio = 0x78, ", " static_prio = 0x78, ", " normal_prio = 0x78, ", " rt_priority = 0x0, ", " ...", " perf_event_ctxp = {0x0, 0x0}, ", " memcg_batch = {", " do_batch = 0x0, ", " memcg = 0x0, ", " bytes = 0x0, ", " memsw_bytes = 0x0", " }", " }", " ", " struct thread_info {", " task = 0xf2451550, ", " exec_domain = 0xc0a60860, ", " flags = 0x88, ", " status = 0x0, ", " cpu = 0x1, ", " preempt_count = 0x4010000, ", " addr_limit = {", " seg = 0xc0000000", " }, ", " restart_block = {", " ...", " ", " Display the ngroups and groups task_struct members for PID 2958:\n", " %s> task -R ngroups,groups 2958", " PID: 2958 TASK: c6718000 CPU: 0 COMMAND: \"bash\"", " ngroups = 6, ", " groups = {504, 8, 9, 1000, 1007, 1006, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,", " 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},", " ", " NOTE: When this command is invoked directly (i.e., not from \"foreach\"), it", " is not necessary to include the \"-R\" before the task_struct/thread_info", " member name(s).", NULL }; char *help_sig[] = { "sig", "task signal handling", "[[-l] | [-s sigset]] | [-g] [pid | taskp] ...", " This command displays signal-handling data of one or more tasks. Multiple", " task or PID numbers may be entered; if no arguments are entered, the signal", " handling data of the current context will be displayed. The default display", " shows:", " ", " 1. A formatted dump of the \"sig\" signal_struct structure referenced by", " the task_struct. For each defined signal, it shows the sigaction", " structure address, the signal handler, the signal sigset_t mask ", " (also expressed as a 64-bit hexadecimal value), and the flags.", " 2. Whether the task has an unblocked signal pending.", " 3. The contents of the \"blocked\" and \"signal\" sigset_t structures", " from the task_struct/signal_struct, both of which are represented ", " as a 64-bit hexadecimal value.", " 4. For each queued signal, private and/or shared, if any, its signal", " number and associated siginfo structure address.", " ", " The -l option lists the signal numbers and their name(s). The -s option", " translates a 64-bit hexadecimal value representing the contents of a", " sigset_t structure into the signal names whose bits are set.", " ", " pid a process PID.", " taskp a hexadecimal task_struct pointer.", " -g displays signal information for all threads in a task's ", " thread group.", " -l displays the defined signal numbers and names.", " -s sigset translates a 64-bit hexadecimal value representing a sigset_t", " into a list of signal names associated with the bits set.", "\nEXAMPLES", " Dump the signal-handling data of PID 8970:\n", " %s> sig 8970", " PID: 8970 TASK: f67d8560 CPU: 1 COMMAND: \"procsig\"", " SIGNAL_STRUCT: f6018680 COUNT: 1", " SIG SIGACTION HANDLER MASK FLAGS ", " [1] f7877684 SIG_DFL 0000000000000000 0 ", " [2] f7877698 SIG_DFL 0000000000000000 0 ", " ...", " [8] f7877710 SIG_DFL 0000000000000000 0 ", " [9] f7877724 SIG_DFL 0000000000000000 0 ", " [10] f7877738 804867a 0000000000000000 80000000 (SA_RESETHAND)", " [11] f787774c SIG_DFL 0000000000000000 0 ", " [12] f7877760 804867f 0000000000000000 10000004 (SA_SIGINFO|SA_RESTART)", " [13] f7877774 SIG_DFL 0000000000000000 0 ", " ...", " [31] f78778dc SIG_DFL 0000000000000000 0 ", " [32] f78778f0 SIG_DFL 0000000000000000 0 ", " [33] f7877904 SIG_DFL 0000000000000000 0 ", " [34] f7877918 804867f 0000000000000000 10000004 (SA_SIGINFO|SA_RESTART)", " [35] f787792c SIG_DFL 0000000000000000 0 ", " [36] f7877940 SIG_DFL 0000000000000000 0 ", " ...", " [58] f7877af8 SIG_DFL 0000000000000000 0 ", " [59] f7877b0c SIG_DFL 0000000000000000 0 ", " [60] f7877b20 SIG_DFL 0000000000000000 0 ", " [61] f7877b34 SIG_DFL 0000000000000000 0 ", " [62] f7877b48 SIG_DFL 0000000000000000 0 ", " [63] f7877b5c SIG_DFL 0000000000000000 0 ", " [64] f7877b70 804867f 0000000000000000 10000004 (SA_SIGINFO|SA_RESTART)", " SIGPENDING: no", " BLOCKED: 8000000200000800", " PRIVATE_PENDING", " SIGNAL: 0000000200000800", " SIGQUEUE: SIG SIGINFO ", " 12 f51b9c84", " 34 f51b9594", " SHARED_PENDING", " SIGNAL: 8000000000000800", " SIGQUEUE: SIG SIGINFO ", " 12 f51b9188", " 64 f51b9d18", " 64 f51b9500", " ", " Dump the signal-handling data for all tasks in the thread group containing", " PID 2578:\n", " %s> sig -g 2578", " PID: 2387 TASK: f617d020 CPU: 0 COMMAND: \"slapd\"", " SIGNAL_STRUCT: f7dede00 COUNT: 6", " SIG SIGACTION HANDLER MASK FLAGS", " [1] c1f60c04 a258a7 0000000000000000 10000000 (SA_RESTART)", " [2] c1f60c18 a258a7 0000000000000000 10000000 (SA_RESTART)", " [3] c1f60c2c SIG_DFL 0000000000000000 0", " [4] c1f60c40 SIG_DFL 0000000000000000 0", " [5] c1f60c54 a258a7 0000000000000000 10000000 (SA_RESTART)", " [6] c1f60c68 SIG_DFL 0000000000000000 0", " [7] c1f60c7c SIG_DFL 0000000000000000 0", " [8] c1f60c90 SIG_DFL 0000000000000000 0", " [9] c1f60ca4 SIG_DFL 0000000000000000 0", " [10] c1f60cb8 a25911 0000000000000000 10000000 (SA_RESTART)", " ...", " [64] c1f610f0 SIG_DFL 0000000000000000 0", " SHARED_PENDING", " SIGNAL: 0000000000000000", " SIGQUEUE: (empty)", " ", " PID: 2387 TASK: f617d020 CPU: 0 COMMAND: \"slapd\"", " SIGPENDING: no", " BLOCKED: 0000000000000000", " PRIVATE_PENDING", " SIGNAL: 0000000000000000", " SIGQUEUE: (empty)", " ", " PID: 2392 TASK: f6175aa0 CPU: 0 COMMAND: \"slapd\"", " SIGPENDING: no", " BLOCKED: 0000000000000000", " PRIVATE_PENDING", " SIGNAL: 0000000000000000", " SIGQUEUE: (empty)", " ", " PID: 2523 TASK: f7cd4aa0 CPU: 1 COMMAND: \"slapd\"", " SIGPENDING: no", " BLOCKED: 0000000000000000", " PRIVATE_PENDING", " SIGNAL: 0000000000000000", " SIGQUEUE: (empty)", " ", " ...", " ", " Translate the sigset_t mask value, cut-and-pasted from the signal handling", " data from signals 1 and 10 above:", " ", " %s> sig -s 800A000000000201", " SIGHUP SIGUSR1 SIGRTMAX-14 SIGRTMAX-12 SIGRTMAX", " ", " List the signal numbers and their names:", " ", " %s> sig -l", " [1] SIGHUP", " [2] SIGINT", " [3] SIGQUIT", " [4] SIGILL", " [5] SIGTRAP", " [6] SIGABRT/SIGIOT", " [7] SIGBUS", " [8] SIGFPE", " [9] SIGKILL", " [10] SIGUSR1", " [11] SIGSEGV", " [12] SIGUSR2", " [13] SIGPIPE", " [14] SIGALRM", " [15] SIGTERM", " [16] SIGSTKFLT", " [17] SIGCHLD/SIGCLD", " [18] SIGCONT", " [19] SIGSTOP", " [20] SIGTSTP", " [21] SIGTTIN", " [22] SIGTTOU", " [23] SIGURG", " [24] SIGXCPU", " [25] SIGXFSZ", " [26] SIGVTALRM", " [27] SIGPROF", " [28] SIGWINCH", " [29] SIGIO/SIGPOLL", " [30] SIGPWR", " [31] SIGSYS", " [32] SIGRTMIN", " [33] SIGRTMIN+1", " [34] SIGRTMIN+2", " [35] SIGRTMIN+3", " [36] SIGRTMIN+4", " [37] SIGRTMIN+5", " [38] SIGRTMIN+6", " [39] SIGRTMIN+7", " [40] SIGRTMIN+8", " [41] SIGRTMIN+9", " [42] SIGRTMIN+10", " [43] SIGRTMIN+11", " [44] SIGRTMIN+12", " [45] SIGRTMIN+13", " [46] SIGRTMIN+14", " [47] SIGRTMIN+15", " [48] SIGRTMIN+16", " [49] SIGRTMAX-15", " [50] SIGRTMAX-14", " [51] SIGRTMAX-13", " [52] SIGRTMAX-12", " [53] SIGRTMAX-11", " [54] SIGRTMAX-10", " [55] SIGRTMAX-9", " [56] SIGRTMAX-8", " [57] SIGRTMAX-7", " [58] SIGRTMAX-6", " [59] SIGRTMAX-5", " [60] SIGRTMAX-4", " [61] SIGRTMAX-3", " [62] SIGRTMAX-2", " [63] SIGRTMAX-1", " [64] SIGRTMAX", NULL }; char *help_struct[] = { "struct", "structure contents", "struct_name[.member[,member]][-o][-l offset][-rfuxdp]\n" " [address | symbol][:cpuspec] [count | -c count]", " This command displays either a structure definition, or a formatted display", " of the contents of a structure at a specified address. When no address is", " specified, the structure definition is shown along with the structure size.", " A structure member may be appended to the structure name in order to limit", " the scope of the data displayed to that particular member; when no address", " is specified, the member's offset and definition are shown.\n", " struct_name name of a C-code structure used by the kernel.", " .member name of a structure member; to display multiple members of a", " structure, use a comma-separated list of members.", " -o show member offsets when displaying structure definitions; ", " if used with an address or symbol argument, each member will", " be preceded by its virtual address.", " -l offset if the address argument is a pointer to a structure member that", " is contained by the target data structure, typically a pointer", " to an embedded list_head, the offset to the embedded member may", " be entered in either of the following manners:", " 1. in \"structure.member\" format.", " 2. a number of bytes. ", " -r raw dump of structure data.", " -f address argument is a dumpfile offset.", " -u address argument is a user virtual address in the current", " context.", " -x override default output format with hexadecimal format.", " -d override default output format with decimal format.", " -p if a structure member is a pointer value, show the member's", " data type on the output line; and on the subsequent line(s),", " dereference the pointer, display the pointer target's symbol", " value in brackets if appropriate, and if possible, display the", " target data; requires an address argument.", " address hexadecimal address of a structure; if the address points", " to an embedded list_head structure contained within the", " target data structure, then the \"-l\" option must be used.", " symbol symbolic reference to the address of a structure.", " :cpuspec CPU specification for a per-cpu address or symbol:", " : CPU of the currently selected task.", " :a[ll] all CPUs.", " :#[-#][,...] CPU list(s), e.g. \"1,3,5\", \"1-3\",", " or \"1,3,5-7,10\".", " count count of structures to dump from an array of structures;", " if used, this must be the last argument entered.", " -c count \"-c\" is only required if \"count\" is not the last argument", " entered or if a negative number is entered; if a negative", " value is entered, the (positive) \"count\" structures that", " lead up to and include the target structure will be displayed.\n", " Structure data, sizes, and member offsets are shown in the current output", " radix unless the -x or -d option is specified.", " ", " Please note that in the vast majority of cases, the \"struct\" command", " name may be dropped; if the structure name does not conflict with any %s", " or gdb command name, then the \"struct_name[.member]\" argument will be", " recognized as a structure name, and this command automatically executed.", " See the NOTE below.", "\nEXAMPLES", " Display the vm_area_struct at address c1e44f10:\n", " %s> struct vm_area_struct c1e44f10", " struct vm_area_struct {", " vm_mm = 0xc2857750,", " vm_start = 0x8048000, ", " vm_end = 0x80a5000, ", " vm_next = 0xc1e44a10,", " vm_page_prot = {", " pgprot = 0x25 ", " },", " vm_flags = 0x1875,", " vm_avl_height = 0x2, ", " vm_avl_left = 0xc30fe200,", " vm_avl_right = 0xc30fed00,", " vm_next_share = 0x0, ", " vm_pprev_share = 0xc1e44a30,", " vm_ops = 0xc0215ca0,", " vm_offset = 0x0, ", " vm_file = 0xc0bfdc70,", " vm_pte = 0 ", " }\n", " Display the definition and size of a vm_area_struct structure. This first", " example below displays just the structure and size. The second example", " uses the -o option to also display member offsets. Both examples were", " run with the output radix set to 10 (decimal):\n", " %s> struct vm_area_struct", " struct vm_area_struct {", " struct mm_struct *vm_mm;", " long unsigned int vm_start;", " long unsigned int vm_end;", " struct vm_area_struct *vm_next;", " pgprot_t vm_page_prot;", " short unsigned int vm_flags;", " short int vm_avl_height;", " struct vm_area_struct *vm_avl_left;", " struct vm_area_struct *vm_avl_right;", " struct vm_area_struct *vm_next_share;", " struct vm_area_struct **vm_pprev_share;", " struct vm_operations_struct *vm_ops;", " long unsigned int vm_offset;", " struct file *vm_file;", " long unsigned int vm_pte;", " }", " SIZE: 56\n", " %s> struct vm_area_struct -o", " struct vm_area_struct {", " [0] struct mm_struct *vm_mm;", " [4] long unsigned int vm_start;", " [8] long unsigned int vm_end;", " [12] struct vm_area_struct *vm_next;", " [16] pgprot_t vm_page_prot;", " [20] short unsigned int vm_flags;", " [22] short int vm_avl_height;", " [24] struct vm_area_struct *vm_avl_left;", " [28] struct vm_area_struct *vm_avl_right;", " [32] struct vm_area_struct *vm_next_share;", " [36] struct vm_area_struct **vm_pprev_share;", " [40] struct vm_operations_struct *vm_ops;", " [44] long unsigned int vm_offset;", " [48] struct file *vm_file;", " [52] long unsigned int vm_pte;", " }", " SIZE: 56\n", " Display the definition and offset of the pgd member of an mm_struct:\n", " %s> struct mm_struct.pgd", " struct mm_struct {", " [80] pgd_t *pgd;", " }\n", " Display the pgd member of the mm_struct at address ffff810022e7d080:\n", " %s> struct mm_struct.pgd ffff810022e7d080", " pgd = 0xffff81000e3ac000\n", " Display the pgd_t pointed to by the mm_struct.pgd pointer above, forcing", " the output to be expressed in hexadecimal:\n", " %s> mm_struct.pgd ffff810022e7d080 -px", " pgd_t *pgd = 0xffff81000e3ac000", " -> {", " pgd = 0x2c0a6067", " }\n", " Display the thread_info structure pointed to by the thread_info", " member of the task_struct at ffff8100181190c0:\n", " %s> task_struct.thread_info ffff8100181190c0 -p", " struct thread_info *thread_info = 0xffff810023c06000", " -> {", " task = 0xffff8100181190c0,", " exec_domain = 0xffffffff802f78e0,", " flags = 128,", " status = 1,", " cpu = 3,", " preempt_count = 0,", " addr_limit = {", " seg = 18446604435732824064", " },", " restart_block = {", " fn = 0xffffffff80095a52 <do_no_restart_syscall>,", " arg0 = 0,", " arg1 = 0,", " arg2 = 0,", " arg3 = 0", " }", " }\n", " Display the flags and virtual members of 4 contigous page structures", " in the mem_map page structure array:\n", " %s> page.flags,virtual c101196c 4", " flags = 0x8000,", " virtual = 0xc04b0000", " ", " flags = 0x8000,", " virtual = 0xc04b1000", " ", " flags = 0x8000,", " virtual = 0xc04b2000", " ", " flags = 0x8000,", " virtual = 0xc04b3000", " ", " Display the array of tcp_sl_timer structures declared by tcp_slt_array[]:\n", " %s> struct tcp_sl_timer tcp_slt_array 4", " struct tcp_sl_timer {", " count = {", " counter = 0x0 ", " },", " period = 0x32, ", " last = 0x1419e4, ", " handler = 0xc0164854 <tcp_syn_recv_timer>", " }", " struct tcp_sl_timer {", " count = {", " counter = 0x2 ", " },", " period = 0x753, ", " last = 0x14a6df, ", " handler = 0xc01645b0 <tcp_keepalive>", " }", " struct tcp_sl_timer {", " count = {", " counter = 0x0 ", " },", " period = 0x2ee, ", " last = 0x143134, ", " handler = 0xc016447c <tcp_twkill>", " }", " struct tcp_sl_timer {", " count = {", " counter = 0x0 ", " },", " period = 0x64, ", " last = 0x143198, ", " handler = 0xc0164404 <tcp_bucketgc>", " }", " ", " Without using the \"struct\" command name, display the the \"d_child\" ", " list_head member from a dentry structure:\n", " %s> dentry.d_child 0xe813cb4", " d_child = {", " next = 0x3661344,", " prev = 0xdea4bc4", " },", " ", " Display the child dentry structure referenced by the \"next\" pointer above.", " Since the \"next\" address of 0x3661344 above is a pointer to an embedded", " list_head structure within the child dentry structure, the -l option", " is required:\n", " %s> dentry -l dentry.d_child 0x3661344", " struct dentry {", " d_count = {", " counter = 1", " }, ", " d_flags = 0, ", " d_inode = 0xf9aa604, ", " d_parent = 0x11152b1c, ", " d_hash = {", " next = 0x11fb3fc0, ", " prev = 0x11fb3fc0", " }, ", " d_lru = {", " next = 0x366133c, ", " prev = 0x366133c", " }, ", " d_child = {", " next = 0x36613cc, ", " prev = 0xe813cd4", " }, ", " d_subdirs = {", " next = 0x366134c, ", " prev = 0x366134c", " }, ", " d_alias = {", " next = 0xf9aa614, ", " prev = 0xf9aa614", " }, ", " d_mounted = 0, ", " d_name = {", " name = 0x3661384 \"boot.log\", ", " len = 8, ", " hash = 1935169207", " }, ", " d_time = 1515870810, ", " d_op = 0x0, ", " d_sb = 0x11fc9c00, ", " d_vfs_flags = 0, ", " d_fsdata = 0x0, ", " d_extra_attributes = 0x0, ", " d_iname = \"boot.log\\000\"", " }", " ", " Display the virtual address of each member of the task_struct at", " ffff8100145d2080:\n", " %s> task_struct -o ffff8100145d2080", " struct task_struct {", " [ffff8100145d2080] volatile long int state;", " [ffff8100145d2088] struct thread_info *thread_info;", " [ffff8100145d2090] atomic_t usage;", " [ffff8100145d2098] long unsigned int flags;", " [ffff8100145d20a0] int lock_depth;", " [ffff8100145d20a4] int load_weight;", " [ffff8100145d20a8] int prio;", " [ffff8100145d20ac] int static_prio;", " [ffff8100145d20b0] int normal_prio;", " [ffff8100145d20b8] struct list_head run_list;", " [ffff8100145d20c8] struct prio_array *array;", " ...", " ", " For an example of displaying per-cpu variables, consider the", " struct hd_struct.dkstats member, which is a percpu pointer to", " a disk_stats structure:", "", " %s> struct hd_struct.dkstats ", " struct hd_struct {", " [1232] struct disk_stats *dkstats;", " }", "", " Taking an hd_struct at address ffff8802450e2848, display all", " of the per-cpu disk_stats structures that it references:", " ", " %s> struct hd_struct.dkstats ffff8802450e2848", " dkstats = 0x60fdb48026c8", " %s> struct disk_stats 0x60fdb48026c8:a", " [0]: ffffe8fefe6026c8", " struct disk_stats {", " sectors = {451376, 80468}, ", " ios = {6041, 971}, ", " merges = {386, 390}, ", " ticks = {194877, 56131}, ", " io_ticks = 12371, ", " time_in_queue = 309163", " }", " [1]: ffffe8fefe8026c8", " struct disk_stats {", " sectors = {0, 0}, ", " ios = {0, 0}, ", " merges = {7, 242}, ", " ticks = {0, 0}, ", " io_ticks = 23, ", " time_in_queue = 581", " }", " [2]: ffffe8fefea026c8", " struct disk_stats {", " sectors = {0, 0}, ", " ios = {0, 0}, ", " merges = {4, 112}, ", " ticks = {0, 0}, ", " io_ticks = 11, ", " time_in_queue = 305", " }", " [3]: ffffe8fefec026c8", " struct disk_stats {", " sectors = {0, 0}, ", " ios = {0, 0}, ", " merges = {5, 54}, ", " ticks = {0, 0}, ", " io_ticks = 17, ", " time_in_queue = 41", " }", " ", "\nNOTE", " If the structure name does not conflict with any %s command name, the", " \"struct\" command may be dropped. Accordingly, the examples above could", " also have been accomplished like so:\n", " %s> vm_area_struct c1e44f10", " %s> vm_area_struct", " %s> vm_area_struct -o", " %s> mm_struct.pgd ffff810022e7d080", " %s> mm_struct.pgd", " %s> tcp_sl_timer tcp_slt_array 4\n", " Lastly, the short-cut \"*\" pointer-to command may also be used to negate", " the need to enter the \"struct\" command name (enter \"help *\" for details).", NULL }; char *help_union[] = { "union", "union contents", "union_name[.member[,member]] [-o][-l offset][-rfuxdp]\n" " [address | symbol][:cpuspec] [count | -c count]", " This command displays either a union definition, or a formatted display", " of the contents of a union at a specified address. When no address is", " specified, the union definition is shown along with the union size.", " A union member may be appended to the structure name in order to limit", " the scope of the data displayed to that particular member; when no address", " is specified, the member's offset (always 0) and definition are shown.\n", " union_name name of a C-code union used by the kernel.", " .member name of a union member; to display multiple members of a", " union, use a comma-separated list of members.", " -o show member offsets when displaying union definitions; the", " offset is always 0 unless used with an address or symbol", " argument, in which case each member will be preceded by its", " virtual address.", " -l offset if the address argument is a pointer to a list_head structure", " that is embedded in the target union structure, the offset", " to the list_head member may be entered in either of the", " following manners:", " 1. in \"structure.member\" format.", " 2. a number of bytes. ", " -r raw dump of union data.", " -f address argument is a dumpfile offset.", " -x override default output format with hexadecimal format.", " -d override default output format with decimal format.", " -p if a union member is a pointer value, show the member's", " data type on the output line; and on the subsequent line(s),", " dereference the pointer, display the pointer target's symbol", " value in brackets if appropriate, and if possible, display the", " target data; requires an address argument.", " -u address argument is a user virtual address in the current", " context.", " address hexadecimal address of a union; if the address points", " to an embedded list_head structure contained within the", " target union structure, then the \"-l\" option must be used.", " symbol symbolic reference to the address of a union.", " :cpuspec CPU specification for a per-cpu address or symbol:", " : CPU of the currently selected task.", " :a[ll] all CPUs.", " :#[-#][,...] CPU list(s), e.g. \"1,3,5\", \"1-3\",", " or \"1,3,5-7,10\".", " count count of unions to dump from an array of unions; if used,", " this must be the last argument entered.", " -c count \"-c\" is only required if \"count\" is not the last argument", " entered or if a negative number is entered; if a negative", " value is entered, the (positive) \"count\" structures that", " lead up to and include the target structure will be displayed.\n", " Union data, sizes, and member offsets are shown in the current output radix", " unless the -x or -d option is specified.", " ", " Please note that in the vast majority of cases, the \"union\" command", " name may be dropped; if the union name does not conflict with any %s", " or gdb command name, then the \"union_name[.member]\" argument will be", " recognized as a union name, and this command automatically executed.", " See the NOTE below.", "\nEXAMPLES", "\n Display the bdflush_param union definition, and then an instance of it:\n", " %s> union bdflush_param", " union bdflush_param {", " struct {", " int nfract;", " int ndirty;", " int nrefill;", " int nref_dirt;", " int dummy1;", " int age_buffer;", " int age_super;", " int dummy2;", " int dummy3;", " } b_un;", " unsigned int data[9];", " }", " ", " SIZE: 36 (0x24)", " ", " %s> union bdflush_param bdf_prm", " union bdflush_param {", " b_un = {", " nfract = 40, ", " ndirty = 500, ", " nrefill = 64, ", " nref_dirt = 256, ", " dummy1 = 15, ", " age_buffer = 3000, ", " age_super = 500, ", " dummy2 = 1884, ", " dummy3 = 2", " }, ", " data = {40, 500, 64, 256, 15, 3000, 500, 1884, 2}", " }", "\nNOTE", " If the union name does not conflict with any %s command name, the", " \"union\" command may be dropped. Accordingly, the examples above could", " also have been accomplished like so:\n", " %s> bdflush_param", " %s> bdflush_param bdf_prm", " ", " Lastly, the short-cut \"*\" (pointer-to) command may also be used to negate", " the need to enter the \"union\" command name (enter \"help *\" for details).", NULL }; char *help_ptov[] = { "ptov", "physical to virtual", "address ...", " This command translates a hexadecimal physical address into a kernel ", " virtual address.", "\nEXAMPLES", " Translate physical address 56e000 into a kernel virtual address:\n", " %s> ptov 56e000", " VIRTUAL PHYSICAL", " c056e000 56e000", NULL }; char *help_mod[] = { "mod", "module information and loading of symbols and debugging data", "-s module [objfile] | -d module | -S [directory] [-D|-t|-r|-R|-o|-g]", " With no arguments, this command displays basic information of the currently", " installed modules, consisting of the module address, name, size, the", " object file name (if known), and whether the module was compiled with", " CONFIG_KALLSYMS.", " ", " The arguments are concerned with with the loading or deleting of symbolic", " and debugging data from a module's object file. A modules's object file", " always contains symbolic data (symbol names and addresses), but contains", " debugging data only if the module was compiled with the -g CFLAG. In", " addition, the module may have compiled with CONFIG_KALLSYMS, which means", " that the module's symbolic data will have been loaded into the kernel's", " address space when it was installed. If the module was not compiled with", " CONFIG_KALLSYMS, then only the module's exported symbols will be loaded", " into the kernel's address space. Therefore, for the purpose of this", " command, it should noted that a kernel module may have been compiled in", " one of following manners:\n", " 1. If the module was built without CONFIG_KALLSYMS and without the -g CFLAG,", " then the loading of the module's additional non-exported symbols can", " be accomplished with this command.", " 2. If the module was built with CONFIG_KALLSYMS, but without the -g CFLAG,", " then there is no benefit in loading the symbols from the module object", " file, because all of the module's symbols will have been loaded into the", " kernel's address space when it was installed.", " 3. If the module was built with CONFIG_KALLSYMS and with the the -g CFLAG,", " then the loading of the module's debugging data can be accomplished", " with this command.", " 4. If the module was built without CONFIG_KALLSYMS but with the -g CFLAG,", " then the loading of the both module's symbolic and debugging data can", " be accomplished with this command.", " ", " -s module [objfile] Loads symbolic and debugging data from the object file", " for the module specified. If no objfile argument is", " appended, a search will be made for an object file", " consisting of the module name with a .o or .ko suffix,", " starting at the /lib/modules/<release> directory on", " the host system, or if not found there, starting at the", " directory containing the kernel namelist file. If an", " objfile argument is appended, then that file will be", " used.", " -d module Deletes the symbolic and debugging data of the module", " specified.", " -S [directory] Load symbolic and debugging data from the object file", " for all loaded modules. For each module, a search", " will be made for an object file consisting of the", " module name with a .o or .ko suffix, starting at the", " /lib/modules/<release> directory of the host system,", " or if not found there, starting at the directory", " containing the kernel namelist file. If a directory", " argument is appended, then the search will be restricted", " to that directory.", " -D Deletes the symbolic and debugging data of all modules.", " -t Display the contents of the module's \"taints\" bitmask", " if it is non-zero. When possible, the \"taints\" bits", " are translated to symbolic letters of the taint type;", " otherwise the hexadecimal value is shown. In older", " kernels, the contents of the \"license_gplok\" field is", " displayed in hexadecimal; the field may be either a ", " bitmask or a boolean, depending upon the kernel version.", " The relevant kernel sources should be consulted for the", " meaning of the letter(s) or hexadecimal bit value(s). ", " For modules that have a \"gpgsig_ok\" field that is zero", " (unsigned), the notation \"(U)\" is shown.", " -r Passes the -readnow flag to the embedded gdb module,", " which will override the two-stage strategy that it uses", " for reading symbol tables from module object files.", " -R Reinitialize module data. All currently-loaded symbolic", " and debugging data will be deleted, and the installed", " module list will be updated (live system only).", " -g When used with -s or -S, add a module object's section", " start and end addresses to its symbol list.", " -o Load module symbols with old mechanism.", " ", " If the %s session was invoked with the \"--mod <directory>\" option, or", " a CRASH_MODULE_PATH environment variable exists, then /lib/modules/<release>", " will be overridden as the default directory tree that is searched for module", " object files.", " ", " After symbolic and debugging data have been loaded, backtraces and text", " disassembly will be displayed appropriately. Depending upon the processor", " architecture, data may also printed symbolically with the \"p\" command;", " at a minimum, the \"rd\" command may be used with module data symbols.", " ", " If %s can recognize that the set of modules has changed while running a", " session on a live kernel, the module data will be reinitialized the next", " time this command is run; the -r option forces the reinitialization.", "\nEXAMPLES", " Display the currently-installed modules:\n", " %s> mod", " MODULE NAME SIZE OBJECT FILE", " c8019000 soundcore 2788 (not loaded)", " c801b000 soundlow 336 (not loaded)", " c801d000 sound 59864 (not loaded)", " c802d000 ad1848 15728 (not loaded)", " c8032000 uart401 6000 (not loaded)", " c8035000 cs4232 2472 (not loaded)", " c8043000 opl3 11048 (not loaded)", " c8047000 3c59x 18152 (not loaded)", " c804d000 sunrpc 53796 (not loaded)", " c805c000 lockd 31528 (not loaded)", " c8065000 nfsd 151896 (not loaded)", " c8092000 nfs 29752 (not loaded)", " ", " Display the currently-installed modules on a system where all modules were", " compiled with CONFIG_KALLSYMS:", " ", " %s> mod", " MODULE NAME SIZE OBJECT FILE", " e080d000 jbd 57016 (not loaded) [CONFIG_KALLSYMS]", " e081e000 ext3 92360 (not loaded) [CONFIG_KALLSYMS]", " e0838000 usbcore 83168 (not loaded) [CONFIG_KALLSYMS]", " e0850000 usb-uhci 27532 (not loaded) [CONFIG_KALLSYMS]", " e085a000 ehci-hcd 20904 (not loaded) [CONFIG_KALLSYMS]", " e0865000 input 6208 (not loaded) [CONFIG_KALLSYMS]", " e086a000 hid 22404 (not loaded) [CONFIG_KALLSYMS]", " e0873000 mousedev 5688 (not loaded) [CONFIG_KALLSYMS]", " e0878000 keybdev 2976 (not loaded) [CONFIG_KALLSYMS]", " e08fd000 cdrom 34144 (not loaded) [CONFIG_KALLSYMS]", " e0909000 ide-cd 35776 (not loaded) [CONFIG_KALLSYMS]", " e0915000 scsi_mod 117928 (not loaded) [CONFIG_KALLSYMS]", " e0935000 ide-scsi 12752 (not loaded) [CONFIG_KALLSYMS]", " e093c000 microcode 5248 (not loaded) [CONFIG_KALLSYMS]", " e0943000 sr_mod 18136 (not loaded) [CONFIG_KALLSYMS]", " e0956000 floppy 59056 (not loaded) [CONFIG_KALLSYMS]", " e0966000 sg 38060 (not loaded) [CONFIG_KALLSYMS]", " e0971000 ip_tables 16544 (not loaded) [CONFIG_KALLSYMS]", " e097d000 iptable_filter 2412 (not loaded) [CONFIG_KALLSYMS]", " e097f000 e1000 76096 (not loaded) [CONFIG_KALLSYMS]", " e09ba000 autofs 13780 (not loaded) [CONFIG_KALLSYMS]", " e09c1000 parport 39072 (not loaded) [CONFIG_KALLSYMS]", " e09ce000 lp 9220 (not loaded) [CONFIG_KALLSYMS]", " e09d4000 parport_pc 19204 (not loaded) [CONFIG_KALLSYMS]", " e09e2000 agpgart 59128 (not loaded) [CONFIG_KALLSYMS]", " e0a1a000 radeon 117156 (not loaded) [CONFIG_KALLSYMS]", " e2dc7000 sunrpc 91996 (not loaded) [CONFIG_KALLSYMS]", " e2de1000 lockd 60624 (not loaded) [CONFIG_KALLSYMS]", " e2df3000 nfs 96880 (not loaded) [CONFIG_KALLSYMS]", " ", " Load the symbolic and debugging data of all modules:\n", " %s> mod -S", " MODULE NAME SIZE OBJECT FILE", " c8019000 soundcore 2788 /lib/modules/2.2.5-15/misc/soundcore.o", " c801b000 soundlow 336 /lib/modules/2.2.5-15/misc/soundlow.o", " c801d000 sound 59864 /lib/modules/2.2.5-15/misc/sound.o", " c802d000 ad1848 15728 /lib/modules/2.2.5-15/misc/ad1848.o", " c8032000 uart401 6000 /lib/modules/2.2.5-15/misc/uart401.o", " c8035000 cs4232 2472 /lib/modules/2.2.5-15/misc/cs4232.o", " c8043000 opl3 11048 /lib/modules/2.2.5-15/misc/opl3.o", " c8047000 3c59x 18152 /lib/modules/2.2.5-15/net/3c59x.o", " c804d000 sunrpc 53796 /lib/modules/2.2.5-15/misc/sunrpc.o", " c805c000 lockd 31528 /lib/modules/2.2.5-15/fs/lockd.o", " c8065000 nfsd 151896 /lib/modules/2.2.5-15/fs/nfsd.o", " c8092000 nfs 29752 /lib/modules/2.2.5-15/fs/nfs.o", " ", " Load the symbolic and debugging data of the soundcore module from its", " known location:", " ", " %s> mod -s soundcore", " MODULE NAME SIZE OBJECT FILE", " c8019000 soundcore 2788 /lib/modules/2.2.5-15/misc/soundcore.o", " ", " Delete the current symbolic and debugging data of the soundcore module, ", " and then re-load it from a specified object file:", " ", " %s> mod -d soundcore", " %s> mod -s soundcore /tmp/soundcore.o", " MODULE NAME SIZE OBJECT FILE", " c8019000 soundcore 2788 /tmp/soundcore.o", " ", " After installing a new kernel module on a live system, reinitialize the", " installed module list:\n", " %s> !insmod mdacon", " %s> mod", " mod: NOTE: modules have changed on this system -- reinitializing", " MODULE NAME SIZE OBJECT FILE", " c8019000 soundcore 2788 (not loaded)", " c801b000 soundlow 336 (not loaded)", " c801d000 sound 59864 (not loaded)", " c802d000 ad1848 15728 (not loaded)", " c8032000 uart401 6000 (not loaded)", " c8035000 cs4232 2472 (not loaded)", " c8043000 opl3 11048 (not loaded)", " c8047000 3c59x 18152 (not loaded)", " c804d000 sunrpc 53796 (not loaded)", " c805c000 lockd 31528 (not loaded)", " c8065000 nfs 29752 (not loaded)", " c806e000 autofs 9316 (not loaded)", " c8072000 nfsd 151896 (not loaded)", " c80a1000 mdacon 3556 (not loaded)", " ", " Display modules that are \"tainted\", where in this case", " where they are proprietary and unsigned:", " ", " %s> mod -t", " NAME TAINT", " vxspec P(U)", " vxportal P(U)", " fdd P(U)", " vxfs P(U)", " vxdmp P(U)", " vxio P(U)", " vxglm P(U)", " vxgms P(U)", " vxodm P(U)", NULL }; char *help__list[] = { "list", "linked list", "[[-o] offset][-e end][-s struct[.member[,member]] -[xd]] [-r|-h|-H] start", " This command dumps the contents of a linked list. The entries in a linked", " list are typically data structures that are tied together in one of two", " formats:", " ", " 1. A starting address points to a data structure; that structure contains", " a member that is a pointer to the next structure, and so on. This type", " of a singly-linked list typically ends when a \"next\" pointer value ", " contains one of the following:", "", " (a) a NULL pointer.", " (b) a pointer to the start address.", " (c) a pointer to the first item pointed to by the start address.", " (d) a pointer to its containing structure.", " ", " 2. Most Linux lists of data structures are doubly-linked using \"list_head\"", " structures that are embedded members of the data structures in the list:", " ", " struct list_head {", " struct list_head *next, *prev;", " };", " ", " The linked list is typically headed by an external, standalone list_head,", " which is simply initialized to point to itself, signifying that the list", " is empty:", " ", " #define LIST_HEAD_INIT(name) { &(name), &(name) } ", " #define LIST_HEAD(name) struct list_head name = LIST_HEAD_INIT(name)", " ", " In the case of list_head-linked lists, the \"list_head.next\" pointer is", " the address of a list_head structure that is embedded in the next data", " structure in the list, and not the address of the next data structure ", " itself. The starting point of the list may be:", "", " (a) an external, standalone, LIST_HEAD().", " (b) a list_head that is embedded within a data structure of the same", " type as the whole linked list.", " (c) a list_head that is embedded within a data structure that is", " different than the type of structures in the the linked list.", " ", " The list typically ends when the embedded \"list_head.next\" pointer of", " a data structure in the linked list points back to the LIST_HEAD()", " address. However, some list_head-linked lists have no defined starting", " point, but just link back onto themselves in a circular manner.", "", " This command can handle both types of linked list; in both cases the list", " of addresses that are dumped are the addresses of the data structures", " themselves.", "", " The arguments are as follows:", "", " [-o] offset The offset within the structure to the \"next\" pointer", " (default is 0). If non-zero, the offset may be entered", " in either of two manners:", "", " 1. In \"structure.member\" format; the \"-o\" is not necessary.", " 2. A number of bytes; the \"-o\" is only necessary on processors", " where the offset value could be misconstrued as a kernel", " virtual address.", "", " -e end If the list ends in a manner unlike the typical manners that", " are described above, an explicit ending address value may be", " entered.", " -s struct For each address in list, format and print as this type of", " structure; use the \"struct.member\" format in order to display", " a particular member of the structure. To display multiple", " members of a structure, use a comma-separated list of members.", " -x Override the default output format with hexadecimal format.", " -d Override the default output format with decimal format.", " -r For a list linked with list_head structures, traverse the list", " in the reverse order by using the \"prev\" pointer instead", " of \"next\".", " ", " The meaning of the \"start\" argument, which can be expressed symbolically,", " in hexadecimal format, or an expression evaluating to an address, depends", " upon whether the -h or -H option is pre-pended:", " ", " start The address of the first data structure in the list.", " -H start The address of a list_head structure, typically that of an", " external, standalone LIST_HEAD(). The list typically ends ", " when the embedded \"list_head.next\" of a data structure in ", " the linked list points back to this \"start\" address.", " -h start The address of a data structure which contains an embedded", " list_head. The list typically ends when the embedded", " \"list_head.next\" of a data structure in the linked list ", " points back to the embedded list_head contained in the data", " structure whose address is this \"start\" argument.", "", "WARNING ", " When the \"-h start\" option is used, it is possible that the list_head-linked", " list will:", " ", " 1. pass through an external standalone LIST_HEAD(), or", " 2. pass through a list_head that is the actual starting list_head, but is", " contained within a data structure that is not the same type as all of", " the other data structures in the list.", " ", " When that occurs, the data structure address displayed for that list_head", " will be incorrect, because the \"-h start\" option presumes that all", " list_head structures in the list are contained within the same type of", " data structure. Furthermore, if the \"-s struct[.member[,member]\" option", " is used, it will display bogus data for that particular list_head.", "\nEXAMPLES", " Note that each task_struct is linked to its parent's task_struct via the", " p_pptr member:", " ", " %s> struct task_struct.p_pptr", " struct task_struct {", " [136] struct task_struct *p_pptr;", " }", " ", " That being the case, given a task_struct pointer of c169a000, show its ", " parental hierarchy back to the \"init_task\" (the \"swapper\" task):\n", " %s> list task_struct.p_pptr c169a000", " c169a000", " c0440000", " c50d0000", " c0562000", " c0d28000", " c7894000", " c6a98000", " c009a000", " c0252000\n", " Given that the \"task_struct.p_pptr\" offset is 136 bytes, the same", " result could be accomplished like so:\n", " %s> list 136 c169a000", " c169a000", " c0440000", " c50d0000", " c0562000", " c0d28000", " c7894000", " c6a98000", " c009a000", " c0252000", " ", " The list of currently-registered file system types are headed up by a", " struct file_system_type pointer named \"file_systems\", and linked by", " the \"next\" field in each file_system_type structure. The following", " sequence displays the structure address followed by the name and ", " fs_flags members of each registered file system type:", " ", " %s> p file_systems", " file_systems = $1 = (struct file_system_type *) 0xc03adc90", " %s> list file_system_type.next -s file_system_type.name,fs_flags c03adc90", " c03adc90", " name = 0xc02c05c8 \"rootfs\",", " fs_flags = 0x30,", " c03abf94", " name = 0xc02c0319 \"bdev\",", " fs_flags = 0x10,", " c03acb40", " name = 0xc02c07c4 \"proc\",", " fs_flags = 0x8,", " c03e9834", " name = 0xc02cfc83 \"sockfs\",", " fs_flags = 0x10,", " c03ab8e4", " name = 0xc02bf512 \"tmpfs\",", " fs_flags = 0x20,", " c03ab8c8", " name = 0xc02c3d6b \"shm\",", " fs_flags = 0x20,", " c03ac394", " name = 0xc02c03cf \"pipefs\",", " fs_flags = 0x10,", " c03ada74", " name = 0xc02c0e6b \"ext2\",", " fs_flags = 0x1,", " c03adc74", " name = 0xc02c0e70 \"ramfs\",", " fs_flags = 0x20,", " c03ade74", " name = 0xc02c0e76 \"hugetlbfs\",", " fs_flags = 0x20,", " c03adf8c", " name = 0xc02c0f84 \"iso9660\",", " fs_flags = 0x1,", " c03aec14", " name = 0xc02c0ffd \"devpts\",", " fs_flags = 0x8,", " c03e93f4", " name = 0xc02cf1b9 \"pcihpfs\",", " fs_flags = 0x28,", " e0831a14", " name = 0xe082f89f \"ext3\",", " fs_flags = 0x1,", " e0846af4", " name = 0xe0841ac6 \"usbdevfs\",", " fs_flags = 0x8,", " e0846b10", " name = 0xe0841acf \"usbfs\",", " fs_flags = 0x8,", " e0992370", " name = 0xe099176c \"autofs\",", " fs_flags = 0x0,", " e2dcc030", " name = 0xe2dc8849 \"nfs\",", " fs_flags = 0x48000,", " ", " In some kernels, the system run queue is a linked list headed up by the", " \"runqueue_head\", which is defined like so:", " ", " static LIST_HEAD(runqueue_head);", " ", " The run queue linking is done with the \"run_list\" member of the task_struct:", " ", " %s> struct task_struct.run_list", " struct task_struct {", " [60] struct list_head run_list;", " }", " ", " Therefore, to view the list of task_struct addresses in the run queue,", " either of the following commands will work:\n", " %s> list task_struct.run_list -H runqueue_head", " f79ac000", " f7254000", " f7004000", " %s> list 60 -H runqueue_head", " f79ac000", " f7254000", " f7004000", " ", " In some kernel versions, the vfsmount structures of the mounted", " filesystems are linked by the LIST_HEAD \"vfsmntlist\", which uses the", " mnt_list list_head of each vfsmount structure in the list. To dump each", " vfsmount structure in the list, append the -s option:\n", " %s> list -H vfsmntlist vfsmount.mnt_list -s vfsmount", " c3fc9e60", " struct vfsmount {", " mnt_hash = {", " next = 0xc3fc9e60, ", " prev = 0xc3fc9e60", " }, ", " mnt_parent = 0xc3fc9e60, ", " mnt_mountpoint = 0xc3fc5dc0, ", " mnt_root = 0xc3fc5dc0, ", " mnt_instances = {", " next = 0xc3f60a74, ", " prev = 0xc3f60a74", " }, ", " mnt_sb = 0xc3f60a00, ", " mnt_mounts = {", " next = 0xf7445e08, ", " prev = 0xf7445f88", " }, ", " mnt_child = {", " next = 0xc3fc9e88, ", " prev = 0xc3fc9e88", " }, ", " mnt_count = {", " counter = 209", " }, ", " mnt_flags = 0, ", " mnt_devname = 0xc8465b20 \"/dev/root\", ", " mnt_list = {", " next = 0xf7445f9c, ", " prev = 0xc02eb828", " }, ", " mnt_owner = 0", " }", " f7445f60", " struct vfsmount {", " ...", " ", " The task_struct of every task in the system is linked into a circular list", " by its embedded \"tasks\" list_head. Show the task_struct addresses and the", " pids of all tasks in the system using \"-h\" option, starting with the ", " task_struct at ffff88012b98e040:\n", " %s> list task_struct.tasks -s task_struct.pid -h ffff88012b98e040", " ffff88012b98e040", " pid = 14187", " ffff8801277be0c0", " pid = 14248", " ffffffff81a2d020", " pid = 0", " ffff88012d7dd4c0", " pid = 1", " ffff88012d7dca80", " pid = 2", " ffff88012d7dc040", " pid = 3", " ffff88012d7e9500", " pid = 4", " ...", " ffff88012961a100", " pid = 14101", " ffff880129017580", " pid = 14134", " ffff8801269ed540", " pid = 14135", " ffff880128256080", " pid = 14138", " ffff88012b8f4100", " pid = 14183", NULL }; char *help_tree[] = { "tree", "display radix tree or red-black tree", "-t [radix|rbtree] [-r offset] [-s struct[.member[,member]] -[x|d]]\n [-o offset] [-p] [-N] start", " This command dumps the contents of a radix tree or a red-black tree.", " The arguments are as follows:\n", " -t type The type of tree to dump; the type string can be either ", " \"radix\" or \"rbtree\", although only the first two characters", " are required.", " -r offset If the \"start\" argument is the address of a data structure that", " contains the radix_tree_root or rb_root structure, then this is", " the offset to that structure member. If the offset is non-zero,", " then this option is required. The offset may be entered in either", " of two manners:", " 1. In \"structure.member\" format.", " 2. A number of bytes.", " -o offset For red-black trees only, the offset of the rb_node within its ", " containing data structure; if the offset is non-zero, then this", " option is required. The offset may be entered in either of two", " manners:", " 1. In \"structure.member\" format.", " 2. A number of bytes.", " This option is not applicable to radix trees.", " -s struct For each entry in a tree, format and print it as this type of data", " structure; use the \"struct.member\" format in order to display a", " particular member of the structure. To display multiple members", " of a structure, use a comma-separated list of members.", " -x Override default output format with hexadecimal format.", " -d Override default output format with decimal format.", " -p Display the node's position information, showing the relationship", " between it and the root. For red-black trees, a position that", " indicates \"root/l/r\" means that the node is the right child", " of the left child of the root node. For radix trees, the height", " and slot index values are shown with respect to the root.", " ", " The meaning of the \"start\" argument, which can be expressed either in", " hexadecimal format or symbolically, depends upon whether the -N option", " is prepended:", " ", " start The address of a radix_tree_root or rb_root structure, or the", " address of a structure containing the radix_tree_root or rb_root", " structure; if the latter, then the \"-r offset\" option must be", " used if the member offset of the root structure is non-zero.", " ", " -N start The address of the structure radix_tree_node or rb_node, bypassing", " the radix_tree_root or rb_root that points to it.", "", "\nEXAMPLES", " The vmap_area_root is a standalone rb_root structure. Display the ", " virtual addresses of each vmap_area in its red-black tree:\n", " %s> whatis vmap_area_root", " struct rb_root vmap_area_root;", " %s> tree -t rbtree -o vmap_area.rb_node vmap_area_root", " ffff880128c508c0", " ffff88012cb68140", " ffff88012c9afec0", " ffff88012d65c440", " ...", "", " Display the vmap_area's va_start and va_end members of each of", " the entries above expressing the vmap_area.rb_node offset as a", " number of bytes:\n", " %s> tree -t rbtree -o 24 vmap_area_root -s vmap_area.va_start,va_end", " ffff880128c508c0", " va_start = 0xffffc90014900000", " va_end = 0xffffc90014921000", " ffff88012cb68140", " va_start = 0xffffc900110c0000", " va_end = 0xffffc900110d1000", " ffff88012c9afec0", " va_start = 0xffffc90000640000", " va_end = 0xffffc90000642000", " ffff88012d65c440", " va_start = 0xffffc90000620000", " va_end = 0xffffc90000622000", " ...", "", " Alternatively, use the -N option with the rb_node address contained", " in the vmap_area_root structure:\n", " %s> p vmap_area_root", " vmap_area_root = $8 = {", " rb_node = 0xffff880128c508d8", " }", " %s> tree -t rbtree -o vmap_area.rb_node -N 0xffff880128c508d8", " ffff880128c508c0", " ffff88012cb68140", " ffff88012c9afec0", " ffff88012d65c440", " ", " Display the virtual address of each vm_area_struct in the red-black", " tree that has its root inside an mm_struct located at ffff880128b5a300.", " The vm_area_struct.vm_rb rb_node member has an offset of 0x38 bytes:\n", " %s> tree -t rbtree -r mm_struct.mm_rb ffff880128b5a300 -o 0x38", " ffff88012a0de080", " ffff880123e3ac78", " ffff880123e3a700", " ffff88012b2837c8", " ...", " ffff880128c02ed0", " ffff8801292e7958", " ffff880123e3a318", " ffff880123e3ad40", " ", " Add the -p option to the command above to show position information:\n", " %s> tree -t rbtree -r mm_struct.mm_rb ffff880128b5a300 -o 0x38 -p", " ffff88012a0de080", " position: root", " ffff880123e3ac78", " position: root/l", " ffff880123e3a700", " position: root/l/l", " ffff88012b2837c8", " position: root/l/l/l", " ...", " ffff880128c02ed0", " position: root/r/r/l/r", " ffff8801292e7958", " position: root/r/r/l/r/r", " ffff880123e3a318", " position: root/r/r/r", " ffff880123e3ad40", " position: root/r/r/r/r", "", " Display a list of the page structs in the radix tree of an address_space", " structure located at ffff88012d364de0:\n", " %s> tree -t radix -r address_space.page_tree ffff88012d364de0", " ffffea00040d12c0", " ffffea00040d9a60", " ffffea00040d9b08", " ffffea000407eda8", " ffffea0004084288", " ...", " ffffea000407bc70", " ffffea00040baf48", " ffffea0004043f48", " ffffea000407de58", " ", " Add the -p option to the command above to show position information:\n", " %s> tree -t radix -r address_space.page_tree ffff88012d364de0 -p", " ffffea00040d12c0", " position: root/0/0", " ffffea00040d9a60", " position: root/0/1", " ffffea00040d9b08", " position: root/0/2", " ffffea000407eda8", " position: root/0/3", " ffffea0004084288", " position: root/0/4", " ...", " ffffea000407bc70", " position: root/3/25", " ffffea00040baf48", " position: root/3/26", " ffffea0004043f48", " position: root/3/27", " ffffea000407de58", " position: root/3/28", "", " Alternatively, take the address of the radix_tree_node from the", " radix_tree_root structure in the address_space structure above,", " and display the tree with the -N option:\n", " %s> struct address_space.page_tree ffff88012d364de0", " page_tree = {", " height = 0x2, ", " gfp_mask = 0x20, ", " rnode = 0xffff8801238add71", " }", " %s> tree -t radix -N 0xffff8801238add71", " ffffea00040d12c0", " ffffea00040d9a60", " ffffea00040d9b08", " ffffea000407eda8", " ffffea0004084288", " ffffea00040843a0", " ...", " ", " Using the same radix tree as above, display the flags and _count", " members of each page struct in the list, and force the output format", " to be hexadecimal:\n", " %s> tree -t radix -N 0xffff8801238add71 -s page.flags,_count -x", " ffffea00040d12c0", " flags = 0x4000000002006c", " _count = {", " counter = 0x7", " }", " ffffea00040d9a60", " flags = 0x4000000002006c", " _count = {", " counter = 0x7", " }", " ffffea00040d9b08", " flags = 0x4000000002006c", " _count = {", " counter = 0x7", " }", " ffffea000407eda8", " flags = 0x4000000002006c", " _count = {", " counter = 0x7", " }", " ...", NULL }; char *help_ptob[] = { "ptob", "page to bytes", "page_number ...", " This command translates a page frame number to its byte value.", "\nEXAMPLES", " %s> ptob 512a", " 512a: 512a000", NULL }; char *help_gdb[] = { "gdb", "gdb command", "command ...", " This command passes its arguments directly to gdb for processing.", " This is typically not necessary, but where ambiguities between %s and", " gdb command names exist, this will force the command to be executed by gdb.", "", " Alternatively, if \"set gdb on\" is entered, the session will be run in a", " mode where all commands are passed directly to gdb. When running in that", " mode, native %s commands may be executed by preceding them with the", " \"crash\" directive. To restore native %s mode, enter \"set gdb off\".", "\nEXAMPLES", " %s> gdb help", " List of classes of commands:", " ", " aliases -- Aliases of other commands", " breakpoints -- Making program stop at certain points", " data -- Examining data", " files -- Specifying and examining files", " internals -- Maintenance commands", " obscure -- Obscure features", " running -- Running the program", " stack -- Examining the stack", " status -- Status inquiries", " support -- Support facilities", " tracepoints -- Tracing of program execution without stopping the program", " user-defined -- User-defined commands", " ", " Type \"help\" followed by a class name for a list of commands in that class.", " Type \"help\" followed by command name for full documentation.", " Command name abbreviations are allowed if unambiguous.", NULL }; char *help_kmem[] = { "kmem", "kernel memory", "[-f|-F|-p|-c|-C|-i|-s|-S|-v|-V|-n|-z-o] [slab] [[-P] address]\n" " [-g [flags]] [-I slab[,slab]]", " This command displays information about the use of kernel memory.\n", " -f displays the contents of the system free memory headers.", " also verifies that the page count equals nr_free_pages.", " -F same as -f, but also dumps all pages linked to that header.", " -p displays basic information about each page in the system ", " mem_map[] array.", " -c walks through the page_hash_table and verifies page_cache_size.", " -C same as -c, but also dumps all pages in the page_hash_table.", " -i displays general memory usage information", " -s displays basic kmalloc() slab data.", " -S displays all kmalloc() slab data, including all slab objects,", " and whether each object is in use or is free. If CONFIG_SLUB,", " slab data for each per-cpu slab is displayed, along with the", " address of each kmem_cache_node, its count of full and partial", " slabs, and a list of all tracked slabs.", " -v displays the mapped virtual memory regions allocated by vmalloc().", " -V displays the kernel vm_stat table if it exists, the cumulative", " page_states counter values if they exist, and/or the cumulative", " vm_event_states counter values if they exist.", " -n display memory node data (if supported).", " -z displays per-zone memory statistics.", " -o displays each cpu's offset value that is added to per-cpu symbol", " values to translate them into kernel virtual addresses.", " -g displays the enumerator value of all bits in the page structure's", " \"flags\" field.", " flags when used with -g, translates all bits in this hexadecimal page", " structure flags value into its enumerator values.", " slab when used with -s or -S, limits the command to only the slab cache", " of name \"slab\". If the slab argument is \"list\", then", " all slab cache names and addresses are listed.", " -I slab when used with -s or -S, one or more slab cache names in a", " comma-separated list may be specified as slab caches to ignore.", " -P declares that the following address argument is a physical address.", " address when used without any flag, the address can be a kernel virtual,", " or physical address; a search is made through the symbol table,", " the kmalloc() slab subsystem, the free list, the page_hash_table,", " the vmalloc() region subsystem, the current set of task_structs", " and kernel stacks, and the mem_map array. If found in any of", " those areas, the information will be dumped in the same manner as", " if the location-specific flags were used; if contained within a", " curent task_struct or kernel stack, that task's context will be", " displayed.", " address when used with -s or -S, searches the kmalloc() slab subsystem", " for the slab containing of this virtual address, showing whether", " it is in use or free.", " address when used with -f, the address can be either a page pointer,", " a physical address, or a kernel virtual address; the free_area", " header containing the page (if any) is displayed.", " address when used with -p, the address can be either a page pointer, a", " physical address, or a kernel virtual address; its basic mem_map", " page information is displayed.", " address when used with -c, the address must be a page pointer address;", " the page_hash_table entry containing the page is displayed.", " address when used with -l, the address must be a page pointer address;", " the page address is displayed if it is contained with the list.", " address when used with -v, the address can be a mapped kernel virtual", " address or physical address; the mapped region containing the", " address is displayed.\n", " All address arguments above must be expressed in hexadecimal format.", "\nEXAMPLES", " Display memory usage information:\n", " %s> kmem -i", " PAGES TOTAL PERCENTAGE", " TOTAL MEM 63602 248.4 MB ----", " FREE 993 3.9 MB 1% of TOTAL MEM", " USED 62609 244.6 MB 98% of TOTAL MEM", " SHARED 34035 132.9 MB 53% of TOTAL MEM", " BUFFERS 10928 42.7 MB 17% of TOTAL MEM", " CACHED 35249 137.7 MB 55% of TOTAL MEM", " SLAB 2823 11 MB 4% of TOTAL MEM", " ", " TOTAL HIGH 0 0 0% of TOTAL MEM", " FREE HIGH 0 0 0% of TOTAL HIGH", " TOTAL LOW 63602 248.4 MB 100% of TOTAL MEM", " FREE LOW 993 3.9 MB 1% of TOTAL LOW", " ", " TOTAL SWAP 129792 507 MB ----", " SWAP USED 14727 57.5 MB 11% of TOTAL SWAP", " SWAP FREE 115065 449.5 MB 88% of TOTAL SWAP", " ", " ZONE NAME FREE ACTIVE INACTIVE_DIRTY INACTIVE_CLEAN MIN/LOW/HIGH", " 0 DMA 240 1166 7 161 128/256/384 ", " 1 Normal 753 17009 27834 0 255/510/765 ", " 2 HighMem 0 0 0 0 0/0/0 ", " ", " Display and verify free memory data:\n", " %s> kmem -f", " NODE", " 0", " ZONE NAME SIZE FREE MEM_MAP START_PADDR START_MAPNR", " 0 DMA 4096 3372 c4000040 0 0 ", " AREA SIZE FREE_AREA_STRUCT BLOCKS PAGES", " 0 4k c02eb004 2 2", " 1 8k c02eb010 3 6", " 2 16k c02eb01c 5 20", " 3 32k c02eb028 4 32", " 4 64k c02eb034 5 80", " 5 128k c02eb040 3 96", " 6 256k c02eb04c 3 192", " 7 512k c02eb058 1 128", " 8 1024k c02eb064 1 256", " 9 2048k c02eb070 5 2560", " ", " ZONE NAME SIZE FREE MEM_MAP START_PADDR START_MAPNR", " 1 Normal 225280 202269 c4044040 1000000 4096 ", " AREA SIZE FREE_AREA_STRUCT BLOCKS PAGES", " 0 4k c02eb0b8 1 1", " 1 8k c02eb0c4 2 4", " 2 16k c02eb0d0 0 0", " 3 32k c02eb0dc 1 8", " 4 64k c02eb0e8 1 16", " 5 128k c02eb0f4 0 0", " 6 256k c02eb100 0 0", " 7 512k c02eb10c 0 0", " 8 1024k c02eb118 0 0", " 9 2048k c02eb124 395 202240", " ", " ZONE NAME SIZE FREE MEM_MAP START_PADDR START_MAPNR", " 2 HighMem 819200 748686 c4ee0040 38000000 229376 ", " AREA SIZE FREE_AREA_STRUCT BLOCKS PAGES", " 0 4k c02eb16c 10 10", " 1 8k c02eb178 2 4", " 2 16k c02eb184 0 0", " 3 32k c02eb190 2 16", " 4 64k c02eb19c 1 16", " 5 128k c02eb1a8 1 32", " 6 256k c02eb1b4 1 64", " 7 512k c02eb1c0 0 0", " 8 1024k c02eb1cc 0 0", " 9 2048k c02eb1d8 1462 748544", " ", " nr_free_pages: 954327 (verified)", " ", " Dump all the base addresses of each free memory area from above:\n", " %s> kmem -F", " NODE", " 0", " ZONE NAME SIZE FREE MEM_MAP START_PADDR START_MAPNR", " 0 DMA 4096 3372 c4000040 0 0 ", " AREA SIZE FREE_AREA_STRUCT", " 0 4k c02eb004 ", " c400ded8", " c4042528", " AREA SIZE FREE_AREA_STRUCT", " 1 8k c02eb010 ", " c400de50", " c400cee8", " c40424a0", " AREA SIZE FREE_AREA_STRUCT", " 2 16k c02eb01c ", " c400dd40", " c400cf70", " c40425b0", " c400f7d0", " c40028a0", " AREA SIZE FREE_AREA_STRUCT", " 3 32k c02eb028 ", " c4042280", " c400f8e0", " c4002680", " c4000260", " AREA SIZE FREE_AREA_STRUCT", " 4 64k c02eb034 ", " c400d080", " c4041e40", " ...", " ", " Dump the mem_map[] array:\n", " %s> kmem -p", " PAGE PHYSICAL MAPPING INDEX CNT FLAGS", " f5c51200 10000 0 0 1 80 slab", " f5c51220 11000 0 0 1 80 slab", " f5c51240 12000 0 0 1 80 slab", " f5c51260 13000 0 0 1 80 slab", " f5c51280 14000 0 0 1 80 slab", " f5c512a0 15000 0 0 1 80 slab", " f5c512c0 16000 0 0 1 80 slab", " f5c512e0 17000 0 0 1 80 slab", " f5c51300 18000 0 0 1 80 slab", " f5c51320 19000 0 0 1 80 slab", " f5c51340 1a000 0 0 1 80 slab", " f5c51360 1b000 0 0 1 80 slab", " f5c51380 1c000 e6c6a754 13b67 2 868 uptodate,lru,active,private", " f5c513a0 1d000 0 0 1 80 slab", " f5c513c0 1e000 0 0 1 80 slab", " f5c513e0 1f000 0 0 1 80 slab", " f5c51400 20000 e6c6a754 13bbb 2 868 uptodate,lru,active,private", " f5c51420 21000 0 0 1 80 slab", " f5c51440 22000 0 0 1 80 slab", " ...", " ", " Use the commands above with a page pointer or a physical address argument:\n", " %s> kmem -f c40425b0", " NODE ", " 0 ", " ZONE NAME SIZE FREE MEM_MAP START_PADDR START_MAPNR", " 0 DMA 4096 3372 c4000040 0 0 ", " AREA SIZE FREE_AREA_STRUCT ", " 2 16k c02eb01c ", " c40425b0 (c40425b0 is 1st of 4 pages) ", " ", " %s> kmem -p c25a9c00", " PAGE PHYSICAL MAPPING INDEX CNT FLAGS", " c25a9c00 1fe0000 f429d2e4 21fe3eb 2 800828 uptodate,lru,private", " ", " %s> kmem -p 1fe0000", " PAGE PHYSICAL MAPPING INDEX CNT FLAGS", " c25a9c00 1fe0000 f429d2e4 21fe3eb 2 800828 uptodate,lru,private", " ", " Display the mapped memory regions allocated by vmalloc():\n", " %s> kmem -v", " VMAP_AREA VM_STRUCT ADDRESS RANGE SIZE", " f7048e00 f7048e40 f7dfe000 - f7e00000 8192", " f7048ec0 f7048f00 f7e00000 - f7e05000 20480", " f7151fc0 f7159540 f7e06000 - f7e08000 8192", " f704da80 f704dac0 f7e0a000 - f7e0c000 8192", " f704d980 f704d9c0 f7e0e000 - f7e10000 8192", " f724f1c0 f724f200 f7e12000 - f7e14000 8192", " f704d840 f704d880 f7e14000 - f7e17000 12288", " f704d400 f704d440 f7e18000 - f7e1d000 20480", " f73f5840 f73f5880 f7e1e000 - f7e2a000 49152", " f6334480 f63344c0 f7e2c000 - f7e2e000 8192", " f635d600 f635d640 f7e4a000 - f7e5b000 69632", " f41b4700 f5771a40 f7e6e000 - f7e70000 8192", " f622f6c0 f622f700 f7e71000 - f7e79000 32768", " f63a9f00 f63a9f40 f7e84000 - f7e87000 12288", " f63a9d00 f63a9d40 f7e8f000 - f7e91000 8192", " f5546480 f39db800 f7eb8000 - f7ec2000 40960", " f5ce9640 f5777e80 f7ec6000 - f7ed1000 45056", " f63a9b00 f63a9b40 f7ed1000 - f7efd000 180224", " f63a9800 f63a9840 f7f1d000 - f7f26000 36864", " f63a9640 f63a9880 f7f43000 - f7f52000 61440", " f5771f00 f4183840 f7f53000 - f7f64000 69632", " f5ce9a00 f30c4a00 f7fcf000 - f801e000 323584", " f63a93c0 f63a9400 f805d000 - f8132000 872448", " f63a91c0 f63a95c0 f814b000 - f8150000 20480", " f63a9140 f63a9180 f8151000 - f8352000 2101248", " f624eb00 f624eb40 f8353000 - f8355000 8192", " f563eb40 f563eb80 f8356000 - f835e000 32768", " f63d5ec0 f63d5f00 f8360000 - f8371000 69632", " f63d5cc0 f6287b80 f83c2000 - f84c3000 1052672", " ...", " ", " Dump the vm_table contents:\n", " %s> kmem -V", " NR_ANON_PAGES: 38989", " NR_FILE_MAPPED: 3106", " NR_FILE_PAGES: 169570", " NR_SLAB: 32439", " NR_PAGETABLE: 1181", " NR_FILE_DIRTY: 4633", " NR_WRITEBACK: 0", " NR_UNSTABLE_NFS: 0", " NR_BOUNCE: 0", " NUMA_HIT: 63545992", " NUMA_MISS: 0", " NUMA_FOREIGN: 0", " NUMA_INTERLEAVE_HIT: 24002", " NUMA_LOCAL: 63545992", " NUMA_OTHER: 0", " ", " Determine (and verify) the page cache size:\n", " %s> kmem -c", " page_cache_size: 18431 (verified)", " ", " Dump all pages in the page_hash_table:\n", " %s> kmem -C", " page_hash_table[0]", " c0325b40", " c03a0598", " c03b4070", " c0364c28", " c0357690", " c02ef338", " c02d7c60", " c02c11e0", " c02a3d70", " page_hash_table[1]", " c0394ce8", " c03c4218", " c03b4048", " c0364c00", " c0357668", " c02d6e50", " c02d7dc8", " c02c0cb8", " c02db630", " c02ebad0", " page_hash_table[2]", " c037e808", " c034e248", " c03b4020", " c02ec868", " c03baa60", " ...", " page_hash_table[2047]", " c033a798", " c0390b48", " c03b4098", " c0364890", " c03576b8", " c02d2c38", " c02d7c88", " c02de5d8", " ", " page_cache_size: 18437 (verified)", " ", " Find the page_hash_table entry containing page c03576b8:\n", " %s> kmem -c c03576b8", " page_hash_table[2047]", " c03576b8", " ", " Display kmalloc() slab data:\n", " %s> kmem -s", " CACHE NAME OBJSIZE ALLOCATED TOTAL SLABS SSIZE", " c02eadc0 kmem_cache 232 58 68 4 4k", " f79c2888 ip_vs_conn 128 0 0 0 4k", " f79c2970 tcp_tw_bucket 96 0 0 0 4k", " f79c2a58 tcp_bind_bucket 32 12 565 5 4k", " f79c2b40 tcp_open_request 64 0 59 1 4k", " f79c2c28 inet_peer_cache 64 1 59 1 4k", " f79c2d10 ip_fib_hash 32 11 339 3 4k", " f79c2df8 ip_dst_cache 160 8 120 5 4k", " f79c2ee0 arp_cache 128 1 30 1 4k", " c8402970 blkdev_requests 96 30208 37800 945 4k", " c8402a58 nfs_read_data 384 0 0 0 4k", " c8402b40 nfs_write_data 384 0 0 0 4k", " c8402c28 nfs_page 96 0 0 0 4k", " c8402d10 dnotify cache 20 0 0 0 4k", " c8402df8 file lock cache 92 3 336 8 4k", " c8402ee0 fasync cache 16 0 0 0 4k", " c84027a0 uid_cache 32 3 339 3 4k", " c84026b8 skbuff_head_cache 160 320 624 26 4k", " c84025d0 sock 832 32 180 20 8k", " c84024e8 sigqueue 132 0 203 7 4k", " c8402400 cdev_cache 64 19 472 8 4k", " c8402318 bdev_cache 64 8 236 4 4k", " c8402230 mnt_cache 96 11 120 3 4k", " c8402148 inode_cache 480 817 848 106 4k", " c8402060 dentry_cache 128 1352 1470 49 4k", " c8403ee0 filp 96 244 440 11 4k", " c8403df8 names_cache 4096 0 12 12 4k", " c8403d10 buffer_head 96 14936 16000 400 4k", " c8403c28 mm_struct 128 25 240 8 4k", " c8403b40 vm_area_struct 64 393 1298 22 4k", " c8403a58 fs_cache 64 30 472 8 4k", " c8403970 files_cache 416 30 135 15 4k", " c8403888 signal_act 1312 32 99 33 4k", " c84037a0 size-131072(DMA) 131072 0 0 0 128k", " c84036b8 size-131072 131072 1 1 1 128k", " c84035d0 size-65536(DMA) 65536 0 0 0 64k", " c84034e8 size-65536 65536 0 0 0 64k", " c8403400 size-32768(DMA) 32768 0 0 0 32k", " c8403318 size-32768 32768 0 1 1 32k", " c8403230 size-16384(DMA) 16384 0 0 0 16k", " c8403148 size-16384 16384 0 0 0 16k", " c8403060 size-8192(DMA) 8192 0 0 0 8k", " c8401ee0 size-8192 8192 1 2 2 8k", " c8401df8 size-4096(DMA) 4096 0 0 0 4k", " c8401d10 size-4096 4096 30 30 30 4k", " c8401c28 size-2048(DMA) 2048 0 0 0 4k", " c8401b40 size-2048 2048 37 132 66 4k", " c8401a58 size-1024(DMA) 1024 0 0 0 4k", " c8401970 size-1024 1024 301 328 82 4k", " c8401888 size-512(DMA) 512 0 0 0 4k", " c84017a0 size-512 512 141 168 21 4k", " c84016b8 size-256(DMA) 256 0 0 0 4k", " c84015d0 size-256 256 80 435 29 4k", " c84014e8 size-128(DMA) 128 0 0 0 4k", " c8401400 size-128 128 508 840 28 4k", " c8401318 size-64(DMA) 64 0 0 0 4k", " c8401230 size-64 64 978 1357 23 4k", " c8401148 size-32(DMA) 32 0 0 0 4k", " c8401060 size-32 32 1244 1808 16 4k", " ", " Display all slab data in the \"arp_cache\" cache:\n", " %s> kmem -S arp_cache", " CACHE NAME OBJSIZE ALLOCATED TOTAL SLABS SSIZE", " f79c2ee0 arp_cache 128 1 30 1 4k", " SLAB MEMORY TOTAL ALLOCATED FREE", " f729d000 f729d0a0 30 1 29", " FREE / [ALLOCATED]", " f729d0a0 (cpu 7 cache)", " f729d120 (cpu 7 cache)", " f729d1a0 (cpu 7 cache)", " f729d220 (cpu 7 cache)", " f729d2a0 (cpu 7 cache)", " f729d320 (cpu 7 cache)", " f729d3a0 (cpu 7 cache)", " f729d420 (cpu 7 cache)", " f729d4a0 (cpu 7 cache)", " f729d520 (cpu 7 cache)", " f729d5a0 (cpu 7 cache)", " f729d620 (cpu 7 cache)", " f729d6a0 (cpu 7 cache)", " f729d720 (cpu 7 cache)", " f729d7a0 (cpu 7 cache)", " f729d820 (cpu 7 cache)", " f729d8a0 (cpu 7 cache)", " f729d920 (cpu 7 cache)", " f729d9a0 (cpu 7 cache)", " f729da20 (cpu 7 cache)", " f729daa0 (cpu 7 cache)", " f729db20 (cpu 7 cache)", " f729dba0 (cpu 7 cache)", " f729dc20 (cpu 7 cache)", " f729dca0 (cpu 7 cache)", " f729dd20 (cpu 7 cache)", " f729dda0 (cpu 7 cache)", " f729de20 (cpu 7 cache)", " f729dea0 (cpu 3 cache)", " [f729df20]", " ", " Search the kmalloc() slab subsystem for address c3fbdb60:\n", " %s> kmem -s c3fbdb60", " CACHE NAME OBJSIZE ALLOCATED TOTAL SLABS SSIZE", " c8402970 blkdev_requests 96 30208 37800 945 4k", " SLAB MEMORY TOTAL ALLOCATED FREE", " c3fbd020 c3fbd0e0 40 40 0", " FREE / [ALLOCATED]", " [c3fbdb60]", " ", " Make a generic search (no flags) for the same address c3fbdb60:\n", " %s> kmem c3fbdb60 ", " CACHE NAME OBJSIZE ALLOCATED TOTAL SLABS SSIZE", " c8402970 blkdev_requests 96 30208 37800 945 4k", " SLAB MEMORY TOTAL ALLOCATED FREE", " c3fbd020 c3fbd0e0 40 40 0 ", " FREE / [ALLOCATED]", " [c3fbdb60]", " ", " PAGE PHYSICAL MAPPING INDEX CNT FLAGS", " c410ee74 3fbd000 0 0 1 slab", "\n Display memory node data (if supported):\n", " %s> kmem -n", " NODE SIZE PGLIST_DATA BOOTMEM_DATA NODE_ZONES", " 0 130933 c0332ee0 c0403a44 c0332ee0", " c03333e0", " c03338e0", " MEM_MAP START_PADDR START_MAPNR", " c1000030 0 0", " ", " ZONE NAME SIZE MEM_MAP START_PADDR START_MAPNR", " 0 DMA 4096 c1000030 0 0", " 1 Normal 126837 c1038030 1000000 4096", " 2 HighMem 0 0 0 0", "\n Translate a page structure's flags field contents:\n", " %s> kmem -g 4080", " FLAGS: 4080", " PAGE-FLAG BIT VALUE", " PG_slab 7 0000080", " PG_head 14 0004000", " %s>", NULL }; char *help_dis[] = { "dis", "disassemble", "[-rludx][-b [num]] [address | symbol | (expression)] [count]", " This command disassembles source code instructions starting (or ending) at", " a text address that may be expressed by value, symbol or expression:\n", " -r (reverse) displays all instructions from the start of the ", " routine up to and including the designated address.", " -l displays source code line number data in addition to the ", " disassembly output.", " -u address is a user virtual address in the current context;", " otherwise the address is assumed to be a kernel virtual address.", " If this option is used, then -r and -l are ignored.", " -x override default output format with hexadecimal format.", " -d override default output format with decimal format.", " -b [num] modify the pre-calculated number of encoded bytes to skip after", " a kernel BUG (\"ud2a\") instruction; with no argument, displays", " the current number of bytes being skipped. (x86 and x86_64 only)", " address starting hexadecimal text address.", " symbol symbol of starting text address. On ppc64, the symbol", " preceded by '.' is used.", " (expression) expression evaluating to a starting text address.", " count the number of instructions to be disassembled (default is 1).", " If no count argument is entered, and the starting address", " is entered as a text symbol, then the whole routine will be", " disassembled. The count argument is ignored when used with", " the -r option.", "\nEXAMPLES", " Disassemble the sys_signal() routine without, and then with, line numbers:\n", " %s> dis sys_signal", " 0xc0112c88 <sys_signal>: push \%ebp", " 0xc0112c89 <sys_signal+1>: mov \%esp,\%ebp", " 0xc0112c8b <sys_signal+3>: sub $0x28,\%esp", " 0xc0112c8e <sys_signal+6>: mov 0xc(\%ebp),\%eax", " 0xc0112c91 <sys_signal+9>: mov \%eax,0xffffffec(\%ebp)", " 0xc0112c94 <sys_signal+12>: movl $0xc0000000,0xfffffff0(\%ebp)", " 0xc0112c9b <sys_signal+19>: lea 0xffffffd8(\%ebp),\%eax", " 0xc0112c9e <sys_signal+22>: push \%eax", " 0xc0112c9f <sys_signal+23>: lea 0xffffffec(\%ebp),\%eax", " 0xc0112ca2 <sys_signal+26>: push \%eax", " 0xc0112ca3 <sys_signal+27>: pushl 0x8(\%ebp)", " 0xc0112ca6 <sys_signal+30>: call 0xc01124b8 <do_sigaction>", " 0xc0112cab <sys_signal+35>: test \%eax,\%eax", " 0xc0112cad <sys_signal+37>: jne 0xc0112cb2 <sys_signal+42>", " 0xc0112caf <sys_signal+39>: mov 0xffffffd8(\%ebp),\%eax", " 0xc0112cb2 <sys_signal+42>: leave", " 0xc0112cb3 <sys_signal+43>: ret", " ", " %s> dis -l sys_signal", " /usr/src/linux-2.2.5/kernel/signal.c: 1074", " 0xc0112c88 <sys_signal>: push \%ebp", " 0xc0112c89 <sys_signal+1>: mov \%esp,\%ebp", " 0xc0112c8b <sys_signal+3>: sub $0x28,\%esp", " 0xc0112c8e <sys_signal+6>: mov 0xc(\%ebp),\%eax", " /usr/src/linux-2.2.5/kernel/signal.c: 1078", " 0xc0112c91 <sys_signal+9>: mov \%eax,0xffffffec(\%ebp)", " /usr/src/linux-2.2.5/kernel/signal.c: 1079", " 0xc0112c94 <sys_signal+12>: movl $0xc0000000,0xfffffff0(\%ebp)", " /usr/src/linux-2.2.5/kernel/signal.c: 1081", " 0xc0112c9b <sys_signal+19>: lea 0xffffffd8(\%ebp),\%eax", " 0xc0112c9e <sys_signal+22>: push \%eax", " 0xc0112c9f <sys_signal+23>: lea 0xffffffec(\%ebp),\%eax", " 0xc0112ca2 <sys_signal+26>: push \%eax", " 0xc0112ca3 <sys_signal+27>: pushl 0x8(\%ebp)", " 0xc0112ca6 <sys_signal+30>: call 0xc01124b8 <do_sigaction>", " /usr/src/linux-2.2.5/kernel/signal.c: 1083", " 0xc0112cab <sys_signal+35>: test \%eax,\%eax", " 0xc0112cad <sys_signal+37>: jne 0xc0112cb2 <sys_signal+42>", " 0xc0112caf <sys_signal+39>: mov 0xffffffd8(\%ebp),\%eax", " /usr/src/linux-2.2.5/kernel/signal.c: 1084", " 0xc0112cb2 <sys_signal+42>: leave", " 0xc0112cb3 <sys_signal+43>: ret", " ", " Given a return address expression of \"do_no_page+65\", find out the ", " function that do_no_page() calls by using the reverse flag:\n", " %s> dis -r (do_no_page+65)", " 0xc011ea68 <do_no_page>: push \%ebp", " 0xc011ea69 <do_no_page+1>: mov \%esp,\%ebp", " 0xc011ea6b <do_no_page+3>: push \%edi", " 0xc011ea6c <do_no_page+4>: push \%esi", " 0xc011ea6d <do_no_page+5>: push \%ebx", " 0xc011ea6e <do_no_page+6>: mov 0xc(\%ebp),\%ebx", " 0xc011ea71 <do_no_page+9>: mov 0x10(\%ebp),\%edx", " 0xc011ea74 <do_no_page+12>: mov 0x14(\%ebp),\%edi", " 0xc011ea77 <do_no_page+15>: mov 0x28(\%ebx),\%eax", " 0xc011ea7a <do_no_page+18>: test \%eax,\%eax", " 0xc011ea7c <do_no_page+20>: je 0xc011ea85 <do_no_page+29>", " 0xc011ea7e <do_no_page+22>: mov 0x18(\%eax),\%ecx", " 0xc011ea81 <do_no_page+25>: test \%ecx,\%ecx", " 0xc011ea83 <do_no_page+27>: jne 0xc011eab0 <do_no_page+72>", " 0xc011ea85 <do_no_page+29>: mov $0xffffe000,\%eax", " 0xc011ea8a <do_no_page+34>: and \%esp,\%eax", " 0xc011ea8c <do_no_page+36>: decl 0x30(\%eax)", " 0xc011ea8f <do_no_page+39>: jns 0xc011ea9a <do_no_page+50>", " 0xc011ea91 <do_no_page+41>: lock btrl $0x0,0xc022fb60", " 0xc011ea9a <do_no_page+50>: push \%edi", " 0xc011ea9b <do_no_page+51>: mov 0x18(\%ebp),\%esi", " 0xc011ea9e <do_no_page+54>: push \%esi", " 0xc011ea9f <do_no_page+55>: push \%ebx", " 0xc011eaa0 <do_no_page+56>: mov 0x8(\%ebp),\%esi", " 0xc011eaa3 <do_no_page+59>: push \%esi", " 0xc011eaa4 <do_no_page+60>: call 0xc011e9e4 <do_anonymous_page>", " 0xc011eaa9 <do_no_page+65>: jmp 0xc011eb47 <do_no_page+223>", " ", " Disassemble 10 instructions starting at user virtual address 0x81ec624:\n", " %s> dis -u 81ec624 10", " 0x81ec624: push \%ebp", " 0x81ec625: mov \%esp,\%ebp", " 0x81ec627: sub $0x18,\%esp", " 0x81ec62a: movl $0x1,0x8(\%ebp)", " 0x81ec631: mov 0x82f9040,\%eax", " 0x81ec636: mov 0x10(\%eax),\%edx", " 0x81ec639: and $0x100,\%edx", " 0x81ec63f: mov 0x14(\%eax),\%ecx", " 0x81ec642: and $0x0,\%ecx", " 0x81ec645: mov \%ecx,\%eax", " ", " Override the current decimal output radix format:\n", " %s> dis sys_read 10 -x", " 0xffffffff8001178f <sys_read>: push %r13", " 0xffffffff80011791 <sys_read+0x2>: mov %rsi,%r13", " 0xffffffff80011794 <sys_read+0x5>: push %r12", " 0xffffffff80011796 <sys_read+0x7>: mov $0xfffffffffffffff7,%r12", " 0xffffffff8001179d <sys_read+0xe>: push %rbp", " 0xffffffff8001179e <sys_read+0xf>: mov %rdx,%rbp", " 0xffffffff800117a1 <sys_read+0x12>: push %rbx", " 0xffffffff800117a2 <sys_read+0x13>: sub $0x18,%rsp", " 0xffffffff800117a6 <sys_read+0x17>: lea 0x14(%rsp),%rsi", " 0xffffffff800117ab <sys_read+0x1c>: callq 0xffffffff8000b5b4 <fget_light>", NULL }; char *help_eval[] = { "eval", "evaluate", "[-b][-l] (expression) | value", " This command evaluates an expression or numeric value, and displays its", " result in hexadecimal, decimal, octal and binary. If the resultant value", " is an integral number of gigabytes, megabytes, or kilobytes, a short-hand", " translation of the number will also be shown next to the hexadecimal", " value. If the most significant bit is set, the decimal display will show", " both unsigned and signed (negative) values. Expressions must of the format", " (x operator y), where \"x\" and \"y\" may be either numeric values or", " symbols. The list of operators are:\n", " + - & | ^ * \% / << >>\n", " Enclosing the expression within parentheses is optional except when the", " \"|\", \"<<\" or \">>\" operators are used. The single \"value\" argument may", " be a number or symbol. Number arguments must be hexadecimal or decimal.", " A leading \"0x\" identifies a number as hexadecimal, but is not required", " when obvious. Numbers may be followed by the letters \"k\" or \"K\", \"m\"", " or \"M\", and \"g\" or \"G\", which multiplies the value by a factor of 1024,", " 1 megabyte or 1 gigabyte, respectively. Numeric arguments may be preceded", " by the one's complement operator ~.", " ", " -b Indicate which bit positions in the resultant value are set.", " -l Numeric arguments are presumed to be 64-bit values, and the result", " will be expressed as a 64-bit value. (ignored on 64-bit processors)", " However, if either operand or the resultant value are 64-bit values,", " then the result will be also be expressed as a 64-bit value.", " ", " The -b and -l options must precede the expression or value arguments.", "\nEXAMPLES", " %s> eval 128m", " hexadecimal: 8000000 (128MB)", " decimal: 134217728 ", " octal: 1000000000", " binary: 00001000000000000000000000000000", " ", " %s> eval 128 * 1m", " hexadecimal: 8000000 (128MB)", " decimal: 134217728 ", " octal: 1000000000", " binary: 00001000000000000000000000000000", " ", " %s> eval (1 << 27)", " hexadecimal: 8000000 (128MB)", " decimal: 134217728 ", " octal: 1000000000", " binary: 00001000000000000000000000000000", " ", " %s> eval (1 << 32)", " hexadecimal: 100000000 (4GB)", " decimal: 4294967296", " octal: 40000000000", " binary: 0000000000000000000000000000000100000000000000000000000000000000", " ", " %s> eval -b 41dc065", " hexadecimal: 41dc065", " decimal: 69058661 ", " octal: 407340145", " binary: 00000100000111011100000001100101", " bits set: 26 20 19 18 16 15 14 6 5 2 0 ", " ", " %s> eval -lb 64g", " hexadecimal: 1000000000 (64GB)", " decimal: 68719476736", " octal: 1000000000000", " binary: 0000000000000000000000000001000000000000000000000000000000000000", " bits set: 36", NULL }; char *help_sym[] = { "sym", "translate a symbol to its virtual address, or vice-versa ", "[-l] | [-M] | [-m module] | [-p|-n] | [-q string] | [symbol | vaddr]", " This command translates a symbol to its virtual address, or a static ", " kernel virtual address to its symbol -- or to a symbol-plus-offset value,", " if appropriate. Additionally, the symbol type is shown in parentheses, ", " and if the symbol is a known text value, the file and line number are shown.\n", " -l dumps all symbols and their values.", " -M dumps the current set of module symbols.", " -m module dumps the current set of symbols for a specified module.", " -p display the target symbol and the previous symbol.", " -n display the target symbol and the next symbol.", " -q string searches for all symbols containing \"string\".", " symbol a kernel text or data symbol.", " vaddr a kernel virtual address.", " ", " If the \"symbol\", \"vaddr\" or \"string\" argument resolves to a module", " symbol, then the module name will be displayed in brackets following the", " symbol value.", "\nEXAMPLES", " Translate data symbol jiffies to its value, and vice-versa:\n", " %s> sym jiffies", " c0213ae0 (D) jiffies\n", " %s> sym c0213ae0", " c0213ae0 (D) jiffies\n", " Translate a text address to its symbolic value and source file:\n", " %s> sym c0109944", " c0109944 (T) system_call+0x34 ../linux-2.2.5/arch/i386/kernel/signal.c: 723\n", " Dump the whole symbol table:\n", " %s> sym -l", " c0100000 (T) _stext", " c0100000 (A) _text", " c0100000 (t) startup_32", " c0100000 (T) stext", " c01000a4 (t) checkCPUtype", " c0100139 (t) is486", " c0100148 (t) is386", " c01001b1 (t) L6", " c01001b3 (t) ready", " c01001b4 (t) check_x87", " c01001da (t) setup_idt", " c01001f7 (t) rp_sidt", " c0100204 (T) stack_start", " c010020c (t) int_msg", " c0100220 (t) ignore_int", " c0100242 (t) idt_descr", " c0100244 (T) idt", " c010024a (t) gdt_descr", " c010024c (T) gdt", " c0101000 (T) swapper_pg_dir", " c0102000 (T) pg0", " c0103000 (T) empty_bad_page", " c0104000 (T) empty_bad_page_table", " c0105000 (T) empty_zero_page", " ...\n", " Find all symbols containing the string \"pipe\":\n", " %s> sym -q pipe", " c010ec60 (T) sys_pipe ", " c012f660 (t) pipe_read ", " c012f7b8 (t) pipe_write ", " c012f9c0 (t) pipe_lseek ", " c012f9d0 (t) bad_pipe_r ", " c012f9dc (t) bad_pipe_w ", " c012f9e8 (t) pipe_ioctl ", " c012fa18 (t) pipe_poll ", " c012fb00 (t) pipe_release ", " c012fb48 (t) pipe_read_release ", " c012fb5c (t) pipe_write_release ", " c012fb70 (t) pipe_rdwr_release ", " c012fba0 (t) pipe_read_open ", " c012fbb0 (t) pipe_write_open ", " c012fbc0 (t) pipe_rdwr_open ", " c012fbec (t) get_pipe_inode ", " c012fcc4 (T) do_pipe ", " c023a920 (D) read_pipe_fops ", " c023a960 (D) write_pipe_fops ", " c023a9a0 (D) rdwr_pipe_fops ", " c023a9e0 (D) pipe_inode_operations ", "\n Dump the symbols of the uart401 module, both before, and then after,", " the complete set of symbols are loaded with the \"mod -s\" command:\n", " %s> sym -m uart401", " c8032000 MODULE START: uart401", " c8032138 (?) uart401intr ", " c803235c (?) attach_uart401 ", " c8032638 (?) probe_uart401 ", " c80326d4 (?) unload_uart401 ", " c8033770 MODULE END: uart401", " %s> mod -s uart401", " MODULE NAME SIZE OBJECT FILE", " c8032000 uart401 6000 /lib/modules/2.2.14/misc/uart401.o", " %s> sym -m uart401", " c8032000 MODULE START: uart401", " c8032050 (t) my_notifier_call ", " c8032084 (t) uart401_status ", " c8032098 (t) uart401_cmd ", " c80320a8 (t) uart401_read ", " c80320bc (t) uart401_write ", " c80320cc (t) uart401_input_loop ", " c8032138 (T) uart401intr ", " c8032168 (t) uart401_open ", " c80321c8 (t) uart401_close ", " c80321f4 (t) uart401_out ", " c80322ac (t) uart401_start_read ", " c80322b4 (t) uart401_end_read ", " c80322bc (t) uart401_kick ", " c80322c4 (t) uart401_buffer_status ", " c80322cc (t) enter_uart_mode ", " c803235c (T) attach_uart401 ", " c803259c (t) reset_uart401 ", " c8032638 (T) probe_uart401 ", " c80326d4 (T) unload_uart401 ", " c8032760 (T) init_module", " c80327cc (T) cleanup_module ", " c8032b00 (d) sound_notifier ", " c8032b0c (d) detected_devc ", " c8032b20 (d) std_synth_info ", " c8032bc0 (d) std_midi_synth ", " c8033600 (d) uart401_operations ", " c80336c4 (D) io ", " c80336c8 (D) irq ", " c80336e0 (b) hw_info.508 ", " c8033770 MODULE END: uart401", "\n Display the value of jiffies, along with the next and previous symbols:\n", " %s> sym -np jiffies", " c023027c (D) prof_shift", " c0230280 (D) jiffies ", " c02302a0 (D) task", "\n Translate a symbol value to its name and module:\n", " crash> sym f88878d1", " f88878d1 (t) ext3_readdir [ext3]", " crash>", NULL }; char *help_files[] = { "files", "open files", "[-d dentry] | [-R reference] [pid | taskp] ... ", " This command displays information about open files of a context.", " It prints the context's current root directory and current working", " directory, and then for each open file descriptor it prints a pointer", " to its file struct, a pointer to its dentry struct, a pointer to the", " inode, the file type, and the pathname. If no arguments are entered,", " the current context is used. The -R option, typically invoked from", " \"foreach files\", searches for references to a supplied number, address,", " or filename argument, and prints only the essential information leading", " up to and including the reference. The -d option is not context", " specific, and only shows the data requested.\n", " -d dentry given a hexadecimal dentry address, display its inode,", " super block, file type, and full pathname.", " -R reference search for references to this file descriptor number,", " filename, or dentry, inode, or file structure address.", " pid a process PID.", " taskp a hexadecimal task_struct pointer.", "\nEXAMPLES", " Display the open files of the current context:\n", " %s> files", " PID: 720 TASK: c67f2000 CPU: 1 COMMAND: \"innd\"", " ROOT: / CWD: /var/spool/news/articles", " FD FILE DENTRY INODE TYPE PATH", " 0 c6b9c740 c7cc45a0 c7c939e0 CHR /dev/null", " 1 c6b9c800 c537bb20 c54d0000 REG /var/log/news/news", " 2 c6df9600 c537b420 c5c36360 REG /var/log/news/errlog", " 3 c74182c0 c6ede260 c6da3d40 PIPE", " 4 c6df9720 c696c620 c69398c0 SOCK", " 5 c6b9cc20 c68e7000 c6938d80 SOCK", " 6 c6b9c920 c7cc45a0 c7c939e0 CHR /dev/null", " 7 c6b9c680 c58fa5c0 c58a1200 REG /var/lib/news/history", " 8 c6df9f00 c6ede760 c6da3200 PIPE", " 9 c6b9c6e0 c58fa140 c5929560 REG /var/lib/news/history.dir", " 10 c7fa9320 c7fab160 c7fafd40 CHR /dev/console", " 11 c6b9c7a0 c58fa5c0 c58a1200 REG /var/lib/news/history", " 12 c377ec60 c58fa5c0 c58a1200 REG /var/lib/news/history", " 13 c4528aa0 c58fa6c0 c52fbb00 REG /var/lib/news/history.pag", " 14 c6df9420 c68e7700 c6938360 SOCK", " 15 c6df9360 c68e7780 c6938120 SOCK", " 16 c6b9c0e0 c68e7800 c6772000 SOCK", " 17 c6b9c200 c6b5f9c0 c6b5cea0 REG /var/lib/news/active", " 21 c6b9c080 c6ede760 c6da3200 PIPE", " ", " Display the files opened by the \"crond\" daemon, which is PID 462:\n", " %s> files 462", " PID: 462 TASK: f7220000 CPU: 2 COMMAND: \"crond\"", " ROOT: / CWD: /var/spool", " FD FILE DENTRY INODE TYPE PATH", " 0 f7534ae0 f7538de0 f7518dc0 CHR /dev/console", " 1 f7368f80 f72c7a40 f72f27e0 FIFO pipe:/[1456]", " 2 f74f3c80 f72c79c0 f72f2600 FIFO pipe:/[1457]", " 3 f7368b60 f72a5be0 f74300c0 REG /var/run/crond.pid", " 4 f7534360 f73408c0 f72c2840 REG /var/log/cron", " 7 f7368ce0 f72c7940 f72f2420 FIFO pipe:/[1458]", " 8 f7295de0 f72c7940 f72f2420 FIFO pipe:/[1458]", " 21 f74f36e0 f747cdc0 f747e840 CHR /dev/null", " ", " The -R option is typically invoked from \"foreach files\". This example", " shows all tasks that have \"/dev/pts/4\" open:\n", " %s> foreach files -R pts/4", " PID: 18633 TASK: c310a000 CPU: 0 COMMAND: \"crash\"", " ROOT: / CWD: /home/CVS_pool/crash ", " FD FILE DENTRY INODE TYPE PATH", " 0 c1412850 c2cb96d0 c2cad430 CHR /dev/pts/4", " 1 c1412850 c2cb96d0 c2cad430 CHR /dev/pts/4", " 2 c1412850 c2cb96d0 c2cad430 CHR /dev/pts/4", " ", " PID: 18664 TASK: c2392000 CPU: 1 COMMAND: \"less\"", " ROOT: / CWD: /home/CVS_pool/crash ", " FD FILE DENTRY INODE TYPE PATH", " 1 c1412850 c2cb96d0 c2cad430 CHR /dev/pts/4", " 2 c1412850 c2cb96d0 c2cad430 CHR /dev/pts/4", " ", " PID: 23162 TASK: c5088000 CPU: 1 COMMAND: \"bash\"", " ROOT: / CWD: /home/CVS_pool/crash ", " FD FILE DENTRY INODE TYPE PATH", " 0 c1412850 c2cb96d0 c2cad430 CHR /dev/pts/4", " 1 c1412850 c2cb96d0 c2cad430 CHR /dev/pts/4", " 2 c1412850 c2cb96d0 c2cad430 CHR /dev/pts/4", " 255 c1412850 c2cb96d0 c2cad430 CHR /dev/pts/4", " ", " PID: 23159 TASK: c10fc000 CPU: 1 COMMAND: \"xterm\"", " ROOT: / CWD: /homes/anderson/ ", " FD FILE DENTRY INODE TYPE PATH", " 5 c1560da0 c2cb96d0 c2cad430 CHR /dev/pts/4", " ", " Display information about the dentry at address f745fd60:\n", " %s> files -d f745fd60", " DENTRY INODE SUPERBLK TYPE PATH", " f745fd60 f7284640 f73a3e00 REG /var/spool/lpd/lpd.lock", NULL }; char *help_fuser[] = { "fuser", "file users", "[pathname | inode]", " This command displays the tasks using specified files or sockets.", " Tasks will be listed that reference the file as the current working", " directory, root directory, an open file descriptor, or that mmap the", " file. If the file is held open in the kernel by the lockd server on", " behalf of a client discretionary file lock, the client hostname is", " listed.\n", " pathname the full pathname of the file.", " inode the hexadecimal inode address for the file.", "\nEXAMPLES", " Display the tasks using file /usr/lib/libkfm.so.2.0.0\n", " %s> fuser /usr/lib/libkfm.so.2.0.0", " PID TASK COMM USAGE", " 779 c5e82000 \"kwm\" mmap", " 808 c5a8e000 \"krootwm\" mmap", " 806 c5b42000 \"kfm\" mmap", " 809 c5dde000 \"kpanel\" mmap", NULL }; char *help_net[] = { "net", "network command", "[-a] [[-s | -S [-xd]] [-R ref] [pid | taskp]] [-n addr]", " Display various network related data:\n", " -a display the ARP cache.", " -s display open network socket/sock addresses, their family and type,", " and for INET and INET6 families, their source and destination", " addresses and ports.", " -S displays open network socket/sock addresses followed by a dump", " of both structures.", " -x override default output format with hexadecimal format.", " -d override default output format with decimal format.", " -n addr translates an IPv4 address expressed as a decimal or hexadecimal", " value into a standard numbers-and-dots notation.", " -R ref socket or sock address, or file descriptor.", " pid a process PID.", " taskp a hexadecimal task_struct pointer.\n", " If no arguments are entered, the list of network devices, names and IP", " addresses are displayed. The -R option, typically invoked from \"foreach net\",", " and in conjunction with the -s or -S options, searches for references to a", " socket address, sock address, or a file descriptor; if found, only the", " referenced fd/socket/sock data will be displayed.", "\nEXAMPLES", " Display the network device list:", "\n %s> net", " DEVICE NAME IP ADDRESS(ES)", " c0249f20 lo 127.0.0.1", " c7fe6d80 eth0 10.1.8.20", " ", " Dump the ARP cache:\n", " %s> net -a", " NEIGHBOUR IP ADDRESS HW TYPE HW ADDRESS DEVICE STATE", " f38d1b00 10.16.64.14 ETHER 00:16:3e:4b:a5:4a eth1 STALE", " f38d1080 0.0.0.0 UNKNOWN 00 00 00 00 00 00 lo NOARP", " f38d1bc0 10.16.71.254 ETHER 00:00:0c:07:ac:00 eth1 REACHABLE", " f38d1200 10.16.64.21 ETHER 00:16:3e:51:d8:09 eth1 REACHABLE", " ", " Display the sockets for PID 2517, using both -s and -S output formats:\n", " %s> net -s 2517", " PID: 2517 TASK: c1598000 CPU: 1 COMMAND: \"rlogin\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 3 c57375dc c1ff1850 INET:STREAM 10.1.8.20-1023 10.1.16.62-513", " ", " %s> net -S 2517", " PID: 2517 TASK: c1598000 CPU: 1 COMMAND: \"rlogin\"", " FD SOCKET SOCK", " 3 c57375dc c1ff1850", " ", " struct socket {", " state = SS_CONNECTED,", " flags = 131072,", " ops = 0xc023f820,", " inode = 0xc5737540,", " fasync_list = 0x0,", " file = 0xc58892b0,", " sk = 0xc1ff1850,", " wait = 0xc14d9ed4,", " type = 1,", " passcred = 0 '\\000',", " tli = 0 '\\000'", " }", " struct sock {", " sklist_next = 0xc1ff12f0,", " sklist_prev = 0xc216bc00,", " bind_next = 0x0,", " bind_pprev = 0xc0918448,", " daddr = 1041236234,", " rcv_saddr = 336068874,", " dport = 258,", " num = 1023,", " bound_dev_if = 0,", " next = 0x0,", " pprev = 0xc0286dd4,", " state = 1 '\\001',", " zapped = 0 '\\000',", " sport = 65283,", " family = 2,", " reuse = 0 '\\000',", " ...", " " " Translate the rcv_saddr from above into dotted-decimal notation:\n", " %s> net -n 1041236234", " 10.1.16.62", " ", " From \"foreach\", find all tasks with references to socket c08ea3cc:\n", " %s> foreach net -s -R c08ea3cc", " PID: 2184 TASK: c7026000 CPU: 1 COMMAND: \"klines.kss\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 5 c08ea3cc c50d3c80 INET:STREAM 0.0.0.0-1026 0.0.0.0-0", " ", " PID: 2200 TASK: c670a000 CPU: 1 COMMAND: \"kpanel\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 5 c08ea3cc c50d3c80 INET:STREAM 0.0.0.0-1026 0.0.0.0-0", " ", " PID: 2201 TASK: c648a000 CPU: 1 COMMAND: \"kbgndwm\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 5 c08ea3cc c50d3c80 INET:STREAM 0.0.0.0-1026 0.0.0.0-0", " ", " PID: 19294 TASK: c250a000 CPU: 0 COMMAND: \"prefdm\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 5 c08ea3cc c50d3c80 INET:STREAM 0.0.0.0-1026 0.0.0.0-0", " ", " PID: 2194 TASK: c62dc000 CPU: 1 COMMAND: \"kaudioserver\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 5 c08ea3cc c50d3c80 INET:STREAM 0.0.0.0-1026 0.0.0.0-0", " ", " PID: 2195 TASK: c6684000 CPU: 1 COMMAND: \"maudio\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 5 c08ea3cc c50d3c80 INET:STREAM 0.0.0.0-1026 0.0.0.0-0", " ", " PID: 2196 TASK: c6b58000 CPU: 1 COMMAND: \"kwmsound\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 5 c08ea3cc c50d3c80 INET:STREAM 0.0.0.0-1026 0.0.0.0-0", " ", " PID: 2197 TASK: c6696000 CPU: 0 COMMAND: \"kfm\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 5 c08ea3cc c50d3c80 INET:STREAM 0.0.0.0-1026 0.0.0.0-0", " ", " PID: 2199 TASK: c65ec000 CPU: 0 COMMAND: \"krootwm\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 5 c08ea3cc c50d3c80 INET:STREAM 0.0.0.0-1026 0.0.0.0-0", " ", " PID: 694 TASK: c1942000 CPU: 0 COMMAND: \"prefdm\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 5 c08ea3cc c50d3c80 INET:STREAM 0.0.0.0-1026 0.0.0.0-0", " ", " PID: 698 TASK: c6a2c000 CPU: 1 COMMAND: \"X\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 5 c08ea3cc c50d3c80 INET:STREAM 0.0.0.0-1026 0.0.0.0-0", " ", " PID: 2159 TASK: c4a5a000 CPU: 1 COMMAND: \"kwm\"", " FD SOCKET SOCK FAMILY:TYPE SOURCE-PORT DESTINATION-PORT", " 5 c08ea3cc c50d3c80 INET:STREAM 0.0.0.0-1026 0.0.0.0-0", " ", NULL }; char *help_waitq[] = { "waitq", "list tasks queued on a wait queue", " [ symbol ] | [ struct.member struct_addr ] | [ address ]", " This command walks the wait queue list displaying the tasks which ", " are blocked on the specified wait queue. The command differentiates", " between the old- and new-style wait queue structures used by the kernel.", " It can be invoked with the following argument types:", " ", " symbol a global symbol of a wait queue.", " struct.member struct_addr a structure name and wait queue member combination", " followed by the structure's hexadecimal address.", " address a hexadecimal wait queue pointer.", "\nEXAMPLES\n", " Find out if any tasks are blocked on the \"buffer_wait\" wait queue:\n", " %s> waitq buffer_wait", " wait queue \"buffer_wait\" (c02927f0) is empty", " ", " See who is blocked on the \"wait_chldexit\" queue of task c5496000:\n", " %s> waitq task_struct.wait_chldexit c5496000", " PID: 30879 TASK: c5496000 CPU: 0 COMMAND: \"bash\"", " ", " Display the task list waiting on a known task queue:\n", " %s> waitq c3534098", " PID: 13691 TASK: c3534000 CPU: 1 COMMAND: \"bash\"", NULL }; /* * Find out what the help request is looking for, accepting aliases as well, * and print the relevant strings from the appropriate help table. */ void cmd_usage(char *cmd, int helpflag) { char **p, *scroll_command; struct command_table_entry *cp; char buf[BUFSIZE]; FILE *scroll; int i; if (helpflag & PIPE_TO_SCROLL) { if ((scroll_command = setup_scroll_command()) && (scroll = popen(scroll_command, "w"))) fp = scroll; else scroll = NULL; } else { scroll_command = NULL; scroll = NULL; } if (STREQ(cmd, "copying")) { display_copying_info(); goto done_usage; } if (STREQ(cmd, "warranty")) { display_warranty_info(); goto done_usage; } if (STREQ(cmd, "input")) { display_input_info(); goto done_usage; } if (STREQ(cmd, "output")) { display_output_info(); goto done_usage; } if (STREQ(cmd, "all")) { display_input_info(); display_output_info(); help_init(); for (i = 0; i < pc->ncmds; i++) cmd_usage(pc->cmdlist[i], COMPLETE_HELP); display_warranty_info(); display_copying_info(); goto done_usage; } if (STREQ(cmd, "commands")) { display_commands(); goto done_usage; } if (STREQ(cmd, "README")) { display_README(); goto done_usage; } /* look up command, possibly through an alias */ for (;;) { struct alias_data *ad; cp = get_command_table_entry(cmd); if (cp != NULL) break; /* found command */ /* try for an alias */ ad = is_alias(cmd); if (ad == NULL) break; /* neither command nor alias */ cmd = ad->args[0]; cp = get_command_table_entry(cmd); } if (cp == NULL || (p = cp->help_data) == NULL) { if (helpflag & SYNOPSIS) { fprintf(fp, "No usage data for the \"%s\" command" " is available.\n", cmd); RESTART(); } if (helpflag & MUST_HELP) { if (cp || !(pc->flags & GDB_INIT)) fprintf(fp, "No help data for the \"%s\" command" " is available.\n", cmd); else if (!gdb_pass_through(concat_args(buf, 0, FALSE), NULL, GNU_RETURN_ON_ERROR)) fprintf(fp, "No help data for \"%s\" is available.\n", cmd); } goto done_usage; } p++; if (helpflag & SYNOPSIS) { p++; fprintf(fp, "Usage:\n %s ", cmd); fprintf(fp, *p, pc->program_name, pc->program_name); fprintf(fp, "\nEnter \"help %s\" for details.\n", cmd); RESTART(); } fprintf(fp, "\nNAME\n %s - ", cmd); fprintf(fp, *p, pc->program_name); fprintf(fp, "\n\nSYNOPSIS\n"); p++; fprintf(fp, " %s ", cmd); fprintf(fp, *p, pc->program_name); fprintf(fp,"\n\nDESCRIPTION\n"); p++; do { if (strstr(*p, "%") && !strstr(*p, "%s")) print_verbatim(fp, *p); else fprintf(fp, *p, pc->program_name, pc->program_name); fprintf(fp, "\n"); p++; } while (*p); fprintf(fp, "\n"); done_usage: if (scroll) { fflush(scroll); pclose(scroll); } if (scroll_command) FREEBUF(scroll_command); } static char *input_info[] = { "Interactive %s commands are gathered using the GNU readline library,", "which implements a command line history mechanism, and a command line editing", "mode.\n", "The command line history consists of a numbered list of previously run ", "commands, which can be viewed by entering \"h\" at any time. A previously", "run command can be re-executed in a number of manners:", " ", " 1. To re-execute the last command, enter \"r\" alone, or \"!!\".", " 2. Enter \"r\" followed by the number identifying the desired command.", " 3. Enter \"r\" followed by a uniquely-identifying set of characters from", " the beginning of the desired command string.", " 4. Recycle back through the command history list by hitting the up-arrow", " key until the desired command is re-displayed, and then hit <ENTER>.", " If you go too far back, hit the down-arrow key.", " ", "The command line editing mode can be set to emulate either vi or emacs.", "The mode can be set in the following manners, listed in increasing order of", "precedence:", " ", " 1. The setting of the EDITOR environment variable.", " 2. An entry in either in a .%src file, which can be located either", " in the current directory or in your home directory. The entry must", " be of the form \"set vi\" or \"set emacs\".", " 3. By use of the %s \"-e\" command line option, as in \"-e vi\" or \"-e emacs\".", " ", "To edit a previously entered command:", " ", " 1. Recycle back through the command history list until the desired command", " is re-displayed.", " 2. Edit the line using vi or emacs editing commands, as appropriate. ", " 3. Hit <ENTER>.", " ", "It should be noted that command line re-cycling may be accomplished by using", "the CTRL-p and CTRL-n keys instead of the up- and down-arrow keys; in vi mode", "you can enter <ESC>, then \"k\" to cycle back, or \"j\" to cycle forward.", " ", "A set of %s commands may be entered into a regular file that can be used as", "input, using standard command line syntax:\n", " %s> < inputfile\n", "An input file may be also be run from the %s command line using the -i ", "option:\n", " $ %s -i inputfile", "", "Alternatively, an input file containing command arguments may be created.", "The arguments in the input file will be passed to the command specified,", "which will be executed repetetively for each line of arguments in the file:", "", " %s> ps -p < inputfile", "", "Lastly, if a command is entered that is not recognized, it is checked against", "the kernel's list of variables, structure, union or typedef names, and if ", "found, the command is passed to p, struct, union or whatis. That being the ", "case, as long as a kernel variable/structure/union name is different than any", "of the current commands, the appropriate command above will be executed. If", "not, the command will be passed on to the built-in gdb command for execution.", "If an input line starts with \"#\" or \"//\", then the line will be saved", "as a comment that is visible when re-cycling through the history list.", NULL }; /* * Display information concerning command input options: history, * command recall, command-line editing, and input files. */ static void display_input_info(void) { int i; for (i = 0; input_info[i]; i++) { fprintf(fp, input_info[i], pc->program_name, pc->program_name); fprintf(fp, "\n"); } } static char *output_info[] = { "\nBy default, %s command output is piped to \"/usr/bin/less -E -X\" along", "with a prompt line. This behavior can be turned off in two ways:\n", " 1. During runtime, enter \"set scroll off\" or the alias \"sf\".", " 2. Enter \"set scroll off\" in a .%src file, which can be located either", " in the current directory or in your home directory.\n", "To restore the scrolling behavior during runtime, enter \"set scroll on\"", "or the alias: \"sn\"\n", "Command output may be piped to an external command using standard command", "line pipe syntax. For example:\n", " %s> log | grep eth0\n", "Command output may be redirected to a file using standard command line syntax.", "For example:\n", " %s> foreach bt > bt.all\n", "Use double brackets to append the output to a pre-existing file:\n", " %s> ps >> crash.data\n", "The default output radix for gdb output and certain %s commands is", "hexadecimal. This can be changed to decimal by entering \"set radix 10\"", "or the alias \"dec\". It can be reverted back to hexadecimal by entering", "\"set radix 16\" or the alias \"hex\".\n", "To execute an external shell command, precede the command with an \"!\".", "To escape to a shell, enter \"!\" alone.", " ", NULL }; /* * Display information concerning command output options. */ static void display_output_info(void) { int i; for (i = 0; output_info[i]; i++) { fprintf(fp, output_info[i], pc->program_name, pc->program_name); fprintf(fp, "\n"); } } /* * Display the program name, version, and the GPL-required stuff for * interactive programs. */ void display_version(void) { int i; if (pc->flags & SILENT) return; fprintf(fp, "\n%s %s\n", pc->program_name, pc->program_version); for (i = 0; version_info[i]; i++) fprintf(fp, "%s\n", version_info[i]); } static char *version_info[] = { "Copyright (C) 2002-2014 Red Hat, Inc.", "Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation", "Copyright (C) 1999-2006 Hewlett-Packard Co", "Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited", "Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.", "Copyright (C) 2005, 2011 NEC Corporation", "Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.", "Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.", "This program is free software, covered by the GNU General Public License,", "and you are welcome to change it and/or distribute copies of it under", "certain conditions. Enter \"help copying\" to see the conditions.", "This program has absolutely no warranty. Enter \"help warranty\" for details.", " ", NULL }; /* * "help copying" output */ static void display_copying_info(void) { int i; switch (GPL_version) { case GPLv2: for (i = 0; !strstr(gnu_public_license[i], "NO WARRANTY"); i++) fprintf(fp, "%s\n", gnu_public_license[i]); break; case GPLv3: for (i = 0; !strstr(gnu_public_license_v3[i], "15. Disclaimer of Warranty."); i++) fprintf(fp, "%s\n", gnu_public_license_v3[i]); break; } } /* * "help warranty" output */ static void display_warranty_info(void) { int i; switch (GPL_version) { case GPLv2: for (i = 0; !strstr(gnu_public_license[i], "NO WARRANTY"); i++) ; do { fprintf(fp, "%s\n", gnu_public_license[i]); } while (!strstr(gnu_public_license[i++], "END OF TERMS")); break; case GPLv3: for (i = 0; !strstr(gnu_public_license_v3[i], "15. Disclaimer of Warranty."); i++) ; while (!strstr(gnu_public_license_v3[i], "END OF TERMS")) fprintf(fp, "%s\n", gnu_public_license_v3[i++]); break; } } static char *gnu_public_license[] = { "", " GNU GENERAL PUBLIC LICENSE", " Version 2, June 1991", "", " Copyright (C) 1989, 1991 Free Software Foundation, Inc.", " 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA", " Everyone is permitted to copy and distribute verbatim copies", " of this license document, but changing it is not allowed.", "", " Preamble", "", " The licenses for most software are designed to take away your", "freedom to share and change it. By contrast, the GNU General Public", "License is intended to guarantee your freedom to share and change free", "software--to make sure the software is free for all its users. This", "General Public License applies to most of the Free Software", "Foundation's software and to any other program whose authors commit to", "using it. (Some other Free Software Foundation software is covered by", "the GNU Library General Public License instead.) You can apply it to", "your programs, too.", "", " When we speak of free software, we are referring to freedom, not", "price. Our General Public Licenses are designed to make sure that you", "have the freedom to distribute copies of free software (and charge for", "this service if you wish), that you receive source code or can get it", "if you want it, that you can change the software or use pieces of it", "in new free programs; and that you know you can do these things.", "", " To protect your rights, we need to make restrictions that forbid", "anyone to deny you these rights or to ask you to surrender the rights.", "These restrictions translate to certain responsibilities for you if you", "distribute copies of the software, or if you modify it.", "", " For example, if you distribute copies of such a program, whether", "gratis or for a fee, you must give the recipients all the rights that", "you have. You must make sure that they, too, receive or can get the", "source code. And you must show them these terms so they know their", "rights.", "", " We protect your rights with two steps: (1) copyright the software, and", "(2) offer you this license which gives you legal permission to copy,", "distribute and/or modify the software.", "", " Also, for each author's protection and ours, we want to make certain", "that everyone understands that there is no warranty for this free", "software. If the software is modified by someone else and passed on, we", "want its recipients to know that what they have is not the original, so", "that any problems introduced by others will not reflect on the original", "authors' reputations.", "", " Finally, any free program is threatened constantly by software", "patents. We wish to avoid the danger that redistributors of a free", "program will individually obtain patent licenses, in effect making the", "program proprietary. To prevent this, we have made it clear that any", "patent must be licensed for everyone's free use or not licensed at all.", "", " The precise terms and conditions for copying, distribution and", "modification follow.", "", " GNU GENERAL PUBLIC LICENSE", " TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION", "", " 0. This License applies to any program or other work which contains", "a notice placed by the copyright holder saying it may be distributed", "under the terms of this General Public License. The \"Program\", below,", "refers to any such program or work, and a \"work based on the Program\"", "means either the Program or any derivative work under copyright law:", "that is to say, a work containing the Program or a portion of it,", "either verbatim or with modifications and/or translated into another", "language. (Hereinafter, translation is included without limitation in", "the term \"modification\".) Each licensee is addressed as \"you\".", "", "Activities other than copying, distribution and modification are not", "covered by this License; they are outside its scope. The act of", "running the Program is not restricted, and the output from the Program", "is covered only if its contents constitute a work based on the", "Program (independent of having been made by running the Program).", "Whether that is true depends on what the Program does.", "", " 1. You may copy and distribute verbatim copies of the Program's", "source code as you receive it, in any medium, provided that you", "conspicuously and appropriately publish on each copy an appropriate", "copyright notice and disclaimer of warranty; keep intact all the", "notices that refer to this License and to the absence of any warranty;", "and give any other recipients of the Program a copy of this License", "along with the Program.", "", "You may charge a fee for the physical act of transferring a copy, and", "you may at your option offer warranty protection in exchange for a fee.", "", " 2. You may modify your copy or copies of the Program or any portion", "of it, thus forming a work based on the Program, and copy and", "distribute such modifications or work under the terms of Section 1", "above, provided that you also meet all of these conditions:", "", " a) You must cause the modified files to carry prominent notices", " stating that you changed the files and the date of any change.", "", " b) You must cause any work that you distribute or publish, that in", " whole or in part contains or is derived from the Program or any", " part thereof, to be licensed as a whole at no charge to all third", " parties under the terms of this License.", "", " c) If the modified program normally reads commands interactively", " when run, you must cause it, when started running for such", " interactive use in the most ordinary way, to print or display an", " announcement including an appropriate copyright notice and a", " notice that there is no warranty (or else, saying that you provide", " a warranty) and that users may redistribute the program under", " these conditions, and telling the user how to view a copy of this", " License. (Exception: if the Program itself is interactive but", " does not normally print such an announcement, your work based on", " the Program is not required to print an announcement.)", "", "These requirements apply to the modified work as a whole. If", "identifiable sections of that work are not derived from the Program,", "and can be reasonably considered independent and separate works in", "themselves, then this License, and its terms, do not apply to those", "sections when you distribute them as separate works. But when you", "distribute the same sections as part of a whole which is a work based", "on the Program, the distribution of the whole must be on the terms of", "this License, whose permissions for other licensees extend to the", "entire whole, and thus to each and every part regardless of who wrote it.", "", "Thus, it is not the intent of this section to claim rights or contest", "your rights to work written entirely by you; rather, the intent is to", "exercise the right to control the distribution of derivative or", "collective works based on the Program.", "", "In addition, mere aggregation of another work not based on the Program", "with the Program (or with a work based on the Program) on a volume of", "a storage or distribution medium does not bring the other work under", "the scope of this License.", "", " 3. You may copy and distribute the Program (or a work based on it,", "under Section 2) in object code or executable form under the terms of", "Sections 1 and 2 above provided that you also do one of the following:", "", " a) Accompany it with the complete corresponding machine-readable", " source code, which must be distributed under the terms of Sections", " 1 and 2 above on a medium customarily used for software interchange; or,", "", " b) Accompany it with a written offer, valid for at least three", " years, to give any third party, for a charge no more than your", " cost of physically performing source distribution, a complete", " machine-readable copy of the corresponding source code, to be", " distributed under the terms of Sections 1 and 2 above on a medium", " customarily used for software interchange; or,", "", " c) Accompany it with the information you received as to the offer", " to distribute corresponding source code. (This alternative is", " allowed only for noncommercial distribution and only if you", " received the program in object code or executable form with such", " an offer, in accord with Subsection b above.)", "", "The source code for a work means the preferred form of the work for", "making modifications to it. For an executable work, complete source", "code means all the source code for all modules it contains, plus any", "associated interface definition files, plus the scripts used to", "control compilation and installation of the executable. However, as a", "special exception, the source code distributed need not include", "anything that is normally distributed (in either source or binary", "form) with the major components (compiler, kernel, and so on) of the", "operating system on which the executable runs, unless that component", "itself accompanies the executable.", "", "If distribution of executable or object code is made by offering", "access to copy from a designated place, then offering equivalent", "access to copy the source code from the same place counts as", "distribution of the source code, even though third parties are not", "compelled to copy the source along with the object code.", "", " 4. You may not copy, modify, sublicense, or distribute the Program", "except as expressly provided under this License. Any attempt", "otherwise to copy, modify, sublicense or distribute the Program is", "void, and will automatically terminate your rights under this License.", "However, parties who have received copies, or rights, from you under", "this License will not have their licenses terminated so long as such", "parties remain in full compliance.", "", " 5. You are not required to accept this License, since you have not", "signed it. However, nothing else grants you permission to modify or", "distribute the Program or its derivative works. These actions are", "prohibited by law if you do not accept this License. Therefore, by", "modifying or distributing the Program (or any work based on the", "Program), you indicate your acceptance of this License to do so, and", "all its terms and conditions for copying, distributing or modifying", "the Program or works based on it.", "", " 6. Each time you redistribute the Program (or any work based on the", "Program), the recipient automatically receives a license from the", "original licensor to copy, distribute or modify the Program subject to", "these terms and conditions. You may not impose any further", "restrictions on the recipients' exercise of the rights granted herein.", "You are not responsible for enforcing compliance by third parties to", "this License.", "", " 7. If, as a consequence of a court judgment or allegation of patent", "infringement or for any other reason (not limited to patent issues),", "conditions are imposed on you (whether by court order, agreement or", "otherwise) that contradict the conditions of this License, they do not", "excuse you from the conditions of this License. If you cannot", "distribute so as to satisfy simultaneously your obligations under this", "License and any other pertinent obligations, then as a consequence you", "may not distribute the Program at all. For example, if a patent", "license would not permit royalty-free redistribution of the Program by", "all those who receive copies directly or indirectly through you, then", "the only way you could satisfy both it and this License would be to", "refrain entirely from distribution of the Program.", "", "If any portion of this section is held invalid or unenforceable under", "any particular circumstance, the balance of the section is intended to", "apply and the section as a whole is intended to apply in other", "circumstances.", "", "It is not the purpose of this section to induce you to infringe any", "patents or other property right claims or to contest validity of any", "such claims; this section has the sole purpose of protecting the", "integrity of the free software distribution system, which is", "implemented by public license practices. Many people have made", "generous contributions to the wide range of software distributed", "through that system in reliance on consistent application of that", "system; it is up to the author/donor to decide if he or she is willing", "to distribute software through any other system and a licensee cannot", "impose that choice.", "", "This section is intended to make thoroughly clear what is believed to", "be a consequence of the rest of this License.", "", " 8. If the distribution and/or use of the Program is restricted in", "certain countries either by patents or by copyrighted interfaces, the", "original copyright holder who places the Program under this License", "may add an explicit geographical distribution limitation excluding", "those countries, so that distribution is permitted only in or among", "countries not thus excluded. In such case, this License incorporates", "the limitation as if written in the body of this License.", "", " 9. The Free Software Foundation may publish revised and/or new versions", "of the General Public License from time to time. Such new versions will", "be similar in spirit to the present version, but may differ in detail to", "address new problems or concerns.", "", "Each version is given a distinguishing version number. If the Program", "specifies a version number of this License which applies to it and \"any", "later version\", you have the option of following the terms and conditions", "either of that version or of any later version published by the Free", "Software Foundation. If the Program does not specify a version number of", "this License, you may choose any version ever published by the Free Software", "Foundation.", "", " 10. If you wish to incorporate parts of the Program into other free", "programs whose distribution conditions are different, write to the author", "to ask for permission. For software which is copyrighted by the Free", "Software Foundation, write to the Free Software Foundation; we sometimes", "make exceptions for this. Our decision will be guided by the two goals", "of preserving the free status of all derivatives of our free software and", "of promoting the sharing and reuse of software generally.", "", "\n NO WARRANTY", "", " 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY", "FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN", "OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES", "PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED", "OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF", "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS", "TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE", "PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,", "REPAIR OR CORRECTION.", "", " 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING", "WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR", "REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,", "INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING", "OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED", "TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY", "YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER", "PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE", "POSSIBILITY OF SUCH DAMAGES.", "", " END OF TERMS AND CONDITIONS\n", }; static char *gnu_public_license_v3[] = { " GNU GENERAL PUBLIC LICENSE", " Version 3, 29 June 2007", "", " Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>", " Everyone is permitted to copy and distribute verbatim copies", " of this license document, but changing it is not allowed.", "", " Preamble", "", " The GNU General Public License is a free, copyleft license for", "software and other kinds of works.", "", " The licenses for most software and other practical works are designed", "to take away your freedom to share and change the works. By contrast,", "the GNU General Public License is intended to guarantee your freedom to", "share and change all versions of a program--to make sure it remains free", "software for all its users. We, the Free Software Foundation, use the", "GNU General Public License for most of our software; it applies also to", "any other work released this way by its authors. You can apply it to", "your programs, too.", "", " When we speak of free software, we are referring to freedom, not", "price. Our General Public Licenses are designed to make sure that you", "have the freedom to distribute copies of free software (and charge for", "them if you wish), that you receive source code or can get it if you", "want it, that you can change the software or use pieces of it in new", "free programs, and that you know you can do these things.", "", " To protect your rights, we need to prevent others from denying you", "these rights or asking you to surrender the rights. Therefore, you have", "certain responsibilities if you distribute copies of the software, or if", "you modify it: responsibilities to respect the freedom of others.", "", " For example, if you distribute copies of such a program, whether", "gratis or for a fee, you must pass on to the recipients the same", "freedoms that you received. You must make sure that they, too, receive", "or can get the source code. And you must show them these terms so they", "know their rights.", "", " Developers that use the GNU GPL protect your rights with two steps:", "(1) assert copyright on the software, and (2) offer you this License", "giving you legal permission to copy, distribute and/or modify it.", "", " For the developers' and authors' protection, the GPL clearly explains", "that there is no warranty for this free software. For both users' and", "authors' sake, the GPL requires that modified versions be marked as", "changed, so that their problems will not be attributed erroneously to", "authors of previous versions.", "", " Some devices are designed to deny users access to install or run", "modified versions of the software inside them, although the manufacturer", "can do so. This is fundamentally incompatible with the aim of", "protecting users' freedom to change the software. The systematic", "pattern of such abuse occurs in the area of products for individuals to", "use, which is precisely where it is most unacceptable. Therefore, we", "have designed this version of the GPL to prohibit the practice for those", "products. If such problems arise substantially in other domains, we", "stand ready to extend this provision to those domains in future versions", "of the GPL, as needed to protect the freedom of users.", "", " Finally, every program is threatened constantly by software patents.", "States should not allow patents to restrict development and use of", "software on general-purpose computers, but in those that do, we wish to", "avoid the special danger that patents applied to a free program could", "make it effectively proprietary. To prevent this, the GPL assures that", "patents cannot be used to render the program non-free.", "", " The precise terms and conditions for copying, distribution and", "modification follow.", "", " TERMS AND CONDITIONS", "", " 0. Definitions.", "", " \"This License\" refers to version 3 of the GNU General Public License.", "", " \"Copyright\" also means copyright-like laws that apply to other kinds of", "works, such as semiconductor masks.", "", " \"The Program\" refers to any copyrightable work licensed under this", "License. Each licensee is addressed as \"you\". \"Licensees\" and", "\"recipients\" may be individuals or organizations.", "", " To \"modify\" a work means to copy from or adapt all or part of the work", "in a fashion requiring copyright permission, other than the making of an", "exact copy. The resulting work is called a \"modified version\" of the", "earlier work or a work \"based on\" the earlier work.", "", " A \"covered work\" means either the unmodified Program or a work based", "on the Program.", "", " To \"propagate\" a work means to do anything with it that, without", "permission, would make you directly or secondarily liable for", "infringement under applicable copyright law, except executing it on a", "computer or modifying a private copy. Propagation includes copying,", "distribution (with or without modification), making available to the", "public, and in some countries other activities as well.", "", " To \"convey\" a work means any kind of propagation that enables other", "parties to make or receive copies. Mere interaction with a user through", "a computer network, with no transfer of a copy, is not conveying.", "", " An interactive user interface displays \"Appropriate Legal Notices\"", "to the extent that it includes a convenient and prominently visible", "feature that (1) displays an appropriate copyright notice, and (2)", "tells the user that there is no warranty for the work (except to the", "extent that warranties are provided), that licensees may convey the", "work under this License, and how to view a copy of this License. If", "the interface presents a list of user commands or options, such as a", "menu, a prominent item in the list meets this criterion.", "", " 1. Source Code.", "", " The \"source code\" for a work means the preferred form of the work", "for making modifications to it. \"Object code\" means any non-source", "form of a work.", "", " A \"Standard Interface\" means an interface that either is an official", "standard defined by a recognized standards body, or, in the case of", "interfaces specified for a particular programming language, one that", "is widely used among developers working in that language.", "", " The \"System Libraries\" of an executable work include anything, other", "than the work as a whole, that (a) is included in the normal form of", "packaging a Major Component, but which is not part of that Major", "Component, and (b) serves only to enable use of the work with that", "Major Component, or to implement a Standard Interface for which an", "implementation is available to the public in source code form. A", "\"Major Component\", in this context, means a major essential component", "(kernel, window system, and so on) of the specific operating system", "(if any) on which the executable work runs, or a compiler used to", "produce the work, or an object code interpreter used to run it.", "", " The \"Corresponding Source\" for a work in object code form means all", "the source code needed to generate, install, and (for an executable", "work) run the object code and to modify the work, including scripts to", "control those activities. However, it does not include the work's", "System Libraries, or general-purpose tools or generally available free", "programs which are used unmodified in performing those activities but", "which are not part of the work. For example, Corresponding Source", "includes interface definition files associated with source files for", "the work, and the source code for shared libraries and dynamically", "linked subprograms that the work is specifically designed to require,", "such as by intimate data communication or control flow between those", "subprograms and other parts of the work.", "", " The Corresponding Source need not include anything that users", "can regenerate automatically from other parts of the Corresponding", "Source.", "", " The Corresponding Source for a work in source code form is that", "same work.", "", " 2. Basic Permissions.", "", " All rights granted under this License are granted for the term of", "copyright on the Program, and are irrevocable provided the stated", "conditions are met. This License explicitly affirms your unlimited", "permission to run the unmodified Program. The output from running a", "covered work is covered by this License only if the output, given its", "content, constitutes a covered work. This License acknowledges your", "rights of fair use or other equivalent, as provided by copyright law.", "", " You may make, run and propagate covered works that you do not", "convey, without conditions so long as your license otherwise remains", "in force. You may convey covered works to others for the sole purpose", "of having them make modifications exclusively for you, or provide you", "with facilities for running those works, provided that you comply with", "the terms of this License in conveying all material for which you do", "not control copyright. Those thus making or running the covered works", "for you must do so exclusively on your behalf, under your direction", "and control, on terms that prohibit them from making any copies of", "your copyrighted material outside their relationship with you.", "", " Conveying under any other circumstances is permitted solely under", "the conditions stated below. Sublicensing is not allowed; section 10", "makes it unnecessary.", "", " 3. Protecting Users' Legal Rights From Anti-Circumvention Law.", "", " No covered work shall be deemed part of an effective technological", "measure under any applicable law fulfilling obligations under article", "11 of the WIPO copyright treaty adopted on 20 December 1996, or", "similar laws prohibiting or restricting circumvention of such", "measures.", "", " When you convey a covered work, you waive any legal power to forbid", "circumvention of technological measures to the extent such circumvention", "is effected by exercising rights under this License with respect to", "the covered work, and you disclaim any intention to limit operation or", "modification of the work as a means of enforcing, against the work's", "users, your or third parties' legal rights to forbid circumvention of", "technological measures.", "", " 4. Conveying Verbatim Copies.", "", " You may convey verbatim copies of the Program's source code as you", "receive it, in any medium, provided that you conspicuously and", "appropriately publish on each copy an appropriate copyright notice;", "keep intact all notices stating that this License and any", "non-permissive terms added in accord with section 7 apply to the code;", "keep intact all notices of the absence of any warranty; and give all", "recipients a copy of this License along with the Program.", "", " You may charge any price or no price for each copy that you convey,", "and you may offer support or warranty protection for a fee.", "", " 5. Conveying Modified Source Versions.", "", " You may convey a work based on the Program, or the modifications to", "produce it from the Program, in the form of source code under the", "terms of section 4, provided that you also meet all of these conditions:", "", " a) The work must carry prominent notices stating that you modified", " it, and giving a relevant date.", "", " b) The work must carry prominent notices stating that it is", " released under this License and any conditions added under section", " 7. This requirement modifies the requirement in section 4 to", " \"keep intact all notices\".", "", " c) You must license the entire work, as a whole, under this", " License to anyone who comes into possession of a copy. This", " License will therefore apply, along with any applicable section 7", " additional terms, to the whole of the work, and all its parts,", " regardless of how they are packaged. This License gives no", " permission to license the work in any other way, but it does not", " invalidate such permission if you have separately received it.", "", " d) If the work has interactive user interfaces, each must display", " Appropriate Legal Notices; however, if the Program has interactive", " interfaces that do not display Appropriate Legal Notices, your", " work need not make them do so.", "", " A compilation of a covered work with other separate and independent", "works, which are not by their nature extensions of the covered work,", "and which are not combined with it such as to form a larger program,", "in or on a volume of a storage or distribution medium, is called an", "\"aggregate\" if the compilation and its resulting copyright are not", "used to limit the access or legal rights of the compilation's users", "beyond what the individual works permit. Inclusion of a covered work", "in an aggregate does not cause this License to apply to the other", "parts of the aggregate.", "", " 6. Conveying Non-Source Forms.", "", " You may convey a covered work in object code form under the terms", "of sections 4 and 5, provided that you also convey the", "machine-readable Corresponding Source under the terms of this License,", "in one of these ways:", "", " a) Convey the object code in, or embodied in, a physical product", " (including a physical distribution medium), accompanied by the", " Corresponding Source fixed on a durable physical medium", " customarily used for software interchange.", "", " b) Convey the object code in, or embodied in, a physical product", " (including a physical distribution medium), accompanied by a", " written offer, valid for at least three years and valid for as", " long as you offer spare parts or customer support for that product", " model, to give anyone who possesses the object code either (1) a", " copy of the Corresponding Source for all the software in the", " product that is covered by this License, on a durable physical", " medium customarily used for software interchange, for a price no", " more than your reasonable cost of physically performing this", " conveying of source, or (2) access to copy the", " Corresponding Source from a network server at no charge.", "", " c) Convey individual copies of the object code with a copy of the", " written offer to provide the Corresponding Source. This", " alternative is allowed only occasionally and noncommercially, and", " only if you received the object code with such an offer, in accord", " with subsection 6b.", "", " d) Convey the object code by offering access from a designated", " place (gratis or for a charge), and offer equivalent access to the", " Corresponding Source in the same way through the same place at no", " further charge. You need not require recipients to copy the", " Corresponding Source along with the object code. If the place to", " copy the object code is a network server, the Corresponding Source", " may be on a different server (operated by you or a third party)", " that supports equivalent copying facilities, provided you maintain", " clear directions next to the object code saying where to find the", " Corresponding Source. Regardless of what server hosts the", " Corresponding Source, you remain obligated to ensure that it is", " available for as long as needed to satisfy these requirements.", "", " e) Convey the object code using peer-to-peer transmission, provided", " you inform other peers where the object code and Corresponding", " Source of the work are being offered to the general public at no", " charge under subsection 6d.", "", " A separable portion of the object code, whose source code is excluded", "from the Corresponding Source as a System Library, need not be", "included in conveying the object code work.", "", " A \"User Product\" is either (1) a \"consumer product\", which means any", "tangible personal property which is normally used for personal, family,", "or household purposes, or (2) anything designed or sold for incorporation", "into a dwelling. In determining whether a product is a consumer product,", "doubtful cases shall be resolved in favor of coverage. For a particular", "product received by a particular user, \"normally used\" refers to a", "typical or common use of that class of product, regardless of the status", "of the particular user or of the way in which the particular user", "actually uses, or expects or is expected to use, the product. A product", "is a consumer product regardless of whether the product has substantial", "commercial, industrial or non-consumer uses, unless such uses represent", "the only significant mode of use of the product.", "", " \"Installation Information\" for a User Product means any methods,", "procedures, authorization keys, or other information required to install", "and execute modified versions of a covered work in that User Product from", "a modified version of its Corresponding Source. The information must", "suffice to ensure that the continued functioning of the modified object", "code is in no case prevented or interfered with solely because", "modification has been made.", "", " If you convey an object code work under this section in, or with, or", "specifically for use in, a User Product, and the conveying occurs as", "part of a transaction in which the right of possession and use of the", "User Product is transferred to the recipient in perpetuity or for a", "fixed term (regardless of how the transaction is characterized), the", "Corresponding Source conveyed under this section must be accompanied", "by the Installation Information. But this requirement does not apply", "if neither you nor any third party retains the ability to install", "modified object code on the User Product (for example, the work has", "been installed in ROM).", "", " The requirement to provide Installation Information does not include a", "requirement to continue to provide support service, warranty, or updates", "for a work that has been modified or installed by the recipient, or for", "the User Product in which it has been modified or installed. Access to a", "network may be denied when the modification itself materially and", "adversely affects the operation of the network or violates the rules and", "protocols for communication across the network.", "", " Corresponding Source conveyed, and Installation Information provided,", "in accord with this section must be in a format that is publicly", "documented (and with an implementation available to the public in", "source code form), and must require no special password or key for", "unpacking, reading or copying.", "", " 7. Additional Terms.", "", " \"Additional permissions\" are terms that supplement the terms of this", "License by making exceptions from one or more of its conditions.", "Additional permissions that are applicable to the entire Program shall", "be treated as though they were included in this License, to the extent", "that they are valid under applicable law. If additional permissions", "apply only to part of the Program, that part may be used separately", "under those permissions, but the entire Program remains governed by", "this License without regard to the additional permissions.", "", " When you convey a copy of a covered work, you may at your option", "remove any additional permissions from that copy, or from any part of", "it. (Additional permissions may be written to require their own", "removal in certain cases when you modify the work.) You may place", "additional permissions on material, added by you to a covered work,", "for which you have or can give appropriate copyright permission.", "", " Notwithstanding any other provision of this License, for material you", "add to a covered work, you may (if authorized by the copyright holders of", "that material) supplement the terms of this License with terms:", "", " a) Disclaiming warranty or limiting liability differently from the", " terms of sections 15 and 16 of this License; or", "", " b) Requiring preservation of specified reasonable legal notices or", " author attributions in that material or in the Appropriate Legal", " Notices displayed by works containing it; or", "", " c) Prohibiting misrepresentation of the origin of that material, or", " requiring that modified versions of such material be marked in", " reasonable ways as different from the original version; or", "", " d) Limiting the use for publicity purposes of names of licensors or", " authors of the material; or", "", " e) Declining to grant rights under trademark law for use of some", " trade names, trademarks, or service marks; or", "", " f) Requiring indemnification of licensors and authors of that", " material by anyone who conveys the material (or modified versions of", " it) with contractual assumptions of liability to the recipient, for", " any liability that these contractual assumptions directly impose on", " those licensors and authors.", "", " All other non-permissive additional terms are considered \"further", "restrictions\" within the meaning of section 10. If the Program as you", "received it, or any part of it, contains a notice stating that it is", "governed by this License along with a term that is a further", "restriction, you may remove that term. If a license document contains", "a further restriction but permits relicensing or conveying under this", "License, you may add to a covered work material governed by the terms", "of that license document, provided that the further restriction does", "not survive such relicensing or conveying.", "", " If you add terms to a covered work in accord with this section, you", "must place, in the relevant source files, a statement of the", "additional terms that apply to those files, or a notice indicating", "where to find the applicable terms.", "", " Additional terms, permissive or non-permissive, may be stated in the", "form of a separately written license, or stated as exceptions;", "the above requirements apply either way.", "", " 8. Termination.", "", " You may not propagate or modify a covered work except as expressly", "provided under this License. Any attempt otherwise to propagate or", "modify it is void, and will automatically terminate your rights under", "this License (including any patent licenses granted under the third", "paragraph of section 11).", "", " However, if you cease all violation of this License, then your", "license from a particular copyright holder is reinstated (a)", "provisionally, unless and until the copyright holder explicitly and", "finally terminates your license, and (b) permanently, if the copyright", "holder fails to notify you of the violation by some reasonable means", "prior to 60 days after the cessation.", "", " Moreover, your license from a particular copyright holder is", "reinstated permanently if the copyright holder notifies you of the", "violation by some reasonable means, this is the first time you have", "received notice of violation of this License (for any work) from that", "copyright holder, and you cure the violation prior to 30 days after", "your receipt of the notice.", "", " Termination of your rights under this section does not terminate the", "licenses of parties who have received copies or rights from you under", "this License. If your rights have been terminated and not permanently", "reinstated, you do not qualify to receive new licenses for the same", "material under section 10.", "", " 9. Acceptance Not Required for Having Copies.", "", " You are not required to accept this License in order to receive or", "run a copy of the Program. Ancillary propagation of a covered work", "occurring solely as a consequence of using peer-to-peer transmission", "to receive a copy likewise does not require acceptance. However,", "nothing other than this License grants you permission to propagate or", "modify any covered work. These actions infringe copyright if you do", "not accept this License. Therefore, by modifying or propagating a", "covered work, you indicate your acceptance of this License to do so.", "", " 10. Automatic Licensing of Downstream Recipients.", "", " Each time you convey a covered work, the recipient automatically", "receives a license from the original licensors, to run, modify and", "propagate that work, subject to this License. You are not responsible", "for enforcing compliance by third parties with this License.", "", " An \"entity transaction\" is a transaction transferring control of an", "organization, or substantially all assets of one, or subdividing an", "organization, or merging organizations. If propagation of a covered", "work results from an entity transaction, each party to that", "transaction who receives a copy of the work also receives whatever", "licenses to the work the party's predecessor in interest had or could", "give under the previous paragraph, plus a right to possession of the", "Corresponding Source of the work from the predecessor in interest, if", "the predecessor has it or can get it with reasonable efforts.", "", " You may not impose any further restrictions on the exercise of the", "rights granted or affirmed under this License. For example, you may", "not impose a license fee, royalty, or other charge for exercise of", "rights granted under this License, and you may not initiate litigation", "(including a cross-claim or counterclaim in a lawsuit) alleging that", "any patent claim is infringed by making, using, selling, offering for", "sale, or importing the Program or any portion of it.", "", " 11. Patents.", "", " A \"contributor\" is a copyright holder who authorizes use under this", "License of the Program or a work on which the Program is based. The", "work thus licensed is called the contributor's \"contributor version\".", "", " A contributor's \"essential patent claims\" are all patent claims", "owned or controlled by the contributor, whether already acquired or", "hereafter acquired, that would be infringed by some manner, permitted", "by this License, of making, using, or selling its contributor version,", "but do not include claims that would be infringed only as a", "consequence of further modification of the contributor version. For", "purposes of this definition, \"control\" includes the right to grant", "patent sublicenses in a manner consistent with the requirements of", "this License.", "", " Each contributor grants you a non-exclusive, worldwide, royalty-free", "patent license under the contributor's essential patent claims, to", "make, use, sell, offer for sale, import and otherwise run, modify and", "propagate the contents of its contributor version.", "", " In the following three paragraphs, a \"patent license\" is any express", "agreement or commitment, however denominated, not to enforce a patent", "(such as an express permission to practice a patent or covenant not to", "sue for patent infringement). To \"grant\" such a patent license to a", "party means to make such an agreement or commitment not to enforce a", "patent against the party.", "", " If you convey a covered work, knowingly relying on a patent license,", "and the Corresponding Source of the work is not available for anyone", "to copy, free of charge and under the terms of this License, through a", "publicly available network server or other readily accessible means,", "then you must either (1) cause the Corresponding Source to be so", "available, or (2) arrange to deprive yourself of the benefit of the", "patent license for this particular work, or (3) arrange, in a manner", "consistent with the requirements of this License, to extend the patent", "license to downstream recipients. \"Knowingly relying\" means you have", "actual knowledge that, but for the patent license, your conveying the", "covered work in a country, or your recipient's use of the covered work", "in a country, would infringe one or more identifiable patents in that", "country that you have reason to believe are valid.", "", " If, pursuant to or in connection with a single transaction or", "arrangement, you convey, or propagate by procuring conveyance of, a", "covered work, and grant a patent license to some of the parties", "receiving the covered work authorizing them to use, propagate, modify", "or convey a specific copy of the covered work, then the patent license", "you grant is automatically extended to all recipients of the covered", "work and works based on it.", "", " A patent license is \"discriminatory\" if it does not include within", "the scope of its coverage, prohibits the exercise of, or is", "conditioned on the non-exercise of one or more of the rights that are", "specifically granted under this License. You may not convey a covered", "work if you are a party to an arrangement with a third party that is", "in the business of distributing software, under which you make payment", "to the third party based on the extent of your activity of conveying", "the work, and under which the third party grants, to any of the", "parties who would receive the covered work from you, a discriminatory", "patent license (a) in connection with copies of the covered work", "conveyed by you (or copies made from those copies), or (b) primarily", "for and in connection with specific products or compilations that", "contain the covered work, unless you entered into that arrangement,", "or that patent license was granted, prior to 28 March 2007.", "", " Nothing in this License shall be construed as excluding or limiting", "any implied license or other defenses to infringement that may", "otherwise be available to you under applicable patent law.", "", " 12. No Surrender of Others' Freedom.", "", " If conditions are imposed on you (whether by court order, agreement or", "otherwise) that contradict the conditions of this License, they do not", "excuse you from the conditions of this License. If you cannot convey a", "covered work so as to satisfy simultaneously your obligations under this", "License and any other pertinent obligations, then as a consequence you may", "not convey it at all. For example, if you agree to terms that obligate you", "to collect a royalty for further conveying from those to whom you convey", "the Program, the only way you could satisfy both those terms and this", "License would be to refrain entirely from conveying the Program.", "", " 13. Use with the GNU Affero General Public License.", "", " Notwithstanding any other provision of this License, you have", "permission to link or combine any covered work with a work licensed", "under version 3 of the GNU Affero General Public License into a single", "combined work, and to convey the resulting work. The terms of this", "License will continue to apply to the part which is the covered work,", "but the special requirements of the GNU Affero General Public License,", "section 13, concerning interaction through a network will apply to the", "combination as such.", "", " 14. Revised Versions of this License.", "", " The Free Software Foundation may publish revised and/or new versions of", "the GNU General Public License from time to time. Such new versions will", "be similar in spirit to the present version, but may differ in detail to", "address new problems or concerns.", "", " Each version is given a distinguishing version number. If the", "Program specifies that a certain numbered version of the GNU General", "Public License \"or any later version\" applies to it, you have the", "option of following the terms and conditions either of that numbered", "version or of any later version published by the Free Software", "Foundation. If the Program does not specify a version number of the", "GNU General Public License, you may choose any version ever published", "by the Free Software Foundation.", "", " If the Program specifies that a proxy can decide which future", "versions of the GNU General Public License can be used, that proxy's", "public statement of acceptance of a version permanently authorizes you", "to choose that version for the Program.", "", " Later license versions may give you additional or different", "permissions. However, no additional obligations are imposed on any", "author or copyright holder as a result of your choosing to follow a", "later version.", "", " 15. Disclaimer of Warranty.", "", " THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY", "APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT", "HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY", "OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,", "THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR", "PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM", "IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF", "ALL NECESSARY SERVICING, REPAIR OR CORRECTION.", "", " 16. Limitation of Liability.", "", " IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING", "WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS", "THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY", "GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE", "USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF", "DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD", "PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),", "EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF", "SUCH DAMAGES.", "", " 17. Interpretation of Sections 15 and 16.", "", " If the disclaimer of warranty and limitation of liability provided", "above cannot be given local legal effect according to their terms,", "reviewing courts shall apply local law that most closely approximates", "an absolute waiver of all civil liability in connection with the", "Program, unless a warranty or assumption of liability accompanies a", "copy of the Program in return for a fee.", "", " END OF TERMS AND CONDITIONS", }; #define README_CRASH_VERSION "README_CRASH_VERSION" #define README_GNU_GDB_VERSION "README_GNU_GDB_VERSION" #define README_DATE "README_DATE" #define README_GPL_INFO "README_GPL_INFO" #define README_HELP_MENU "README_HELP_MENU" #define README_ENTER_DIRECTORY "README_ENTER_DIRECTORY" #define README_MEMORY_DRIVER "README_MEMORY_DRIVER" static void display_README(void) { int i, j; time_t time_now; for (i = 0; README[i]; i++) { if (STREQ(README[i], README_CRASH_VERSION)) { fprintf(fp, " crash %s\n", pc->program_version); } else if (STREQ(README[i], README_GNU_GDB_VERSION)) { fprintf(fp, " GNU gdb %s\n", pc->gdb_version); } else if (STREQ(README[i], README_DATE)) { time(&time_now); fprintf(fp, " DATE: %s\n", strip_linefeeds(ctime(&time_now))); } else if (STREQ(README[i], README_HELP_MENU)) { display_help_screen(" "); } else if (STREQ(README[i], README_GPL_INFO)) { for (j = 0; version_info[j]; j++) fprintf(fp, " %s\n", version_info[j]); } else if (STREQ(README[i], README_ENTER_DIRECTORY)) { fprintf(fp, " $ tar -xf crash-%s.tar.gz\n", pc->program_version); fprintf(fp, " $ cd crash-%s\n", pc->program_version); } else if (STREQ(README[i], README_MEMORY_DRIVER)) { fprintf(fp, " is included in the crash-%s/memory_driver subdirectory.\n", pc->program_version); } else fprintf(fp, "%s\n", README[i]); } } static char *README[] = { "", "", " CORE ANALYSIS SUITE", "", " The core analysis suite is a self-contained tool that can be used to", " investigate either live systems, kernel core dumps created from dump", " creation facilities such as kdump, kvmdump, xendump, the netdump and", " diskdump packages offered by Red Hat, the LKCD kernel patch, the mcore", " kernel patch created by Mission Critical Linux, as well as other formats", " created by manufacturer-specific firmware.", "", " o The tool is loosely based on the SVR4 crash command, but has been", " completely integrated with gdb in order to be able to display ", " formatted kernel data structures, disassemble source code, etc.", " ", " o The current set of available commands consist of common kernel core", " analysis tools such as a context-specific stack traces, source code", " disassembly, kernel variable displays, memory display, dumps of ", " linked-lists, etc. In addition, any gdb command may be entered,", " which in turn will be passed onto the gdb module for execution. ", "", " o There are several commands that delve deeper into specific kernel", " subsystems, which also serve as templates for kernel developers", " to create new commands for analysis of a specific area of interest.", " Adding a new command is a simple affair, and a quick recompile", " adds it to the command menu.", "", " o The intent is to make the tool independent of Linux version dependencies,", " building in recognition of major kernel code changes so as to adapt to ", " new kernel versions, while maintaining backwards compatibility.", "", " A whitepaper with complete documentation concerning the use of this utility", " can be found here:", " ", " http://people.redhat.com/anderson/crash_whitepaper", " ", " These are the current prerequisites: ", "", " o At this point, x86, ia64, x86_64, ppc64, ppc, arm, arm64, alpha, s390", " and s390x-based kernels are supported. Other architectures may be", " addressed in the future.", "", " o One size fits all -- the utility can be run on any Linux kernel version", " version dating back to 2.2.5-15. A primary design goal is to always", " maintain backwards-compatibility.", "", " o In order to contain debugging data, the top-level kernel Makefile's CFLAGS", " definition must contain the -g flag. Typically distributions will contain", " a package containing a vmlinux file with full debuginfo data. If not, the", " kernel must be rebuilt:", "", " For 2.2 kernels that are not built with -g, change the following line:", "", " CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer", "", " to:", "", " CFLAGS = -g -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer", "", " For 2.4 kernels that are not built with -g, change the following line:", "", " CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing", "", " to:", "", " CFLAGS := -g $(CPPFLAGS) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing", "", " For 2.6 and later kernels that are not built with -g, the kernel should", " be configured with CONFIG_DEBUG_INFO enabled, which in turn will add", " the -g flag to the CFLAGS setting in the kernel Makefile.", " ", " After the kernel is re-compiled, the uncompressed \"vmlinux\" kernel", " that is created in the top-level kernel build directory must be saved.", "", " To build the crash utility: ", "", README_ENTER_DIRECTORY, " $ make", "", " The initial build will take several minutes because the embedded gdb module", " must be configured and and built. Alternatively, the crash source RPM file", " may be installed and built, and the resultant crash binary RPM file installed.", "", " The crash binary can only be used on systems of the same architecture as", " the host build system. There are a few optional manners of building the", " crash binary:", "", " o On an x86_64 host, a 32-bit x86 binary that can be used to analyze", " 32-bit x86 dumpfiles may be built by typing \"make target=X86\".", " o On an x86 or x86_64 host, a 32-bit x86 binary that can be used to analyze", " 32-bit arm dumpfiles may be built by typing \"make target=ARM\".", " o On an ppc64 host, a 32-bit ppc binary that can be used to analyze", " 32-bit ppc dumpfiles may be built by typing \"make target=PPC\".", " o On an x86_64 host, an x86_64 binary that can be used to analyze", " arm64 dumpfiles may be built by typing \"make target=ARM64\".", "", " Traditionally when vmcores are compressed via the makedumpfile(8) facility", " the libz compression library is used, and by default the crash utility", " only supports libz. Recently makedumpfile has been enhanced to optionally", " use either the LZO or snappy compression libraries. To build crash with", " either or both of those libraries, type \"make lzo\" or \"make snappy\".", "", " All of the alternate build commands above are \"sticky\" in that the", " special \"make\" targets only have to be entered one time; all subsequent", " builds will follow suit.", "", " If the tool is run against a kernel dumpfile, two arguments are required, the", " uncompressed kernel name and the kernel dumpfile name. ", "", " If run on a live system, only the kernel name is required, because /dev/mem ", " will be used as the \"dumpfile\". On Red Hat or Fedora kernels where the", " /dev/mem device is restricted, the /dev/crash memory driver will be used.", " If neither /dev/mem or /dev/crash are available, then /proc/kcore will be", " be used as the live memory source. If /proc/kcore is also restricted, then", " the Red Hat /dev/crash driver may be compiled and installed; its source", README_MEMORY_DRIVER, "", " If the kernel file is stored in /boot, /, /boot/efi, or in any /usr/src", " or /usr/lib/debug/lib/modules subdirectory, then no command line arguments", " are required -- the first kernel found that matches /proc/version will be", " used as the namelist.", " ", " For example, invoking crash on a live system would look like this:", "", " $ crash", " ", README_CRASH_VERSION, README_GPL_INFO, README_GNU_GDB_VERSION, " Copyright 2013 Free Software Foundation, Inc.", " License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>", " This is free software: you are free to change and redistribute it.", " There is NO WARRANTY, to the extent permitted by law. Type \"show copying\"", " and \"show warranty\" for details.", " This GDB was configured as \"i686-pc-linux-gnu\"...", " ", " KERNEL: /boot/vmlinux", " DUMPFILE: /dev/mem", " CPUS: 1", README_DATE, " UPTIME: 10 days, 22:55:18", " LOAD AVERAGE: 0.08, 0.03, 0.01", " TASKS: 42", " NODENAME: ha2.mclinux.com", " RELEASE: 2.4.0-test10", " VERSION: #11 SMP Thu Nov 4 15:09:25 EST 2000", " MACHINE: i686 (447 MHz)", " MEMORY: 128 MB", " PID: 3621 ", " COMMAND: \"crash\"", " TASK: c463c000 ", " CPU: 0", " STATE: TASK_RUNNING (ACTIVE)", "", " crash> help", README_HELP_MENU, " crash> ", " ", " When run on a dumpfile, both the kernel namelist and dumpfile must be ", " entered on the command line. For example, when run on a core dump created", " by the Red Hat netdump or diskdump facilities:", "", " $ crash vmlinux vmcore", " ", README_CRASH_VERSION, README_GPL_INFO, README_GNU_GDB_VERSION, " Copyright 2013 Free Software Foundation, Inc.", " License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>", " This is free software: you are free to change and redistribute it.", " There is NO WARRANTY, to the extent permitted by law. Type \"show copying\"", " and \"show warranty\" for details.", " This GDB was configured as \"i686-pc-linux-gnu\"...", " ", " KERNEL: vmlinux", " DUMPFILE: vmcore", " CPUS: 4", " DATE: Tue Mar 2 13:57:09 2004", " UPTIME: 00:02:40", " LOAD AVERAGE: 2.24, 0.96, 0.37", " TASKS: 70", " NODENAME: pro1.lab.boston.redhat.com", " RELEASE: 2.6.3-2.1.214.11smp", " VERSION: #1 SMP Tue Mar 2 10:58:27 EST 2004", " MACHINE: i686 (2785 Mhz)", " MEMORY: 512 MB", " PANIC: \"Oops: 0002 [#1]\" (check log for details)", " PID: 0", " COMMAND: \"swapper\"", " TASK: 22fa200 (1 of 4) [THREAD_INFO: 2356000]", " CPU: 0", " STATE: TASK_RUNNING (PANIC)", " ", " crash> ", "", " The tool's environment is context-specific. On a live system, the default", " context is the command itself; on a dump the default context will be the", " task that panicked. The most commonly-used commands are:", "", " set - set a new task context by pid, task address, or cpu.", " bt - backtrace of the current context, or as specified with arguments.", " p - print the contents of a kernel variable.", " rd - read memory, which may be either kernel virtual, user virtual, or", " physical.", " ps - simple process listing.", " log - dump the kernel log_buf.", " struct - print the contents of a structure at a specified address.", " foreach - execute a command on all tasks, or those specified, in the system.", " ", " Detailed help concerning the use of each of the commands in the menu above ", " may be displayed by entering \"help command\", where \"command\" is one of those ", " listed above. Rather than getting bogged down in details here, simply", " run the help command on each of the commands above. Note that many commands", " have multiple options so as to avoid the proliferation of command names.", "", " Command output may be piped to external commands or redirected to files.", " Enter \"help output\" for details.", "", " The command line history mechanism allows for command-line recall and ", " command-line editing. Input files containing a set of crash commands may ", " be substituted for command-line input. Enter \"help input\" for details.", "", " Note that a .crashrc file (or .<your-command-name>rc if the name has been ", " changed), may contain any number of \"set\" or \"alias\" commands -- see the", " help pages on those two commands for details.", " ", " Lastly, if a command is entered that is not recognized, it is checked", " against the kernel's list of variables, structure, union or typedef names, ", " and if found, the command is passed to \"p\", \"struct\", \"union\" or \"whatis\".", " That being the case, as long as a kernel variable/structure/union name is ", " different than any of the current commands.", "", " (1) A kernel variable can be dumped by simply entering its name:", " ", " crash> init_mm", " init_mm = $2 = {", " mmap = 0xc022d540, ", " mmap_avl = 0x0, ", " mmap_cache = 0x0, ", " pgd = 0xc0101000, ", " count = {", " counter = 0x6", " }, ", " map_count = 0x1, ", " mmap_sem = {", " count = {", " counter = 0x1", " }, ", " waking = 0x0, ", " wait = 0x0", " }, ", " context = 0x0, ", " start_code = 0xc0000000, ", " end_code = 0xc022b4c8,", " end_data = c0250388,", " ...", " ", " (2) A structure or can be dumped simply by entering its name and address: ", "", " crash> vm_area_struct c5ba3910", " struct vm_area_struct {", " vm_mm = 0xc3ae3210, ", " vm_start = 0x821b000, ", " vm_end = 0x8692000, ", " vm_next = 0xc5ba3890, ", " vm_page_prot = {", " pgprot = 0x25", " }, ", " vm_flags = 0x77, ", " vm_avl_height = 0x4, ", " vm_avl_left = 0xc0499540, ", " vm_avl_right = 0xc0499f40, ", " vm_next_share = 0xc04993c0, ", " vm_pprev_share = 0xc0499060, ", " vm_ops = 0x0, ", " vm_offset = 0x0, ", " vm_file = 0x0, ", " vm_pte = 0x0", " }", "", "", " The crash utility has been designed to facilitate the task of adding new ", " commands. New commands may be permanently compiled into the crash executable,", " or dynamically added during runtime using shared object files.", " ", " To permanently add a new command to the crash executable's menu:", "", " 1. For a command named \"xxx\", put a reference to cmd_xxx() in defs.h.", " ", " 2. Add cmd_xxx into the base_command_table[] array in global_data.c. ", "", " 3. Write cmd_xxx(), putting it in one of the appropriate files. Look at ", " the other commands for guidance on getting symbolic data, reading", " memory, displaying data, etc...", "", " 4. Recompile and run.", "", " Note that while the initial compile of crash, which configures and compiles", " the gdb module, takes several minutes, subsequent re-compiles to do such", " things as add new commands or fix bugs just takes a few seconds.", "", " Alternatively, you can create shared object library files consisting of", " crash command extensions, that can be dynamically linked into the crash", " executable during runtime or during initialization. This will allow the", " the same shared object to be used with subsequent crash releases without", " having to re-merge the command's code into each new set of crash sources.", " The dynamically linked-in commands will automatically show up in the crash", " help menu. For details, enter \"help extend\" during runtime, or enter", " \"crash -h extend\" from the shell command line.", " ", "", "", "", "", 0 };
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility