LLDB mainline
FuncUnwinders.h
Go to the documentation of this file.
1#ifndef LLDB_SYMBOL_FUNCUNWINDERS_H
2#define LLDB_SYMBOL_FUNCUNWINDERS_H
3
6#include <mutex>
7#include <vector>
8
9namespace lldb_private {
10
11class UnwindTable;
12
14public:
15 // FuncUnwinders objects are used to track UnwindPlans for a function (named
16 // or not - really just an address range)
17
18 // We'll record four different UnwindPlans for each address range:
19 //
20 // 1. Unwinding from a call site (a valid exception throw location)
21 // This is often sourced from the eh_frame exception handling info
22 // 2. Unwinding from a non-call site (any location in the function)
23 // This is often done by analyzing the function prologue assembly
24 // language instructions
25 // 3. A fast unwind method for this function which only retrieves a
26 // limited set of registers necessary to walk the stack
27 // 4. An architectural default unwind plan when none of the above are
28 // available for some reason.
29
30 // Additionally, FuncUnwinds object can be asked where the prologue
31 // instructions are finished for migrating breakpoints past the stack frame
32 // setup instructions when we don't have line table information.
33
35
37
39
41 lldb_private::Thread &thread);
42
44 lldb_private::Thread &thread);
45
48
51
53
54 const Address &GetFunctionStartAddress() const;
55
56 bool ContainsAddress(const Address &addr) const {
57 return m_range.ContainsFileAddress(addr);
58 }
59
60 // A function may have a Language Specific Data Area specified -- a block of
61 // data in
62 // the object file which is used in the processing of an exception throw /
63 // catch. If any of the UnwindPlans have the address of the LSDA region for
64 // this function, this will return it.
66
67 // A function may have a Personality Routine associated with it -- used in the
68 // processing of throwing an exception. If any of the UnwindPlans have the
69 // address of the personality routine, this will return it. Read the target-
70 // pointer at this address to get the personality function address.
72
73 // The following methods to retrieve specific unwind plans should rarely be
74 // used. Instead, clients should ask for the *behavior* they are looking for,
75 // using one of the above UnwindPlan retrieval methods.
76
78
80
82 Thread &thread);
83
85
87 Thread &thread);
88
90
92 Thread &thread);
93
95
97
99
101
103
104private:
106
107 // Do a simplistic comparison for the register restore rule for getting the
108 // caller's pc value on two UnwindPlans -- returns LazyBoolYes if they have
109 // the same unwind rule for the pc, LazyBoolNo if they do not have the same
110 // unwind rule for the pc, and LazyBoolCalculate if it was unable to
111 // determine this for some reason.
113 Thread &thread, const lldb::UnwindPlanSP &a, const lldb::UnwindPlanSP &b);
114
117
118 std::recursive_mutex m_mutex;
119
124
125 // augmented by assembly inspection so it's valid everywhere
129
130 std::vector<lldb::UnwindPlanSP> m_unwind_plan_compact_unwind;
136
137 // Fetching the UnwindPlans can be expensive - if we've already attempted to
138 // get one & failed, don't try again.
149
151
152 FuncUnwinders(const FuncUnwinders &) = delete;
153 const FuncUnwinders &operator=(const FuncUnwinders &) = delete;
154
155}; // class FuncUnwinders
156
157} // namespace lldb_private
158
159#endif // LLDB_SYMBOL_FUNCUNWINDERS_H
A section + offset based address range class.
Definition: AddressRange.h:25
bool ContainsFileAddress(const Address &so_addr) const
Check if a section offset address is contained in this range.
A section + offset based address class.
Definition: Address.h:62
Address & GetFirstNonPrologueInsn(Target &target)
lldb::UnwindPlanSP m_unwind_plan_debug_frame_augmented_sp
lldb::UnwindPlanSP GetAssemblyUnwindPlan(Target &target, Thread &thread)
lldb::UnwindPlanSP GetEHFrameUnwindPlan(Target &target)
lldb::UnwindPlanSP GetUnwindPlanFastUnwind(Target &target, lldb_private::Thread &thread)
std::vector< lldb::UnwindPlanSP > m_unwind_plan_compact_unwind
lldb::UnwindPlanSP GetObjectFileAugmentedUnwindPlan(Target &target, Thread &thread)
Address GetLSDAAddress(Target &target)
lldb::UnwindPlanSP m_unwind_plan_object_file_sp
lldb_private::LazyBool CompareUnwindPlansForIdenticalInitialPCLocation(Thread &thread, const lldb::UnwindPlanSP &a, const lldb::UnwindPlanSP &b)
bool ContainsAddress(const Address &addr) const
Definition: FuncUnwinders.h:56
const Address & GetFunctionStartAddress() const
lldb::UnwindPlanSP m_unwind_plan_assembly_sp
lldb::UnwindPlanSP GetEHFrameAugmentedUnwindPlan(Target &target, Thread &thread)
lldb::UnwindPlanSP GetDebugFrameUnwindPlan(Target &target)
const FuncUnwinders & operator=(const FuncUnwinders &)=delete
lldb::UnwindPlanSP m_unwind_plan_arch_default_sp
lldb::UnwindPlanSP GetUnwindPlanAtNonCallSite(Target &target, lldb_private::Thread &thread)
lldb::UnwindPlanSP m_unwind_plan_debug_frame_sp
FuncUnwinders(const FuncUnwinders &)=delete
std::recursive_mutex m_mutex
lldb::UnwindPlanSP m_unwind_plan_eh_frame_augmented_sp
lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp
lldb::UnwindPlanSP GetDebugFrameAugmentedUnwindPlan(Target &target, Thread &thread)
Address GetPersonalityRoutinePtrAddress(Target &target)
lldb::UnwindPlanSP m_unwind_plan_arch_default_at_func_entry_sp
lldb::UnwindPlanSP GetArchDefaultUnwindPlan(Thread &thread)
lldb::UnwindPlanSP m_unwind_plan_arm_unwind_sp
lldb::UnwindPlanSP GetCompactUnwindUnwindPlan(Target &target)
lldb::UnwindPlanSP GetUnwindPlanArchitectureDefault(lldb_private::Thread &thread)
lldb::UnwindPlanSP GetArchDefaultAtFuncEntryUnwindPlan(Thread &thread)
lldb::UnwindPlanSP m_unwind_plan_fast_sp
lldb::UnwindPlanSP m_unwind_plan_symbol_file_sp
lldb::UnwindAssemblySP GetUnwindAssemblyProfiler(Target &target)
lldb::UnwindPlanSP GetArmUnwindUnwindPlan(Target &target)
lldb::UnwindPlanSP GetObjectFileUnwindPlan(Target &target)
lldb::UnwindPlanSP GetUnwindPlanAtCallSite(Target &target, Thread &thread)
lldb::UnwindPlanSP GetUnwindPlanArchitectureDefaultAtFunctionEntry(lldb_private::Thread &thread)
lldb::UnwindPlanSP m_unwind_plan_object_file_augmented_sp
lldb::UnwindPlanSP GetSymbolFileUnwindPlan(Thread &thread)
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::UnwindPlan > UnwindPlanSP
Definition: lldb-forward.h:479
std::shared_ptr< lldb_private::UnwindAssembly > UnwindAssemblySP
Definition: lldb-forward.h:478