LLDB mainline
DynamicLoaderHexagonDYLD.h
Go to the documentation of this file.
1//===-- DynamicLoaderHexagonDYLD.h ------------------------------*- 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#ifndef LLDB_SOURCE_PLUGINS_DYNAMICLOADER_HEXAGON_DYLD_DYNAMICLOADERHEXAGONDYLD_H
10#define LLDB_SOURCE_PLUGINS_DYNAMICLOADER_HEXAGON_DYLD_DYNAMICLOADERHEXAGONDYLD_H
11
14
16
18public:
20
22
23 static void Initialize();
24
25 static void Terminate();
26
27 static llvm::StringRef GetPluginNameStatic() { return "hexagon-dyld"; }
28
29 static llvm::StringRef GetPluginDescriptionStatic();
30
32 CreateInstance(lldb_private::Process *process, bool force);
33
34 // DynamicLoader protocol
35
36 void DidAttach() override;
37
38 void DidLaunch() override;
39
41 bool stop_others) override;
42
44
46 const lldb::ThreadSP thread,
47 lldb::addr_t tls_file_addr) override;
48
49 // PluginInterface protocol
50 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
51
52protected:
53 /// Runtime linker rendezvous structure.
55
56 /// Virtual load address of the inferior process.
58
59 /// Virtual entry address of the inferior process.
61
62 /// Rendezvous breakpoint.
64
65 /// Loaded module list. (link map for each module)
66 std::map<lldb::ModuleWP, lldb::addr_t, std::owner_less<lldb::ModuleWP>>
68
69 /// Enables a breakpoint on a function called by the runtime
70 /// linker each time a module is loaded or unloaded.
72
73 /// Callback routine which updates the current list of loaded modules based
74 /// on the information supplied by the runtime linker.
75 static bool RendezvousBreakpointHit(
76 void *baton, lldb_private::StoppointCallbackContext *context,
77 lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
78
79 /// Helper method for RendezvousBreakpointHit. Updates LLDB's current set
80 /// of loaded modules.
81 void RefreshModules();
82
83 /// Updates the load address of every allocatable section in \p module.
84 ///
85 /// \param module The module to traverse.
86 ///
87 /// \param link_map_addr The virtual address of the link map for the @p
88 /// module.
89 ///
90 /// \param base_addr The virtual base address \p module is loaded at.
91 void UpdateLoadedSections(lldb::ModuleSP module, lldb::addr_t link_map_addr,
92 lldb::addr_t base_addr,
93 bool base_addr_is_offset) override;
94
95 /// Removes the loaded sections from the target in \p module.
96 ///
97 /// \param module The module to traverse.
98 void UnloadSections(const lldb::ModuleSP module) override;
99
100 /// Callback routine invoked when we hit the breakpoint on process entry.
101 ///
102 /// This routine is responsible for resolving the load addresses of all
103 /// dependent modules required by the inferior and setting up the rendezvous
104 /// breakpoint.
105 static bool
108 lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
109
110 /// Helper for the entry breakpoint callback. Resolves the load addresses
111 /// of all dependent modules.
113
114 /// Computes a value for m_load_offset returning the computed address on
115 /// success and LLDB_INVALID_ADDRESS on failure.
117
118 /// Computes a value for m_entry_point returning the computed address on
119 /// success and LLDB_INVALID_ADDRESS on failure.
121
122 /// Checks to see if the target module has changed, updates the target
123 /// accordingly and returns the target executable module.
125
126 /// return the address of the Rendezvous breakpoint
128
129private:
131 GetSectionListFromModule(const lldb::ModuleSP module) const;
132};
133
134#endif // LLDB_SOURCE_PLUGINS_DYNAMICLOADER_HEXAGON_DYLD_DYNAMICLOADERHEXAGONDYLD_H
lldb::ModuleSP GetTargetExecutable()
Checks to see if the target module has changed, updates the target accordingly and returns the target...
static llvm::StringRef GetPluginDescriptionStatic()
void LoadAllCurrentModules()
Helper for the entry breakpoint callback.
lldb::addr_t FindRendezvousBreakpointAddress()
return the address of the Rendezvous breakpoint
std::map< lldb::ModuleWP, lldb::addr_t, std::owner_less< lldb::ModuleWP > > m_loaded_modules
Loaded module list. (link map for each module)
llvm::StringRef GetPluginName() override
lldb_private::Status CanLoadImage() override
Ask if it is ok to try and load or unload an shared library (image).
lldb::break_id_t m_dyld_bid
Rendezvous breakpoint.
lldb::addr_t m_entry_point
Virtual entry address of the inferior process.
static bool EntryBreakpointHit(void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
Callback routine invoked when we hit the breakpoint on process entry.
bool SetRendezvousBreakpoint()
Enables a breakpoint on a function called by the runtime linker each time a module is loaded or unloa...
lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr) override
Retrieves the per-module TLS block for a given thread.
static lldb_private::DynamicLoader * CreateInstance(lldb_private::Process *process, bool force)
void RefreshModules()
Helper method for RendezvousBreakpointHit.
HexagonDYLDRendezvous m_rendezvous
Runtime linker rendezvous structure.
static bool RendezvousBreakpointHit(void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
Callback routine which updates the current list of loaded modules based on the information supplied b...
lldb::addr_t ComputeLoadOffset()
Computes a value for m_load_offset returning the computed address on success and LLDB_INVALID_ADDRESS...
const lldb_private::SectionList * GetSectionListFromModule(const lldb::ModuleSP module) const
void DidLaunch() override
Called after launching a process.
void UnloadSections(const lldb::ModuleSP module) override
Removes the loaded sections from the target in module.
void UpdateLoadedSections(lldb::ModuleSP module, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset) override
Updates the load address of every allocatable section in module.
static llvm::StringRef GetPluginNameStatic()
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, bool stop_others) override
Provides a plan to step through the dynamic loader trampoline for the current state of thread.
void DidAttach() override
Called after attaching a process.
lldb::addr_t GetEntryPoint()
Computes a value for m_entry_point returning the computed address on success and LLDB_INVALID_ADDRESS...
lldb::addr_t m_load_offset
Virtual load address of the inferior process.
Interface to the runtime linker.
A plug-in interface definition class for dynamic loaders.
Definition: DynamicLoader.h:52
A plug-in interface definition class for debugging a process.
Definition: Process.h:341
An error handling class.
Definition: Status.h:44
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
Definition: lldb-forward.h:444
std::shared_ptr< lldb_private::Thread > ThreadSP
Definition: lldb-forward.h:441
int32_t break_id_t
Definition: lldb-types.h:86
uint64_t user_id_t
Definition: lldb-types.h:82
uint64_t addr_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:368