File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
source/Plugins/DynamicLoader/MacOSX-DYLD Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 10
10
#define LLDB_TARGET_DYNAMICLOADER_H
11
11
12
12
#include " lldb/Core/PluginInterface.h"
13
+ #include " lldb/Symbol/Symbol.h"
13
14
#include " lldb/Utility/FileSpec.h"
14
15
#include " lldb/Utility/Status.h"
15
16
#include " lldb/Utility/UUID.h"
17
+ #include " lldb/Utility/UnimplementedError.h"
16
18
#include " lldb/lldb-defines.h"
17
19
#include " lldb/lldb-forward.h"
18
20
#include " lldb/lldb-private-enumerations.h"
@@ -24,7 +26,6 @@ namespace lldb_private {
24
26
class ModuleList ;
25
27
class Process ;
26
28
class SectionList ;
27
- class Symbol ;
28
29
class SymbolContext ;
29
30
class SymbolContextList ;
30
31
class Thread ;
@@ -329,6 +330,11 @@ class DynamicLoader : public PluginInterface {
329
330
// / safe to call certain APIs or SPIs.
330
331
virtual bool IsFullyInitialized () { return true ; }
331
332
333
+ // / Return the `start` function \b symbol in the dynamic loader module.
334
+ virtual llvm::Expected<lldb_private::Symbol> GetStartSymbol () {
335
+ return llvm::make_error<UnimplementedError>();
336
+ }
337
+
332
338
protected:
333
339
// Utility methods for derived classes
334
340
Original file line number Diff line number Diff line change @@ -609,6 +609,21 @@ void DynamicLoaderDarwin::UpdateDYLDImageInfoFromNewImageInfo(
609
609
}
610
610
}
611
611
612
+ llvm::Expected<lldb_private::Symbol> DynamicLoaderDarwin::GetStartSymbol () {
613
+ ModuleSP dyld_sp = GetDYLDModule ();
614
+ if (!dyld_sp)
615
+ return llvm::createStringError (
616
+ " Couldn't retrieve DYLD module. Cannot get `start` symbol." );
617
+
618
+ const Symbol *symbol =
619
+ dyld_sp->FindFirstSymbolWithNameAndType (ConstString (" _dyld_start" ));
620
+ if (!symbol)
621
+ return llvm::createStringError (
622
+ " Cannot find `start` symbol in DYLD module." );
623
+
624
+ return *symbol;
625
+ }
626
+
612
627
void DynamicLoaderDarwin::SetDYLDModule (lldb::ModuleSP &dyld_module_sp) {
613
628
m_dyld_module_wp = dyld_module_sp;
614
629
}
Original file line number Diff line number Diff line change @@ -67,6 +67,8 @@ class DynamicLoaderDarwin : public lldb_private::DynamicLoader {
67
67
// Clear method for classes derived from this one
68
68
virtual void DoClear () = 0;
69
69
70
+ llvm::Expected<lldb_private::Symbol> GetStartSymbol () override ;
71
+
70
72
void SetDYLDModule (lldb::ModuleSP &dyld_module_sp);
71
73
72
74
lldb::ModuleSP GetDYLDModule ();
You can’t perform that action at this time.
0 commit comments