1 #include "unwind.h" 2 #include "thread.h" 3 4 struct unwind_libunwind_ops __weak *local_unwind_libunwind_ops; 5 6 static void unwind__register_ops(struct thread *thread, 7 struct unwind_libunwind_ops *ops) 8 { 9 thread->unwind_libunwind_ops = ops; 10 } 11 12 int unwind__prepare_access(struct thread *thread) 13 { 14 unwind__register_ops(thread, local_unwind_libunwind_ops); 15 16 return thread->unwind_libunwind_ops->prepare_access(thread); 17 } 18 19 void unwind__flush_access(struct thread *thread) 20 { 21 if (thread->unwind_libunwind_ops) 22 thread->unwind_libunwind_ops->flush_access(thread); 23 } 24 25 void unwind__finish_access(struct thread *thread) 26 { 27 if (thread->unwind_libunwind_ops) 28 thread->unwind_libunwind_ops->finish_access(thread); 29 } 30 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 { 35 if (thread->unwind_libunwind_ops) 36 return thread->unwind_libunwind_ops->get_entries(cb, arg, thread, data, max_stack); 37 return 0; 38 } 39