LLVM 22.0.0git
UnwindInfoManager.h
Go to the documentation of this file.
1//===--- UnwindInfoManager.h -- Register unwind info sections ---*- 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// Utilities for managing eh-frame and compact-unwind registration and lookup
10// through libunwind's find_dynamic_unwind_sections mechanism.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_UNWINDINFOMANAGER_H
15#define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_UNWINDINFOMANAGER_H
16
19#include "llvm/Support/Error.h"
20#include <map>
21#include <mutex>
22
23namespace llvm::orc {
24
26public:
27 // This struct's layout should match the unw_dynamic_unwind_sections struct
28 // from libunwind/src/libunwid_ext.h.
30 uintptr_t dso_base;
31 uintptr_t dwarf_section;
35 };
36
40
41 /// If the libunwind find-dynamic-unwind-info callback registration APIs are
42 /// available then this method will instantiate a global UnwindInfoManager
43 /// instance suitable for the process and return true. Otherwise it will
44 /// return false.
45 LLVM_ABI static bool TryEnable();
46
48
49 LLVM_ABI static Error
51 orc::ExecutorAddr DSOBase,
52 orc::ExecutorAddrRange DWARFEHFrame,
53 orc::ExecutorAddrRange CompactUnwind);
54
55 LLVM_ABI static Error
57
58private:
59 UnwindInfoManager() = default;
60
61 int findSectionsImpl(uintptr_t Addr, UnwindSections *Info);
62 static int findSections(uintptr_t Addr, UnwindSections *Info);
63
64 Error registerSectionsImpl(ArrayRef<orc::ExecutorAddrRange> CodeRanges,
65 orc::ExecutorAddr DSOBase,
66 orc::ExecutorAddrRange DWARFEHFrame,
67 orc::ExecutorAddrRange CompactUnwind);
68
69 Error deregisterSectionsImpl(ArrayRef<orc::ExecutorAddrRange> CodeRanges);
70
71 std::mutex M;
72 std::map<uintptr_t, UnwindSections> UWSecs;
73};
74
75} // namespace llvm::orc
76
77#endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_UNWINDINFOMANAGER_H
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
#define LLVM_ABI
Definition: Compiler.h:213
uint64_t Addr
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Lightweight error class with error context and mandatory checking.
Definition: Error.h:159
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:133
Represents an address in the executor process.
static LLVM_ABI bool TryEnable()
If the libunwind find-dynamic-unwind-info callback registration APIs are available then this method w...
UnwindInfoManager(UnwindInfoManager &&)=delete
static LLVM_ABI void addBootstrapSymbols(StringMap< ExecutorAddr > &M)
static LLVM_ABI Error deregisterSections(ArrayRef< orc::ExecutorAddrRange > CodeRanges)
UnwindInfoManager & operator=(UnwindInfoManager &&)=delete
static LLVM_ABI Error registerSections(ArrayRef< orc::ExecutorAddrRange > CodeRanges, orc::ExecutorAddr DSOBase, orc::ExecutorAddrRange DWARFEHFrame, orc::ExecutorAddrRange CompactUnwind)
Represents an address range in the exceutor process.