Skip to content

Cherrypick Objective-C Runtime Changes #2755

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 4 commits into from
Mar 29, 2021
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
10 changes: 9 additions & 1 deletion lldb/include/lldb/Target/DynamicLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ class DynamicLoader : public PluginInterface {
return false;
}

/// Return whether the dynamic loader is fully initialized and it's safe to
/// call its APIs.
///
/// On some systems (e.g. Darwin based systems), lldb will get notified by
/// the dynamic loader before it itself finished initializing and it's not
/// safe to call certain APIs or SPIs.
virtual bool IsFullyInitialized() { return true; }

protected:
// Utility methods for derived classes

Expand Down Expand Up @@ -294,7 +302,7 @@ class DynamicLoader : public PluginInterface {
// Read a pointer from memory at the given addr. Return LLDB_INVALID_ADDRESS
// if the read fails.
lldb::addr_t ReadPointer(lldb::addr_t addr);

// Calls into the Process protected method LoadOperatingSystemPlugin:
void LoadOperatingSystemPlugin(bool flush);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,12 @@ bool DynamicLoaderMacOSXDYLD::GetSharedCacheInformation(
return false;
}

bool DynamicLoaderMacOSXDYLD::IsFullyInitialized() {
if (ReadAllImageInfosStructure())
return m_dyld_all_image_infos.libSystemInitialized;
return false;
}

void DynamicLoaderMacOSXDYLD::Initialize() {
PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(), CreateInstance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class DynamicLoaderMacOSXDYLD : public lldb_private::DynamicLoaderDarwin {

uint32_t GetPluginVersion() override;

bool IsFullyInitialized() override;

protected:
void PutToLog(lldb_private::Log *log) const;

Expand Down
Loading