root/tools/perf/util/unwind.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. unwind__prepare_access
  2. unwind__flush_access
  3. unwind__finish_access
  4. unwind__get_entries
  5. unwind__prepare_access
  6. unwind__flush_access
  7. unwind__finish_access

   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 #ifndef __UNWIND_H
   3 #define __UNWIND_H
   4 
   5 #include <linux/compiler.h>
   6 #include <linux/types.h>
   7 
   8 struct map;
   9 struct map_groups;
  10 struct perf_sample;
  11 struct symbol;
  12 struct thread;
  13 
  14 struct unwind_entry {
  15         struct map      *map;
  16         struct symbol   *sym;
  17         u64             ip;
  18 };
  19 
  20 typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
  21 
  22 struct unwind_libunwind_ops {
  23         int (*prepare_access)(struct map_groups *mg);
  24         void (*flush_access)(struct map_groups *mg);
  25         void (*finish_access)(struct map_groups *mg);
  26         int (*get_entries)(unwind_entry_cb_t cb, void *arg,
  27                            struct thread *thread,
  28                            struct perf_sample *data, int max_stack);
  29 };
  30 
  31 #ifdef HAVE_DWARF_UNWIND_SUPPORT
  32 int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
  33                         struct thread *thread,
  34                         struct perf_sample *data, int max_stack);
  35 /* libunwind specific */
  36 #ifdef HAVE_LIBUNWIND_SUPPORT
  37 #ifndef LIBUNWIND__ARCH_REG_ID
  38 #define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__arch_reg_id(regnum)
  39 #endif
  40 
  41 #ifndef LIBUNWIND__ARCH_REG_SP
  42 #define LIBUNWIND__ARCH_REG_SP PERF_REG_SP
  43 #endif
  44 
  45 #ifndef LIBUNWIND__ARCH_REG_IP
  46 #define LIBUNWIND__ARCH_REG_IP PERF_REG_IP
  47 #endif
  48 
  49 int LIBUNWIND__ARCH_REG_ID(int regnum);
  50 int unwind__prepare_access(struct map_groups *mg, struct map *map,
  51                            bool *initialized);
  52 void unwind__flush_access(struct map_groups *mg);
  53 void unwind__finish_access(struct map_groups *mg);
  54 #else
  55 static inline int unwind__prepare_access(struct map_groups *mg __maybe_unused,
  56                                          struct map *map __maybe_unused,
  57                                          bool *initialized __maybe_unused)
  58 {
  59         return 0;
  60 }
  61 
  62 static inline void unwind__flush_access(struct map_groups *mg __maybe_unused) {}
  63 static inline void unwind__finish_access(struct map_groups *mg __maybe_unused) {}
  64 #endif
  65 #else
  66 static inline int
  67 unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
  68                     void *arg __maybe_unused,
  69                     struct thread *thread __maybe_unused,
  70                     struct perf_sample *data __maybe_unused,
  71                     int max_stack __maybe_unused)
  72 {
  73         return 0;
  74 }
  75 
  76 static inline int unwind__prepare_access(struct map_groups *mg __maybe_unused,
  77                                          struct map *map __maybe_unused,
  78                                          bool *initialized __maybe_unused)
  79 {
  80         return 0;
  81 }
  82 
  83 static inline void unwind__flush_access(struct map_groups *mg __maybe_unused) {}
  84 static inline void unwind__finish_access(struct map_groups *mg __maybe_unused) {}
  85 #endif /* HAVE_DWARF_UNWIND_SUPPORT */
  86 #endif /* __UNWIND_H */

/* [<][>][^][v][top][bottom][index][help] */