]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h
MFV r353615: 9485 Optimize possible split block search space
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / Process / Utility / UnwindMacOSXFrameBackchain.h
1 //===-- UnwindMacOSXFrameBackchain.h ----------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef lldb_UnwindMacOSXFrameBackchain_h_
10 #define lldb_UnwindMacOSXFrameBackchain_h_
11
12 #include <vector>
13
14 #include "lldb/Target/Unwind.h"
15 #include "lldb/lldb-private.h"
16
17 class UnwindMacOSXFrameBackchain : public lldb_private::Unwind {
18 public:
19   UnwindMacOSXFrameBackchain(lldb_private::Thread &thread);
20
21   ~UnwindMacOSXFrameBackchain() override = default;
22
23 protected:
24   void DoClear() override { m_cursors.clear(); }
25
26   uint32_t DoGetFrameCount() override;
27
28   bool DoGetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa,
29                              lldb::addr_t &pc) override;
30
31   lldb::RegisterContextSP
32   DoCreateRegisterContextForFrame(lldb_private::StackFrame *frame) override;
33
34   friend class RegisterContextMacOSXFrameBackchain;
35
36   struct Cursor {
37     lldb::addr_t pc; // Program counter
38     lldb::addr_t fp; // Frame pointer for us with backchain
39   };
40
41 private:
42   std::vector<Cursor> m_cursors;
43
44   size_t GetStackFrameData_i386(const lldb_private::ExecutionContext &exe_ctx);
45
46   size_t
47   GetStackFrameData_x86_64(const lldb_private::ExecutionContext &exe_ctx);
48
49   // For UnwindMacOSXFrameBackchain only
50   DISALLOW_COPY_AND_ASSIGN(UnwindMacOSXFrameBackchain);
51 };
52
53 #endif // lldb_UnwindMacOSXFrameBackchain_h_