Skip to content

[lldb] Change GetStartSymbol to GetStartAddress in DynamicLoader #8997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lldb/include/lldb/Target/DynamicLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#ifndef LLDB_TARGET_DYNAMICLOADER_H
#define LLDB_TARGET_DYNAMICLOADER_H

#include "lldb/Core/Address.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/UUID.h"
Expand All @@ -25,6 +25,7 @@ namespace lldb_private {
class ModuleList;
class Process;
class SectionList;
class Symbol;
class SymbolContext;
class SymbolContextList;
class Thread;
Expand Down Expand Up @@ -329,10 +330,10 @@ class DynamicLoader : public PluginInterface {
/// safe to call certain APIs or SPIs.
virtual bool IsFullyInitialized() { return true; }

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ void DynamicLoaderDarwin::UpdateDYLDImageInfoFromNewImageInfo(
}
}

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

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

return *symbol;
return symbol->GetAddress();
}

void DynamicLoaderDarwin::SetDYLDModule(lldb::ModuleSP &dyld_module_sp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class DynamicLoaderDarwin : public lldb_private::DynamicLoader {

virtual bool NeedToDoInitialImageFetch() = 0;

std::optional<lldb_private::Address> GetStartAddress() override;

protected:
void PrivateInitialize(lldb_private::Process *process);

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

std::optional<lldb_private::Symbol> GetStartSymbol() override;

void SetDYLDModule(lldb::ModuleSP &dyld_module_sp);

lldb::ModuleSP GetDYLDModule();
Expand Down