LLVM 22.0.0git
DebugInfoSupport.h
Go to the documentation of this file.
1//===--- DebugInfoSupport.h ---- Utils for debug info support ---*- 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 to preserve and parse debug info from LinkGraphs.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_DEBUGINFOSUPPORT_H
14#define LLVM_EXECUTIONENGINE_ORC_DEBUGINFOSUPPORT_H
15
19
21
22namespace llvm {
23
24namespace orc {
25
26LLVM_ABI Error preserveDebugSections(jitlink::LinkGraph &G);
27// The backing stringmap is also returned, for memory liftime management.
28LLVM_ABI Expected<std::pair<std::unique_ptr<DWARFContext>,
29 StringMap<std::unique_ptr<MemoryBuffer>>>>
30createDWARFContext(jitlink::LinkGraph &G);
31
32// Thin wrapper around preserveDebugSections to be used as a standalone plugin.
33class DebugInfoPreservationPlugin : public ObjectLinkingLayer::Plugin {
34public:
37 jitlink::PassConfiguration &PassConfig) override {
38 PassConfig.PrePrunePasses.push_back(preserveDebugSections);
39 }
40
42 // Do nothing.
43 return Error::success();
44 }
46 // Do nothing.
47 return Error::success();
48 }
50 ResourceKey SrcKey) override {
51 // Do nothing.
52 }
53
55 return std::make_unique<DebugInfoPreservationPlugin>();
56 }
57};
58
59} // namespace orc
60
61} // namespace llvm
62
63#endif
#define LLVM_ABI
Definition: Compiler.h:213
#define G(x, y, z)
Definition: MD5.cpp:56
Lightweight error class with error context and mandatory checking.
Definition: Error.h:159
static ErrorSuccess success()
Create a success value.
Definition: Error.h:336
Tagged union holding either a T or a Error.
Definition: Error.h:485
Error notifyFailed(MaterializationResponsibility &MR) override
void modifyPassConfig(MaterializationResponsibility &MR, jitlink::LinkGraph &LG, jitlink::PassConfiguration &PassConfig) override
static Expected< std::unique_ptr< DebugInfoPreservationPlugin > > Create()
Error notifyRemovingResources(JITDylib &JD, ResourceKey K) override
void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey, ResourceKey SrcKey) override
Represents a JIT'd dynamic library.
Definition: Core.h:902
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:576
LLVM_ABI Error preserveDebugSections(jitlink::LinkGraph &G)
LLVM_ABI Expected< std::pair< std::unique_ptr< DWARFContext >, StringMap< std::unique_ptr< MemoryBuffer > > > > createDWARFContext(jitlink::LinkGraph &G)
uintptr_t ResourceKey
Definition: Core.h:75
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18