72struct RegisteredObjectInfo {
73 RegisteredObjectInfo() =
default;
86 RegisteredObjectBufferMap;
103 RegisteredObjectBufferMap ObjectBufferMap;
106 GDBJITRegistrationListener() =
default;
110 ~GDBJITRegistrationListener()
override;
113 static GDBJITRegistrationListener &instance() {
114 static GDBJITRegistrationListener Instance;
121 void notifyObjectLoaded(ObjectKey K,
const ObjectFile &Obj,
127 void notifyFreeingObject(ObjectKey K)
override;
133 void deregisterObjectInternal(RegisteredObjectBufferMap::iterator
I);
152GDBJITRegistrationListener::~GDBJITRegistrationListener() {
154 std::lock_guard<llvm::sys::Mutex> locked(JITDebugLock);
155 for (RegisteredObjectBufferMap::iterator
I = ObjectBufferMap.begin(),
156 E = ObjectBufferMap.end();
160 deregisterObjectInternal(
I);
162 ObjectBufferMap.clear();
165void GDBJITRegistrationListener::notifyObjectLoaded(
175 const char *Buffer = DebugObj.
getBinary()->getMemoryBufferRef().getBufferStart();
176 size_t Size = DebugObj.
getBinary()->getMemoryBufferRef().getBufferSize();
178 std::lock_guard<llvm::sys::Mutex> locked(JITDebugLock);
179 assert(!ObjectBufferMap.contains(K) &&
180 "Second attempt to perform debug registration.");
185 "Allocation failed when registering a JIT entry!\n");
191 RegisteredObjectInfo(
Size, JITCodeEntry, std::move(DebugObj));
192 NotifyDebugger(JITCodeEntry);
196void GDBJITRegistrationListener::notifyFreeingObject(ObjectKey K) {
197 std::lock_guard<llvm::sys::Mutex> locked(JITDebugLock);
198 RegisteredObjectBufferMap::iterator
I = ObjectBufferMap.find(K);
200 if (
I != ObjectBufferMap.end()) {
201 deregisterObjectInternal(
I);
202 ObjectBufferMap.erase(
I);
206void GDBJITRegistrationListener::deregisterObjectInternal(
207 RegisteredObjectBufferMap::iterator
I) {
236 JITCodeEntry =
nullptr;
244 return &GDBJITRegistrationListener::instance();
#define LLVM_ATTRIBUTE_USED
This file defines the DenseMap class.
struct jit_descriptor __jit_debug_descriptor
void __jit_debug_register_code()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
JITEventListener - Abstract interface for use by the JIT to notify clients about significant events d...
static JITEventListener * createGDBRegistrationListener()
Information about the loaded object.
This class is the base class for all object file types.
LLVMJITEventListenerRef LLVMCreateGDBRegistrationListener(void)
struct LLVMOpaqueJITEventListener * LLVMJITEventListenerRef
This is an optimization pass for GlobalISel generic memory operations.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
LLVMAttributeRef wrap(Attribute Attr)
Implement std::hash so that hash_code can be used in STL containers.
struct jit_code_entry * prev_entry
const char * symfile_addr
struct jit_code_entry * next_entry
struct jit_code_entry * relevant_entry
struct jit_code_entry * first_entry