LLDB mainline
UnwindTable.h
Go to the documentation of this file.
1//===-- UnwindTable.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_SYMBOL_UNWINDTABLE_H
10#define LLDB_SYMBOL_UNWINDTABLE_H
11
12#include <map>
13#include <mutex>
14#include <optional>
15
16#include "lldb/lldb-private.h"
17
18namespace lldb_private {
19
20// A class which holds all the FuncUnwinders objects for a given ObjectFile.
21// The UnwindTable is populated with FuncUnwinders objects lazily during the
22// debug session.
23
25public:
26 /// Create an Unwind table using the data in the given module.
27 explicit UnwindTable(Module &module);
28
30
32
35
37
40
42 SymbolContext &sc);
43
45
46 // Normally when we create a new FuncUnwinders object we track it in this
47 // UnwindTable so it can be reused later. But for the target modules show-
48 // unwind we want to create brand new UnwindPlans for the function of
49 // interest - so ignore any existing FuncUnwinders for that function and
50 // don't add this new one to our UnwindTable. This FuncUnwinders object does
51 // have a reference to the UnwindTable but the lifetime of this uncached
52 // FuncUnwinders is expected to be short so in practice this will not be a
53 // problem.
56 const SymbolContext &sc);
57
59
60 /// Called after an ObjectFile/SymbolFile has been added to a Module to add
61 /// any new unwind sections that may now be available.
62 void ModuleWasUpdated();
63
64private:
65 void Dump(Stream &s);
66
67 void Initialize();
68 std::optional<AddressRange> GetAddressRange(const Address &addr,
69 const SymbolContext &sc);
70
71 typedef std::map<lldb::addr_t, lldb::FuncUnwindersSP> collection;
72 typedef collection::iterator iterator;
73 typedef collection::const_iterator const_iterator;
74
77
78 bool m_scanned_all_unwind_sources; // true when we have looked at the
79 // ObjectFile and SymbolFile for all
80 // sources of unwind information; false if
81 // we haven't done that yet, or one of the
82 // files has been updated in the Module.
83 std::mutex m_mutex;
84
85 std::unique_ptr<CallFrameInfo> m_object_file_unwind_up;
86 std::unique_ptr<DWARFCallFrameInfo> m_eh_frame_up;
87 std::unique_ptr<DWARFCallFrameInfo> m_debug_frame_up;
88 std::unique_ptr<CompactUnwindInfo> m_compact_unwind_up;
89 std::unique_ptr<ArmUnwindInfo> m_arm_unwind_up;
90
91 UnwindTable(const UnwindTable &) = delete;
92 const UnwindTable &operator=(const UnwindTable &) = delete;
93};
94
95} // namespace lldb_private
96
97#endif // LLDB_SYMBOL_UNWINDTABLE_H
A section + offset based address class.
Definition: Address.h:62
An architecture specification class.
Definition: ArchSpec.h:31
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:89
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:34
Provides public interface for all SymbolFiles.
Definition: SymbolFile.h:50
std::optional< AddressRange > GetAddressRange(const Address &addr, const SymbolContext &sc)
Definition: UnwindTable.cpp:94
lldb_private::DWARFCallFrameInfo * GetEHFrameInfo()
std::unique_ptr< DWARFCallFrameInfo > m_debug_frame_up
Definition: UnwindTable.h:87
std::unique_ptr< CallFrameInfo > m_object_file_unwind_up
Definition: UnwindTable.h:85
bool GetAllowAssemblyEmulationUnwindPlans()
ArmUnwindInfo * GetArmUnwindInfo()
std::unique_ptr< DWARFCallFrameInfo > m_eh_frame_up
Definition: UnwindTable.h:86
std::unique_ptr< CompactUnwindInfo > m_compact_unwind_up
Definition: UnwindTable.h:88
const UnwindTable & operator=(const UnwindTable &)=delete
SymbolFile * GetSymbolFile()
collection::const_iterator const_iterator
Definition: UnwindTable.h:73
void ModuleWasUpdated()
Called after an ObjectFile/SymbolFile has been added to a Module to add any new unwind sections that ...
Definition: UnwindTable.cpp:86
lldb::FuncUnwindersSP GetFuncUnwindersContainingAddress(const Address &addr, SymbolContext &sc)
std::map< lldb::addr_t, lldb::FuncUnwindersSP > collection
Definition: UnwindTable.h:71
UnwindTable(const UnwindTable &)=delete
lldb_private::DWARFCallFrameInfo * GetDebugFrameInfo()
lldb::FuncUnwindersSP GetUncachedFuncUnwindersContainingAddress(const Address &addr, const SymbolContext &sc)
lldb_private::CompactUnwindInfo * GetCompactUnwindInfo()
lldb_private::CallFrameInfo * GetObjectFileUnwindInfo()
collection::iterator iterator
Definition: UnwindTable.h:72
std::unique_ptr< ArmUnwindInfo > m_arm_unwind_up
Definition: UnwindTable.h:89
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::FuncUnwinders > FuncUnwindersSP
Definition: lldb-forward.h:356