frame_pointer_unwinder.h 1.2 KB

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