LLVM 24.0.0git
ELFDebugObjectPlugin.h
Go to the documentation of this file.
1//===------ ELFDebugObjectPlugin.h - JITLink debug objects ------*- 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// ObjectLinkingLayer plugin for emitting debug objects.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_ELFDEBUGOBJECTPLUGIN_H
14#define LLVM_EXECUTIONENGINE_ORC_ELFDEBUGOBJECTPLUGIN_H
15
21#include "llvm/Support/Error.h"
22#include "llvm/Support/Memory.h"
25
26#include <map>
27#include <memory>
28#include <mutex>
29
30namespace llvm {
31namespace orc {
32
33class DebugObject;
34
35/// Debugger support for ELF platforms with the GDB JIT Interface. The plugin
36/// emits and manages a separate debug object allocation in addition to the
37/// LinkGraph's own allocation and it notifies the debugger when necessary.
38///
40public:
41 /// Create the plugin for the given session and set additional options
42 ///
43 /// RequireDebugSections:
44 /// Emit debug objects only if the LinkGraph contains debug info. Turning
45 /// this off allows minimal debugging based on raw symbol names, but it
46 /// comes with significant overhead for release configurations.
47 ///
48 ELFDebugObjectPlugin(ExecutionSession &ES, bool RequireDebugSections,
49 Error &Err);
51
54 MemoryBufferRef InputObj) override;
55
58
60 ResourceKey SrcKey) override;
61
64 jitlink::PassConfiguration &PassConfig) override;
65
66private:
68
69 using OwnedDebugObject = std::unique_ptr<DebugObject>;
70 std::map<MaterializationResponsibility *, OwnedDebugObject> PendingObjs;
71 std::map<ResourceKey, std::vector<OwnedDebugObject>> RegisteredObjs;
72
73 std::mutex PendingObjsLock;
74 std::mutex RegisteredObjsLock;
75
76 ExecutorAddr RegistrationAction;
77 bool RequireDebugSections;
78
79 DebugObject *getPendingDebugObj(MaterializationResponsibility &MR);
80};
81
82} // namespace orc
83} // namespace llvm
84
85#endif // LLVM_EXECUTIONENGINE_ORC_ELFDEBUGOBJECTPLUGIN_H
#define LLVM_ABI
Definition Compiler.h:215
#define G(x, y, z)
Definition MD5.cpp:55
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Error notifyFailed(MaterializationResponsibility &MR) override
void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey, ResourceKey SrcKey) override
void notifyMaterializing(MaterializationResponsibility &MR, jitlink::LinkGraph &G, jitlink::JITLinkContext &Ctx, MemoryBufferRef InputObj) override
Error notifyRemovingResources(JITDylib &JD, ResourceKey K) override
void modifyPassConfig(MaterializationResponsibility &MR, jitlink::LinkGraph &LG, jitlink::PassConfiguration &PassConfig) override
ELFDebugObjectPlugin(ExecutionSession &ES, bool RequireDebugSections, Error &Err)
Create the plugin for the given session and set additional options.
An ExecutionSession represents a running JIT program.
Definition Core.h:1111
Represents an address in the executor process.
Represents a JIT'd dynamic library.
Definition Core.h:675
Plugin instances can be added to the ObjectLinkingLayer to receive callbacks when code is loaded or e...
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition Core.h:349
uintptr_t ResourceKey
Definition Core.h:60
This is an optimization pass for GlobalISel generic memory operations.