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 1010#define LLDB_TARGET_DYNAMICLOADER_H
1111
1212#include " lldb/Core/PluginInterface.h"
13+ #include " lldb/Symbol/Symbol.h"
1314#include " lldb/Utility/FileSpec.h"
1415#include " lldb/Utility/Status.h"
1516#include " lldb/Utility/UUID.h"
17+ #include " lldb/Utility/UnimplementedError.h"
1618#include " lldb/lldb-defines.h"
1719#include " lldb/lldb-forward.h"
1820#include " lldb/lldb-private-enumerations.h"
@@ -24,7 +26,6 @@ namespace lldb_private {
2426class ModuleList ;
2527class Process ;
2628class SectionList ;
27- class Symbol ;
2829class SymbolContext ;
2930class SymbolContextList ;
3031class Thread ;
@@ -329,6 +330,11 @@ class DynamicLoader : public PluginInterface {
329330 // / safe to call certain APIs or SPIs.
330331 virtual bool IsFullyInitialized () { return true ; }
331332
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+
332338protected:
333339 // Utility methods for derived classes
334340
Original file line number Diff line number Diff line change @@ -609,6 +609,21 @@ void DynamicLoaderDarwin::UpdateDYLDImageInfoFromNewImageInfo(
609609 }
610610}
611611
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+
612627void DynamicLoaderDarwin::SetDYLDModule (lldb::ModuleSP &dyld_module_sp) {
613628 m_dyld_module_wp = dyld_module_sp;
614629}
Original file line number Diff line number Diff line change @@ -67,6 +67,8 @@ class DynamicLoaderDarwin : public lldb_private::DynamicLoader {
6767 // Clear method for classes derived from this one
6868 virtual void DoClear () = 0;
6969
70+ llvm::Expected<lldb_private::Symbol> GetStartSymbol () override ;
71+
7072 void SetDYLDModule (lldb::ModuleSP &dyld_module_sp);
7173
7274 lldb::ModuleSP GetDYLDModule ();
You can’t perform that action at this time.
0 commit comments