| 6 | #define BASE_PROFILER_CHROME_UNWINDER_ANDROID_H_ |
| 7 |
| 8 | #include "base/profiler/unwinder.h" |
| 9 |
| 10 | #include "base/base_export.h" |
| 11 | #include "base/optional.h" |
| 12 | #include "base/profiler/arm_cfi_table.h" |
| 13 | #include "base/profiler/module_cache.h" |
| 14 | #include "base/profiler/register_context.h" |
| 15 |
| 16 | namespace base { |
| 17 |
| 18 | // Chrome unwinder implementation for Android, using ArmCfiTable. |
| 19 | class BASE_EXPORT ChromeUnwinderAndroid : public Unwinder { |
| 20 | public: |
| 21 | ChromeUnwinderAndroid(const ArmCFITable* cfi_table, |
| 22 | const ModuleCache::Module* chrome_module); |
| 23 | ~ChromeUnwinderAndroid() override; |
| 24 | ChromeUnwinderAndroid(const ChromeUnwinderAndroid&) = delete; |
| 25 | ChromeUnwinderAndroid& operator=(const ChromeUnwinderAndroid&) = delete; |
| 26 |
| 27 | // Unwinder: |
| 28 | bool CanUnwindFrom(const Frame& current_frame) const override; |
| 29 | UnwindResult TryUnwind(RegisterContext* thread_context, |
| 30 | uintptr_t stack_top, |
| 31 | ModuleCache* module_cache, |
| 32 | std::vector<Frame>* stack) const override; |
| 33 |
| 34 | static bool StepForTesting(RegisterContext* thread_context, |
| 35 | uintptr_t stack_top, |
| 36 | const ArmCFITable::FrameEntry& entry) { |
| 37 | return Step(thread_context, stack_top, entry); |
| 38 | } |
| 39 |
| 40 | private: |
| 41 | static bool Step(RegisterContext* thread_context, |
| 42 | uintptr_t stack_top, |
| 43 | const ArmCFITable::FrameEntry& entry); |
| 44 |
| 45 | const ArmCFITable* cfi_table_; |
| 46 | const ModuleCache::Module* const chrome_module_; |
| 47 | }; |
| 48 |
| 49 | } // namespace base |
| 50 |
| 51 | #endif // BASE_PROFILER_CHROME_UNWINDER_ANDROID_H_ |
| 52 |