LLVM 20.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
18
20
21namespace llvm {
22
23namespace orc {
24
25Error preserveDebugSections(jitlink::LinkGraph &G);
26// The backing stringmap is also returned, for memory liftime management.
27Expected<std::pair<std::unique_ptr<DWARFContext>,
28 StringMap<std::unique_ptr<MemoryBuffer>>>>
29createDWARFContext(jitlink::LinkGraph &G);
30
31// Thin wrapper around preserveDebugSections to be used as a standalone plugin.
32class DebugInfoPreservationPlugin : public ObjectLinkingLayer::Plugin {
33public:
36 jitlink::PassConfiguration &PassConfig) override {
37 PassConfig.PrePrunePasses.push_back(preserveDebugSections);
38 }
39
41 // Do nothing.
42 return Error::success();
43 }
45 // Do nothing.
46 return Error::success();
47 }
49 ResourceKey SrcKey) override {
50 // Do nothing.
51 }
52
54 return std::make_unique<DebugInfoPreservationPlugin>();
55 }
56};
57
58} // namespace orc
59
60} // namespace llvm
61
62#endif
#define G(x, y, z)
Definition: MD5.cpp:56
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:337
Tagged union holding either a T or a Error.
Definition: Error.h:481
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:897
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:571
Error preserveDebugSections(jitlink::LinkGraph &G)
Expected< std::pair< std::unique_ptr< DWARFContext >, StringMap< std::unique_ptr< MemoryBuffer > > > > createDWARFContext(jitlink::LinkGraph &G)
uintptr_t ResourceKey
Definition: Core.h:74
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18