Linux Perf
unwind.h
Go to the documentation of this file.
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 perf_sample;
10 struct symbol;
11 struct thread;
12 
13 struct unwind_entry {
14  struct map *map;
15  struct symbol *sym;
16  u64 ip;
17 };
18 
19 typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
20 
22  int (*prepare_access)(struct thread *thread);
23  void (*flush_access)(struct thread *thread);
24  void (*finish_access)(struct thread *thread);
25  int (*get_entries)(unwind_entry_cb_t cb, void *arg,
26  struct thread *thread,
27  struct perf_sample *data, int max_stack);
28 };
29 
30 #ifdef HAVE_DWARF_UNWIND_SUPPORT
31 int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
32  struct thread *thread,
33  struct perf_sample *data, int max_stack);
34 /* libunwind specific */
35 #ifdef HAVE_LIBUNWIND_SUPPORT
36 #ifndef LIBUNWIND__ARCH_REG_ID
37 #define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__arch_reg_id(regnum)
38 #endif
39 
40 #ifndef LIBUNWIND__ARCH_REG_SP
41 #define LIBUNWIND__ARCH_REG_SP PERF_REG_SP
42 #endif
43 
44 #ifndef LIBUNWIND__ARCH_REG_IP
45 #define LIBUNWIND__ARCH_REG_IP PERF_REG_IP
46 #endif
47 
48 int LIBUNWIND__ARCH_REG_ID(int regnum);
49 int unwind__prepare_access(struct thread *thread, struct map *map,
50  bool *initialized);
51 void unwind__flush_access(struct thread *thread);
52 void unwind__finish_access(struct thread *thread);
53 #else
54 static inline int unwind__prepare_access(struct thread *thread __maybe_unused,
55  struct map *map __maybe_unused,
56  bool *initialized __maybe_unused)
57 {
58  return 0;
59 }
60 
61 static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
62 static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
63 #endif
64 #else
65 static inline int
67  void *arg __maybe_unused,
68  struct thread *thread __maybe_unused,
69  struct perf_sample *data __maybe_unused,
70  int max_stack __maybe_unused)
71 {
72  return 0;
73 }
74 
75 static inline int unwind__prepare_access(struct thread *thread __maybe_unused,
76  struct map *map __maybe_unused,
77  bool *initialized __maybe_unused)
78 {
79  return 0;
80 }
81 
82 static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
83 static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
84 #endif /* HAVE_DWARF_UNWIND_SUPPORT */
85 #endif /* __UNWIND_H */
static void unwind__finish_access(struct thread *thread __maybe_unused)
Definition: unwind.h:83
static int unwind__get_entries(unwind_entry_cb_t cb __maybe_unused, void *arg __maybe_unused, struct thread *thread __maybe_unused, struct perf_sample *data __maybe_unused, int max_stack __maybe_unused)
Definition: unwind.h:66
dictionary data
Definition: stat-cpi.py:4
#define LIBUNWIND__ARCH_REG_ID(regnum)
Definition: arm64.c:20
u64 ip
Definition: unwind.h:16
int(* unwind_entry_cb_t)(struct unwind_entry *entry, void *arg)
Definition: unwind.h:19
static void unwind__flush_access(struct thread *thread __maybe_unused)
Definition: unwind.h:82
Definition: thread.h:18
Definition: unwind.h:13
static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, void *arg, int max_stack)
static int entry(u64 ip, struct unwind_info *ui)
Definition: unwind-libdw.c:71
struct symbol * sym
Definition: unwind.h:15
struct map * map
Definition: unwind.h:14
Definition: jevents.c:228
Definition: symbol.h:55
static int unwind__prepare_access(struct thread *thread __maybe_unused, struct map *map __maybe_unused, bool *initialized __maybe_unused)
Definition: unwind.h:75