~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/util/unwind-libunwind.c

Version: ~ [ linux-5.4-rc3 ] ~ [ linux-5.3.6 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.79 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.149 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.196 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.196 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.75 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #include "unwind.h"
  2 #include "thread.h"
  3 #include "session.h"
  4 #include "debug.h"
  5 #include "arch/common.h"
  6 
  7 struct unwind_libunwind_ops __weak *local_unwind_libunwind_ops;
  8 struct unwind_libunwind_ops __weak *x86_32_unwind_libunwind_ops;
  9 struct unwind_libunwind_ops __weak *arm64_unwind_libunwind_ops;
 10 
 11 static void unwind__register_ops(struct thread *thread,
 12                           struct unwind_libunwind_ops *ops)
 13 {
 14         thread->unwind_libunwind_ops = ops;
 15 }
 16 
 17 int unwind__prepare_access(struct thread *thread, struct map *map,
 18                            bool *initialized)
 19 {
 20         const char *arch;
 21         enum dso_type dso_type;
 22         struct unwind_libunwind_ops *ops = local_unwind_libunwind_ops;
 23         int err;
 24 
 25         if (thread->addr_space) {
 26                 pr_debug("unwind: thread map already set, dso=%s\n",
 27                          map->dso->name);
 28                 if (initialized)
 29                         *initialized = true;
 30                 return 0;
 31         }
 32 
 33         /* env->arch is NULL for live-mode (i.e. perf top) */
 34         if (!thread->mg->machine->env || !thread->mg->machine->env->arch)
 35                 goto out_register;
 36 
 37         dso_type = dso__type(map->dso, thread->mg->machine);
 38         if (dso_type == DSO__TYPE_UNKNOWN)
 39                 return 0;
 40 
 41         arch = normalize_arch(thread->mg->machine->env->arch);
 42 
 43         if (!strcmp(arch, "x86")) {
 44                 if (dso_type != DSO__TYPE_64BIT)
 45                         ops = x86_32_unwind_libunwind_ops;
 46         } else if (!strcmp(arch, "arm64") || !strcmp(arch, "arm")) {
 47                 if (dso_type == DSO__TYPE_64BIT)
 48                         ops = arm64_unwind_libunwind_ops;
 49         }
 50 
 51         if (!ops) {
 52                 pr_err("unwind: target platform=%s is not supported\n", arch);
 53                 return -1;
 54         }
 55 out_register:
 56         unwind__register_ops(thread, ops);
 57 
 58         err = thread->unwind_libunwind_ops->prepare_access(thread);
 59         if (initialized)
 60                 *initialized = err ? false : true;
 61         return err;
 62 }
 63 
 64 void unwind__flush_access(struct thread *thread)
 65 {
 66         if (thread->unwind_libunwind_ops)
 67                 thread->unwind_libunwind_ops->flush_access(thread);
 68 }
 69 
 70 void unwind__finish_access(struct thread *thread)
 71 {
 72         if (thread->unwind_libunwind_ops)
 73                 thread->unwind_libunwind_ops->finish_access(thread);
 74 }
 75 
 76 int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
 77                          struct thread *thread,
 78                          struct perf_sample *data, int max_stack)
 79 {
 80         if (thread->unwind_libunwind_ops)
 81                 return thread->unwind_libunwind_ops->get_entries(cb, arg, thread, data, max_stack);
 82         return 0;
 83 }
 84 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp