xref: /openbsd-src/gnu/llvm/lldb/source/Plugins/Process/Utility/HistoryUnwind.h (revision dda2819751e49c83612958492e38917049128b41)
1061da546Spatrick //===-- HistoryUnwind.h -----------------------------------------*- C++ -*-===//
2061da546Spatrick //
3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information.
5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6061da546Spatrick //
7061da546Spatrick //===----------------------------------------------------------------------===//
8061da546Spatrick 
9*dda28197Spatrick #ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYUNWIND_H
10*dda28197Spatrick #define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYUNWIND_H
11061da546Spatrick 
12061da546Spatrick #include <vector>
13061da546Spatrick 
14061da546Spatrick #include "lldb/Target/Unwind.h"
15061da546Spatrick #include "lldb/lldb-private.h"
16061da546Spatrick 
17061da546Spatrick namespace lldb_private {
18061da546Spatrick 
19061da546Spatrick class HistoryUnwind : public lldb_private::Unwind {
20061da546Spatrick public:
21*dda28197Spatrick   HistoryUnwind(Thread &thread, std::vector<lldb::addr_t> pcs,
22*dda28197Spatrick                 bool pcs_are_call_addresses = false);
23061da546Spatrick 
24061da546Spatrick   ~HistoryUnwind() override;
25061da546Spatrick 
26061da546Spatrick protected:
27061da546Spatrick   void DoClear() override;
28061da546Spatrick 
29061da546Spatrick   lldb::RegisterContextSP
30061da546Spatrick   DoCreateRegisterContextForFrame(StackFrame *frame) override;
31061da546Spatrick 
32061da546Spatrick   bool DoGetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa,
33061da546Spatrick                              lldb::addr_t &pc,
34061da546Spatrick                              bool &behaves_like_zeroth_frame) override;
35061da546Spatrick   uint32_t DoGetFrameCount() override;
36061da546Spatrick 
37061da546Spatrick private:
38061da546Spatrick   std::vector<lldb::addr_t> m_pcs;
39*dda28197Spatrick   /// This boolean indicates that the PCs in the non-0 frames are call
40*dda28197Spatrick   /// addresses and not return addresses.
41*dda28197Spatrick   bool m_pcs_are_call_addresses;
42061da546Spatrick };
43061da546Spatrick 
44061da546Spatrick } // namespace lldb_private
45061da546Spatrick 
46*dda28197Spatrick #endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYUNWIND_H
47