1 // Copyright 2021 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_PROFILER_FRAME_POINTER_UNWINDER_H_ 6 #define BASE_PROFILER_FRAME_POINTER_UNWINDER_H_ 7 8 #include <vector> 9 10 #include "base/base_export.h" 11 #include "base/profiler/unwinder.h" 12 #include "build/build_config.h" 13 14 #if BUILDFLAG(IS_APPLE) 15 #include <os/availability.h> 16 #endif 17 18 namespace base { 19 20 // Native unwinder implementation for platforms that have frame pointers: 21 // * iOS, ARM64 and X86_64, 22 // * macOS 23 // * ChromeOS X86_64 and ARM64 24 class BASE_EXPORT 25 #if BUILDFLAG(IS_APPLE) 26 API_AVAILABLE(ios(12)) 27 #endif 28 FramePointerUnwinder : public Unwinder { 29 public: 30 FramePointerUnwinder(); 31 32 FramePointerUnwinder(const FramePointerUnwinder&) = delete; 33 FramePointerUnwinder& operator=(const FramePointerUnwinder&) = delete; 34 35 // Unwinder: 36 bool CanUnwindFrom(const Frame& current_frame) const override; 37 UnwindResult TryUnwind(RegisterContext* thread_context, 38 uintptr_t stack_top, 39 std::vector<Frame>* stack) override; 40 }; 41 42 } // namespace base 43 44 #endif // BASE_PROFILER_FRAME_POINTER_UNWINDER_H_ 45