rcu: Make non-preemptive schedule be Tasks RCU quiescent state
[linux/fpc-iii.git] / tools / perf / builtin-kallsyms.c
blob224bfc454b4aa53d049e642dfc9feeadb1b37165
1 /*
2 * builtin-kallsyms.c
4 * Builtin command: Look for a symbol in the running kernel and its modules
6 * Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
8 * Released under the GPL v2. (and only v2, not any later version)
9 */
10 #include "builtin.h"
11 #include <linux/compiler.h>
12 #include <subcmd/parse-options.h>
13 #include "debug.h"
14 #include "machine.h"
15 #include "symbol.h"
17 static int __cmd_kallsyms(int argc, const char **argv)
19 int i;
20 struct machine *machine = machine__new_kallsyms();
22 if (machine == NULL) {
23 pr_err("Couldn't read /proc/kallsyms\n");
24 return -1;
27 for (i = 0; i < argc; ++i) {
28 struct map *map;
29 struct symbol *symbol = machine__find_kernel_function_by_name(machine, argv[i], &map);
31 if (symbol == NULL) {
32 printf("%s: not found\n", argv[i]);
33 continue;
36 printf("%s: %s %s %#" PRIx64 "-%#" PRIx64 " (%#" PRIx64 "-%#" PRIx64")\n",
37 symbol->name, map->dso->short_name, map->dso->long_name,
38 map->unmap_ip(map, symbol->start), map->unmap_ip(map, symbol->end),
39 symbol->start, symbol->end);
42 machine__delete(machine);
43 return 0;
46 int cmd_kallsyms(int argc, const char **argv, const char *prefix __maybe_unused)
48 const struct option options[] = {
49 OPT_INCR('v', "verbose", &verbose, "be more verbose (show counter open errors, etc)"),
50 OPT_END()
52 const char * const kallsyms_usage[] = {
53 "perf kallsyms [<options>] symbol_name",
54 NULL
57 argc = parse_options(argc, argv, options, kallsyms_usage, 0);
58 if (argc < 1)
59 usage_with_options(kallsyms_usage, options);
61 symbol_conf.sort_by_name = true;
62 symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
63 if (symbol__init(NULL) < 0)
64 return -1;
66 return __cmd_kallsyms(argc, argv);