Skip to content

Commit 06f3297

Browse files
authored
Merge pull request swiftlang#8997 from medismailben/dyld-start-address
[lldb] Change GetStartSymbol to GetStartAddress in DynamicLoader
2 parents ec7116c + 53d401e commit 06f3297

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

lldb/include/lldb/Target/DynamicLoader.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#ifndef LLDB_TARGET_DYNAMICLOADER_H
1010
#define LLDB_TARGET_DYNAMICLOADER_H
1111

12+
#include "lldb/Core/Address.h"
1213
#include "lldb/Core/PluginInterface.h"
13-
#include "lldb/Symbol/Symbol.h"
1414
#include "lldb/Utility/FileSpec.h"
1515
#include "lldb/Utility/Status.h"
1616
#include "lldb/Utility/UUID.h"
@@ -25,6 +25,7 @@ namespace lldb_private {
2525
class ModuleList;
2626
class Process;
2727
class SectionList;
28+
class Symbol;
2829
class SymbolContext;
2930
class SymbolContextList;
3031
class Thread;
@@ -329,10 +330,10 @@ class DynamicLoader : public PluginInterface {
329330
/// safe to call certain APIs or SPIs.
330331
virtual bool IsFullyInitialized() { return true; }
331332

332-
/// Return the `start` function \b symbol in the dynamic loader module.
333-
/// This is the symbol the process will begin executing with
333+
/// Return the `start` \b address in the dynamic loader module.
334+
/// This is the address the process will begin executing with
334335
/// `process launch --stop-at-entry`.
335-
virtual std::optional<lldb_private::Symbol> GetStartSymbol() {
336+
virtual std::optional<lldb_private::Address> GetStartAddress() {
336337
return std::nullopt;
337338
}
338339

lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ void DynamicLoaderDarwin::UpdateDYLDImageInfoFromNewImageInfo(
609609
}
610610
}
611611

612-
std::optional<lldb_private::Symbol> DynamicLoaderDarwin::GetStartSymbol() {
612+
std::optional<lldb_private::Address> DynamicLoaderDarwin::GetStartAddress() {
613613
Log *log = GetLog(LLDBLog::DynamicLoader);
614614

615615
auto log_err = [log](llvm::StringLiteral err_msg) -> std::nullopt_t {
@@ -626,7 +626,7 @@ std::optional<lldb_private::Symbol> DynamicLoaderDarwin::GetStartSymbol() {
626626
if (!symbol)
627627
return log_err("Cannot find `start` symbol in DYLD module.");
628628

629-
return *symbol;
629+
return symbol->GetAddress();
630630
}
631631

632632
void DynamicLoaderDarwin::SetDYLDModule(lldb::ModuleSP &dyld_module_sp) {

lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class DynamicLoaderDarwin : public lldb_private::DynamicLoader {
5656

5757
virtual bool NeedToDoInitialImageFetch() = 0;
5858

59+
std::optional<lldb_private::Address> GetStartAddress() override;
60+
5961
protected:
6062
void PrivateInitialize(lldb_private::Process *process);
6163

@@ -67,8 +69,6 @@ class DynamicLoaderDarwin : public lldb_private::DynamicLoader {
6769
// Clear method for classes derived from this one
6870
virtual void DoClear() = 0;
6971

70-
std::optional<lldb_private::Symbol> GetStartSymbol() override;
71-
7272
void SetDYLDModule(lldb::ModuleSP &dyld_module_sp);
7373

7474
lldb::ModuleSP GetDYLDModule();

0 commit comments

Comments
 (0)