⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ksymoops.c

📁 kdb-v4.3-2.4.20-common-1.bz2 键盘的驱动啊 克里斯蒂警方可死了地方军
💻 C
📖 第 1 页 / 共 2 页
字号:
	    options->system_map = optarg;	    ++spec_m;	    break;	case 'M':	    options->system_map = NULL;	    ++spec_M;	    break;	case 's':	    options->save_system_map = optarg;	    ++spec_s;	    break;	case 'e':	    options->endianess = !options->endianess;	    break;	case '1':	    options->one_shot = !options->one_shot;	    break;	case 'x':	    options->hex = !options->hex;	    break;	case 'S':	    options->short_lines = !options->short_lines;	    break;	case 'i':	    options->ignore_insmod_path = !options->ignore_insmod_path;	    break;	case 'I':	    options->ignore_insmod_all = !options->ignore_insmod_all;	    break;	case 'T':	    options->truncate = atoi(optarg);	    if (options->truncate >= 8*sizeof(addr_t) || options->truncate <= 0) {		options->truncate = 0;		truncate_mask = ~(addr_t)0;	    }	    else {		truncate_mask = (~(addr_t)0) >> (8*sizeof(addr_t)-options->truncate);	    }	    break;	case 'h':	    usage();	    ++*spec_h;	    break;	case 'd':	    ++debug;	    break;	case 't':	    options->target = optarg;	    break;	case 'a':	    options->architecture = optarg;	    break;	case 'A':	    adhoc_addresses(options, optarg);	    break;	case '?':	    if (c == 'c')		printf("Option -c is obsolete, use -e toggle instead\n");	    usage();	    exit(2);	}    }    options->filecount = argc - optind;    options->filename = argv + optind;    if (options->adhoc_addresses && !options->filecount) {	static char *null = "/dev/null";	static char **null_list = { &null };	options->filecount = 1;	options->filename = null_list;    }    /* Expand any requests for the current uname values */    convert_uname(&options->vmlinux);    if (options->objects) {	for (i = 0; i < options->objects; ++i)	    convert_uname(options->object+i);    }    convert_uname(&options->ksyms);    convert_uname(&options->lsmod);    convert_uname(&options->system_map);    /* Check for multiple options specified */    multi_opt(spec_v, spec_V, 'v', options->vmlinux);    multi_opt(spec_o, spec_O, 'o', options->object ? *options->object : NULL);    multi_opt(spec_k, spec_K, 'k', options->ksyms);    multi_opt(spec_l, spec_L, 'l', options->lsmod);    multi_opt(spec_m, spec_M, 'm', options->system_map);    printf("ksymoops %s", VERSION);    if (uname(&buf) == 0)	printf(" on %s %s", buf.machine, buf.release);    printf(".  Options used\n");    printf("    ");    if (options->vmlinux)	printf(" -v %s", options->vmlinux);    else	printf(" -V");    spec_or_default(spec_v || spec_V, &some_spec);    printf("    ");    if (options->ksyms)	printf(" -k %s", options->ksyms);    else	printf(" -K");    spec_or_default(spec_k || spec_K, &some_spec);    printf("    ");    if (options->lsmod)	printf(" -l %s", options->lsmod);    else	printf(" -L");    spec_or_default(spec_l || spec_L, &some_spec);    printf("    ");    if (options->objects) {	for (i = 0; i < options->objects; ++i)	    printf(" -o %s", (options->object)[i]);    }    else	printf(" -O");    spec_or_default(spec_o || spec_O, &some_spec);    printf("    ");    if (options->system_map)	printf(" -m %s", options->system_map);    else	printf(" -M");    spec_or_default(spec_m || spec_M, &some_spec);    /* Toggles on one line */    before = "    ";    if (!options->short_lines) {	printf("%s -S", before);	before = "";    }    if (options->endianess) {	printf("%s -e", before);	before = "";    }    if (!options->hex) {	printf("%s -x", before);	before = "";    }    if (options->one_shot) {	printf("%s -1", before);	before = "";    }    if (options->ignore_insmod_path) {	printf("%s -i", before);	before = "";    }    if (options->ignore_insmod_all) {	printf("%s -I", before);	before = "";    }    if (!*before)	printf("\n");    before = "    ";    if (options->truncate) {	printf("%s -T %d", before, options->truncate);	before = "";    }    if (!*before)	printf("\n");    /* Target and architecture on one line */    before = "    ";    if (options->target) {	printf("%s -t %s", before, options->target);	before = "";    }    if (options->architecture) {	printf("%s -a %s", before, options->architecture);	before = "";    }    if (!*before)	printf("\n");    printf("\n");    if (!some_spec) {	/* special warning, no procname */	++warnings;	WARNING_E("%s","Warning: You did not tell me where to find symbol information.  I will\n""assume that the log matches the kernel and modules that are running\n""right now and I'll use the default options above for symbol resolution.\n""If the current kernel and/or modules do not match the log, you can get\n""more accurate output by telling me the kernel version and where to find\n""map, modules, ksyms etc.  ksymoops -h explains the options.\n"	    );    }}/* Read environment variables */static void read_env(const char *external, char **internal){    char *p;    static char const procname[] = "read_env";    if ((p = getenv(external))) {	*internal = p;	DEBUG(1, "override %s=%s", external, *internal);    }    else	DEBUG(1, "default %s=%s", external, *internal);}/* Print the available target and architectures. */static void print_available_ta(const struct options *options){    const char **list, **one;    if (options->target && strcmp(options->target, "?") == 0) {	printf("Targets supported by your libbfd\n");	list = one = bfd_target_list();	if (!list || !*list)	    printf("    None, oh dear\n");	else while (*one)	    printf("    %s\n", *one++);	free(list);    }    if (options->architecture && strcmp(options->architecture, "?") == 0) {	printf("Architectures supported by your libbfd\n");	list = one = bfd_arch_list();	if (!list || !*list)	    printf("    None, oh dear\n");	else while (*one)	    printf("    %s\n", *one++);	free(list);    }    printf("Note that the above list comes from libbfd.  I have to assume that your\n""other binutils libraries (libiberty, libopcodes) and binutils programs\n""(nm and objdump) are in sync with libbfd.\n"    );}/* Do all the hard work of reading the symbol sources */void read_symbol_sources(const OPTIONS *options){    int i;    read_vmlinux(options);    read_ksyms(options);    /* No point in reading modules unless ksyms shows modules loaded */    if (ss_ksyms_modules) {	expand_objects(options);	for (i = 0; i < ss_objects; ++i)	    read_object(ss_object[i]->source, i, options);    }    else if (options->objects)	printf("No modules in ksyms, skipping objects\n");    /* No point in reading lsmod without ksyms */    if (ss_ksyms_modules || ss_ksyms_base.used)	read_lsmod(options);    else if (options->lsmod)	printf("No ksyms, skipping lsmod\n");    read_system_map(options);    merge_maps(options);}int main(int argc, char **argv){    int spec_h = 0;     /* -h was specified */    int ret;    struct options options = {	NULL,   /* vmlinux */	NULL,   /* object */	0,	/* objects */	NULL,   /* ksyms */	NULL,   /* lsmod */	NULL,   /* system_map */	NULL,   /* save_system_map */	NULL,   /* filename */	0,	/* filecount */	1,	/* short_lines */	0,	/* endianess */	1,	/* hex */	0,	/* one_shot */	0,	/* ignore_insmod_path */	0,	/* ignore_insmod_all */	0,	/* truncate */	NULL,   /* target */	NULL,   /* architecture */	NULL,   /* addresses */	0	/* address_bits */    };    static char const procname[] = "main";    prefix = *argv;    setvbuf(stdout, NULL, _IONBF, 0);#ifdef DEF_VMLINUX    options.vmlinux = DEF_VMLINUX;#endif#ifdef DEF_KSYMS    options.ksyms = DEF_KSYMS;#endif#ifdef DEF_LSMOD    options.lsmod = DEF_LSMOD;#endif#ifdef DEF_OBJECTS    {	char *p;	options.object = realloc(options.object,	    (options.objects+1)*sizeof(*options.object));	if (!options.object)	    malloc_error("DEF_OBJECTS");	if (!(p = strdup(DEF_OBJECTS)))	    malloc_error("DEF_OBJECTS");	else	    options.object[options.objects++] = p;    }#endif#ifdef DEF_MAP    options.system_map = DEF_MAP;#endif#ifdef DEF_TARGET    options.target = DEF_TARGET;    {	int target_byteorder;	if (strstr(options.target, "-big"))	    target_byteorder = __BIG_ENDIAN;	else if (strstr(options.target, "-little"))	    target_byteorder = __LITTLE_ENDIAN;	else	    target_byteorder = __BYTE_ORDER;	if (target_byteorder != __BYTE_ORDER)	    options.endianess = 1;    }#endif#ifdef DEF_ARCH    options.architecture = DEF_ARCH;#endif    /* Not all include files define __u16, __u32, __u64 so do it the hard way.     * Any decent optimizing compiler will discard these tests at compile time     * unless there is a problem.     */    if (sizeof(U16) != 2)	FATAL("%s", "sizeof(U16) != 2");    if (sizeof(U32) != 4)	FATAL("%s", "sizeof(U32) != 4");    if (sizeof(U64) != 8)	FATAL("%s", "sizeof(U64) != 8");    parse(argc, argv, &options, &spec_h);    if (spec_h && options.filecount == 0)	return(0);  /* just the help text */    bfd_init();    if ((options.target && strcmp(options.target, "?") == 0) ||	(options.architecture && strcmp(options.architecture, "?") == 0)) {	print_available_ta(&options);	return(0);  /* just the available target/architecture */    }    if (errors)	return(1);    DEBUG(1, "level %d", debug);    read_env("KSYMOOPS_NM", &path_nm);    read_env("KSYMOOPS_FIND", &path_find);    read_env("KSYMOOPS_OBJDUMP", &path_objdump);    re_compile_common();    ss_init_common();    if (!options.one_shot)	read_symbol_sources(&options);    /* After all that work, it is finally time to read the Oops report */    ret = Oops_read(&options);    if (warnings || errors) {	printf("\n");	if (warnings)	    printf("%d warning%s ",		   warnings, warnings == 1 ? "" : "s");	if (warnings && errors)	    printf("and ");	if (errors)	    printf("%d error%s ", errors, errors == 1 ? "" : "s");	printf("issued.  Results may not be reliable.\n");	if (!ret)	    return(1);    }    return(ret);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -